Data::Plist::Reader - Abstract superclass for BinaryReader


Data-Plist documentation Contained in the Data-Plist distribution.

Index


Code Index:

NAME

Top

Data::Plist::Reader - Abstract superclass for BinaryReader

SYNOPSIS

Top

 # Create new
 $read = Data::Plist::BinaryReader->new;

 # Reading from a string C<$str>
 my $plist = $read->open_string($str);

 # Writing from file C<$filename>
 $plist = $read->read($filename);

DESCRIPTION

Top

Data::Plist::Reader is an abstract superclass of BinaryReader. Takes either a string or a filehandle containing data formatted as an Apple property list and returns it as a Data::Plist.

METHODS

Top

new

Create a new reader.

open_string $content

Takes binary data $content and reads it into a filehandle. Then passes that filehandle to open_fh.

open_file $filename

Takes a filename $filename and reads its data into a filehandle. Then passes the filehandle to open_fh.

open_fh

Place-holder method for Reader's subclass. Currently unimplemented.


Data-Plist documentation Contained in the Data-Plist distribution.
package Data::Plist::Reader;

use strict;
use warnings;

sub new {
    my $class = shift;
    return bless {} => $class;
}

sub open_string {
    my $self = shift;
    my ($content) = @_;

    my $fh;
    open( $fh, "<", \$content );
    return $self->open_fh($fh);
}

sub open_file {
    my $self = shift;
    my ($filename) = @_;

    my $fh;
    open( $fh, "<", $filename ) or die "can't open $filename for conversion";
    binmode($fh);
    return $self->open_fh($fh);
}

sub open_fh {
    my $self = shift;

    die "Unimplemented!";
}

1;