| Youri-Package documentation | Contained in the Youri-Package distribution. |
Youri::Package::File - Package file class
This class represent a package file,
Creates and returns a new Youri::Package::File object.
Returns the name of this file.
Return the mode of this file.
Return the md5sum of this file.
Returns a true value if this file is a directory.
| Youri-Package documentation | Contained in the Youri-Package distribution. |
# $Id: File.pm 1462 2007-02-12 20:56:03Z guillomovitch $ package Youri::Package::File;
use strict; use warnings; use Carp; use constant NAME => 0; use constant MODE => 1; use constant MD5SUM => 2; use constant MODE_MASK => oct(170000); use constant MODE_DIR => oct(40000);
sub new { my ($class, $name, $mode, $md5sum) = @_; return bless [ $name, $mode, $md5sum, ], $class; }
sub get_name { my ($self) = @_; croak "Not a class method" unless ref $self; return $self->[NAME]; }
sub get_mode { my ($self) = @_; croak "Not a class method" unless ref $self; return $self->[MODE]; }
sub get_md5sum { my ($self) = @_; croak "Not a class method" unless ref $self; return $self->[MD5SUM]; }
sub is_directory { my ($self) = @_; croak "Not a class method" unless ref $self; return ($self->[MODE] & MODE_MASK) == MODE_DIR; } 1;