Filesys-POSIX

 view release on metacpan or  search on metacpan

lib/Filesys/POSIX/Inode.pm  view on Meta::CPAN

    shift->{'mode'} & $S_IPERM;
}

=item C<$inode-E<gt>readable>

Returns true if the inode is readable by anyone.

=cut

sub readable {
    ( shift->{'mode'} & $S_IR ) != 0;
}

=item C<$inode-E<gt>writable>

Returns true if the inode is writable by anyone.

=cut

sub writable {
    ( shift->{'mode'} & $S_IW ) != 0;
}

=item C<$inode-E<gt>executable>

Returns true if the inode is executable by anyone.

=cut

sub executable {
    ( shift->{'mode'} & $S_IX ) != 0;
}

=item C<$inode-E<gt>setuid>

Returns true if the inode has a setuid bit set.

=cut

sub setuid {
    ( shift->{'mode'} & $S_ISUID ) != 0;
}

=item C<$inode-E<gt>setgid>

Returns true if the inode has a setgid bit set.

=cut

sub setgid {
    ( shift->{'mode'} & $S_ISGID ) != 0;
}

=item C<$inode-E<gt>update(@st)>

Updates the current inode object with a list of values as returned by
L<stat()|perlfunc/stat>.

=cut

sub update {
    my ( $self, @st ) = @_;

    @{$self}{qw(size atime mtime ctime uid gid mode rdev)} =
      ( @st[ 7 .. 10 ], @st[ 4 .. 5 ], $st[2], $st[6] );

    return $self;
}

=item C<$inode-E<gt>directory>

If the current inode is a directory, return the directory object held by it.
Otherwise, an ENOTDIR is thrown.

=cut

sub directory {
    my ($self) = @_;

    throw &Errno::ENOTDIR unless $self->dir;

    return $self->{'directory'};
}

=item C<$inode-E<gt>empty>

Uses the above C<$inode-E<gt>directory()> call to obtain the directory for the
current inode, and returns the result of C<$directory-E<gt>empty()>.

=cut

sub empty {
    my ($self) = @_;

    return $self->directory->empty;
}

=back

=cut

1;

__END__

=head1 AUTHOR

Written by Xan Tronix <xan@cpan.org>

=head1 CONTRIBUTORS

=over

=item Rikus Goodell <rikus.goodell@cpanel.net>

=item Brian Carlson <brian.carlson@cpanel.net>

=back

=head1 COPYRIGHT



( run in 0.495 second using v1.01-cache-2.11-cpan-2398b32b56e )