AnyData2

 view release on metacpan or  search on metacpan

lib/AnyData2/Storage.pm  view on Meta::CPAN

sub new
{
    my ($class) = @_;
    bless {}, $class;
}

=head2 read

  my $buf = $stor->read(<characters>)

Use binmode for characters as synonymous for bytes.

=cut

sub read
{
    croak "missing overwritten method";
}

=head2 write

lib/AnyData2/Storage/File/Blockwise.pm  view on Meta::CPAN

    my ( $class, %options ) = @_;
    my $self = $class->SUPER::new(%options);
    @$self{qw(blocksize)} = @options{qw(blocksize)};
    $self;
}

=head2 read

  my $buf = $stor->read(<characters>)

Use binmode for characters as synonymous for bytes.

=cut

sub read
{
    my $self = shift;
    my $buf;
    my $rc = $self->{fh}->sysread( $buf, $self->{blocksize} );
    defined $rc or die "Error reading from $$self->{filename}: $!";
    $rc or return;

lib/AnyData2/Storage/File/Linewise.pm  view on Meta::CPAN

=cut

our $VERSION = '0.002';

=head1 METHODS

=head2 read

  my $buf = $stor->read(<characters>)

Use binmode for characters as synonymous for bytes.

=cut

sub read
{
    my $self = shift;
    $self->{fh}->clearerr;
    my $buf = $self->{fh}->getline;
    $self->{fh}->error and die "Can't read from $self->{filename}: $!";
    defined $buf or return;

lib/AnyData2/Storage/FileSystem.pm  view on Meta::CPAN

    my $self = $class->SUPER::new();
    $self->{dirh} = IO::Dir->new( $options{dirname} ) or die "Can't open $options{dirname}";
    @$self{qw(dirname)} = @options{qw(dirname)};
    $self;
}

=head2 read

  my $entry = $stor->read

Use binmode for characters as synonymous for bytes.

=cut

sub read
{
    my $self  = shift;
    my $entry = $self->{dirh}->read;
    $entry;
}



( run in 0.315 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )