Spreadsheet-Read

 view release on metacpan or  search on metacpan

Read.pm  view on Meta::CPAN

    my $r = ReadData (@_);
    unless ($r) {
	@_ and return;	# new with arguments failed to open resource
	$r = [{
	    parsers	=> [],
	    error	=> undef,
	    sheets	=> 0,
	    sheet	=> { },
	    }];
	}
    bless $r => $class;
    } # new

sub parsers {
    ref $_[0] eq __PACKAGE__ and shift;
    my @c;
    for (sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] }
         grep { $_->[0] !~ m{^(?:dmp|ios|!.*)$} }
         @parsers) {
	my ($typ, $mod, $min) = @$_;
	eval "local \$_; require $mod";

Read.pm  view on Meta::CPAN

	my $r = $_;
	[ map { $s->[$_][$r] } 1..$sheet->{maxcol} ];
	} 1..$sheet->{maxrow};
    } # rows

sub sheet {
    my ($book, $sheet) = @_;
    $book && $sheet or return;
    my $class = "Spreadsheet::Read::Sheet";
    $sheet =~ m/^[0-9]+$/ && $sheet >= 1 && $sheet <= $book->[0]{sheets} and
	return bless $book->[$sheet]			=> $class;
    exists $book->[0]{sheet}{$sheet} and
	return bless $book->[$book->[0]{sheet}{$sheet}]	=> $class;
    foreach my $idx (1 .. $book->[0]{sheets}) {
	$book->[$idx]{label} eq $sheet and
	    return bless $book->[$idx]			=> $class;
	}
    return;
    } # sheet

# If option "clip" is set, remove the trailing rows and
# columns in each sheet that contain no visible data
sub _clipsheets {
    my ($opt, $ref) = @_;

    unless ($ref->[0]{sheets}) {

Read.pm  view on Meta::CPAN

    @id == 2 && $id[0] =~ m/^[0-9]+$/ && $id[1] =~ m/^[0-9]+$/ and
	return $sheet->{cell}[$id[0]][$id[1]];
    @id && $id[0] && exists $sheet->{$id[0]} and
	return $sheet->{$id[0]};
    } # cell

sub attr {
    my ($sheet, @id) = @_;
    my $class = "Spreadsheet::Read::Attribute";
    @id == 2 && $id[0] =~ m/^[0-9]+$/ && $id[1] =~ m/^[0-9]+$/ and
	return bless $sheet->{attr}[$id[0]][$id[1]] => $class;
    if (@id && $id[0] && exists $sheet->{$id[0]}) {
	my ($c, $r) = $sheet->cell2cr ($id[0]);
	return bless $sheet->{attr}[$c][$r] => $class;
	}
    undef;
    } # attr

sub maxrow {
    my $sheet = shift;
    return $sheet->{maxrow};
    } # maxrow

sub maxcol {



( run in 0.327 second using v1.01-cache-2.11-cpan-65fba6d93b7 )