AnyData2

 view release on metacpan or  search on metacpan

lib/AnyData2/Format/CSV.pm  view on Meta::CPAN

to instantiate the parser and prefers L<Text::CSV_XS> over L<Text::CSV>
by default.  When C<csv_skip_first_row> is set to a true value, the first
line of the csv isn't used to guess the names in C<csv_cols>. Specifying
C<csv_cols> always wins over any value of C<csv_skip_first_row>.

=cut

sub new
{
    my ( $class, $storage, %options ) = @_;
    my $self = $class->SUPER::new($storage);

    my $csv_class          = delete $options{csv_class};
    my $csv_skip_first_row = delete $options{csv_skip_first_row};

    defined $csv_class or $csv_class = $class->_guess_suitable_class(qw(Text::CSV_XS Text::CSV));

    my $csv = $csv_class->new( {%options} );
    $self->{csv} = $csv;

    # XXX

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

    AnyData2::Storage::FileSystem->new( dirname => $ENV{HOME} )
  );

constructs a filesystem format

=cut

sub new
{
    my ( $class, $storage, %options ) = @_;
    my $self = $class->SUPER::new($storage);

    $self->{fs_cols} = [qw(entry dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks)];

    $self;
}

=head2 cols

Return column names

lib/AnyData2/Format/Fixed.pm  view on Meta::CPAN


constructs a storage, passes all options down to C<html_table_class>
beside C<html_table_class>, which is used to instantiate the parser.
C<html_table_class> prefers L<HTML::TableExtract> by default.

=cut

sub new
{
    my ( $class, $storage, %options ) = @_;
    my $self = $class->SUPER::new($storage);

    $self->{cols} = [ @{ delete $options{cols} } ];

    $self;
}

=head2 cols

Deliver the keys of the specification array

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

    filemode => "<:raw"
  );

constructs a storage.

=cut

sub new
{
    my ( $class, %options ) = @_;
    my $self = $class->SUPER::new();
    defined $options{filemode} or $options{filemode} = "r";
    my @openparms = qw(filename filemode);
    unless ( $options{filemode} =~ m/^[<>]/ )
    {
        defined $options{fileperms} or $options{fileperms} = 0644;
        push @openparms, qw(fileperms);
    }
    $self->{fh} = IO::File->new( @options{@openparms} ) or die "Can't open $options{filename}: $!";
    @$self{qw(filename filemode fileperms)} = @options{qw(filename filemode fileperms)};
    $self;

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

    blocksize => 512
  );

constructs a storage.

=cut

sub new
{
    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.

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


=head2 new

constructs a storage reading entries from filesystem

=cut

sub new
{
    my ( $class, %options ) = @_;
    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.



( run in 1.290 second using v1.01-cache-2.11-cpan-49f99fa48dc )