MacOSX-File
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
Info/Info.pm view on Meta::CPAN
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use MacOSX::File::Info ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
=head2 EXPORT
Subs: getfinfo(), setfinfo()
=cut
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
getfinfo
setfinfo
);
bootstrap MacOSX::File::Info $VERSION;
use MacOSX::File;
# Preloaded methods go here.
sub DESTROY{
$DEBUG or return;
carp "Destroying ", __PACKAGE__;
return;
}
=head1 METHODS
=over 4
=item $finfo = MacOSX::File::Info->get($path);
=item $finfo = getfileinfo($path);
Constructs MacOSX::File::Info from which you can manipulate file
attributes. On failure, it returns undef and $MacOSX::File::OSErr
is set.
=cut
sub getfinfo{
my ($path) = @_;
my $self = xs_getfinfo($path);
defined $self or return;
bless $self;
}
sub get{
my ($class, $path) = @_;
my $self = xs_getfinfo($path);
defined $self or return;
bless $self => $class;
}
=item $finfo->set([$path]);
=item setfinfo($finfo, [$path]);
Sets file attributes of file $path. If $path is omitted the file you
used to construct $finfo is used. On success, it returns 1. On
failure, it returns 0 and $MacOSX::File::OSErr is set.
Remember any changes to $finfo will not be commited until you call
these functions.
ex)
setfinfo(getfinfo("foo"), "bar");
#Copies file attributes from foo to bar
=cut
sub setfinfo{
my ($info, $path) = @_;
ref $info eq __PACKAGE__ or return;
$path ||= ""; # to keep warnings quiet;
return !xs_setfinfo(@$info, $path);
}
sub set{
my ($self, $path) = @_;
ref $self eq __PACKAGE__ or return;
$path ||= ""; # to keep warnings quiet;
return !xs_setfinfo(@$self, $path);
}
=item $clone = $finfo->clone;
Returns a cloned (deep-copied) object. Handy when you want to compare changes.
=cut
sub clone{
my $self = shift;
my (@new) = @$self;
bless \@new, (ref $self);
}
=item $finfo->ref(), $finfo->nodeFlags(),
returns FSRef and nodeFlags of the file. these attributes are read
only. Use of these methods are unlikely except for debugging purpose.
=cut
# Construct accessor methods all at once
my %_ro = (
ref => 0,
nodeFlags => 1,
);
while(my($field, $index) = each %_ro){
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.601 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )