BIE-Data-HDF5-File
view release on metacpan or search on metacpan
lib/BIE/Data/HDF5/File.pm view on Meta::CPAN
package BIE::Data::HDF5::File;
our $VERSION = '0.01';
use Moose;
use namespace::autoclean;
use v5.10;
use BIE::Data::HDF5 ':all';
use BIE::Data::HDF5::Path;
has 'h5File' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'fileID' => (
is => 'ro',
isa => 'Int',
writer => 'set_fileID',
);
# 'loc' always tracks current location
has 'loc' => (
is => 'rw',
isa => 'Str',
default => '/',
);
has 'locID' => (
is => 'ro',
writer => 'setLoc',
isa => 'Int',
lazy => 1,
default => sub {
my $self = shift;
H5Gopen($self->fileID, '/');
},
);
around 'loc' => sub {
my $orig = shift;
my $self = shift;
return $self->$orig
unless @_;
my $p = shift;
my $newLocID = H5Gopen($self->locID, $p);
if ($newLocID >= 0) {
H5Gclose($self->locID);
$self->setLoc($newLocID);
$self->$orig(h5name($newLocID));
}
};
sub pwd {
my $self = shift;
BIE::Data::HDF5::Path->new(id => H5Gopen($self->fileID, $self->loc));
}
sub list {
my $self = shift;
h5ls($self->locID);
}
sub cd {
( run in 2.123 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )