ActivePerl::PPM::Package(3)

NAME
ActivePerl::PPM::Package - Package class

SYNOPSIS
  my $pkg = ActivePerl::PPM::Package->new(name => 'Foo',...);
  # or
  my $pkg = ActivePerl::PPM::Package->new(\%hash);

DESCRIPTION
The "ActivePerl::PPM::Package" class wraps hashes that describes packages; the unit that the PPM system manages.

  Constructors
The following constructor methods are provided:

$pkg = ActivePerl::PPM::Package->new( %opt );
$pkg = ActivePerl::PPM::Package->new( \%self );
    The constructor either take key/value pairs or a hash reference as argument. The only mandatory field is "name". If a hash reference is passed then it is turned into an "ActivePerl::PPM::Package" object and returned; which basically pass ownership of the hash.

$copy = $pkg->clone
    Returns a copy of the current package object. The attributes of the clone can be modified without changing the original.

ActivePerl::PPM::Package->new_dbi($dbh, $id);
ActivePerl::PPM::Package->new_dbi($dbh, $name, $version);
    Read object from a database and return it. Returns "undef" if no package with the given key is found.

$pkg->dbi_store( $dbh )
    Writes the current package to a database. If $pkg was constructed by "new_dbi" then this updates the package, otherwise this creates a new package object in the database.

    Returns the $id of the object stored if successful, otherwise "undef".

  Attributes
The attributes of a package can be accessed directly using hash syntax or by accesor methods. The most common attributes are described below, but the set of attributes is extensible.

$str = $pkg->id
    Returns the database id of package. This attribute is set if the object exists in a database.

$str = $pkg->name
    Returns the name of the package.

$str = $pkg->version
    Returns the version identifier for the package. This string can be anything and there is no reliable way to order packages based on these version strings.

$str = $pkg->name_version
    Returns the name and version concatenated together. This form might be handy for display, but there is no reliable way to parse back what is the name and what is the version identifier.

$str = $pkg->release_date
    Returns the date the package was released on as an ISO 8601 date (YYYY-MM-DDThh:mm:ss). For CPAN packages this is the date the package was uploaded to CPAN.

$str = $pkg->author
    The name and email address of the current maintainer of the package.

$str = $pkg->abstract
    A short sentence describing the purpose of the package.

$url = $pkg->ppd_uri
    This is the URI for the PPD file itself.

$str = $pkg->ppd_etag
    This is the "ETag" that the server reported for the PPD last time.

$str = $pkg->ppd_lastmod
    This is the "Last-Modified" field that the server reported for the PPD last time.

$url = $pkg->codebase
    Returns the URL to implementation; a blib tarball. Interpret this URL relative to ppd_uri.

$url = $pkg->codebase_abs
    Returns the absolute URL to the 'codebase'

%features = $pkg->provides
    Returns a list of (feature, version) pairs describing what features this package provide. A feature name with a double colon in it represent a perl module. A package always provide its own name as a feature.

%features = $pkg->requires
    Returns a list of (feature, version) pairs describing what features this package require to be installed for it to work properly. A feature name with a double colon in it represent a perl module.

  Comparators
The following functions/methods can be used to order packages.

$pkg->compare( $other )
    Returns -1, 0, 1 like perl's builtin "cmp". Return "undef" if no order is defined.

$pkg->better_than( $other )
    Returns TRUE if this package is better than the package passed as argument. This method will croak if no order is defined.

$pkg->best( @others )
ActivePerl::PPM::Package::best( @pkgs )
    Returns the best package. Might croak if no order is defined among the packages passed in.

  Misc methods

ActivePerl::PPM::Package->sql_create_tables
    This returns SQL "CREATE TABLE" statements used to initialize the database that the "new_dbi" and "dbi_store" methods depend on.

$bool = $pkg->features_declared
    Returns TRUE if this package declare what features it provide. PPM4 style packages should declare what modules and other features they provide, but packages from older repositories might not.

$pkg->has_script( $kind )
    Return TRUE if the package has the given $kind of script attached. The $kind argument should be either "install" or "uninstall".

$pkg->run_script( $kind, $area, $tmpdir, \%pkg_info )
    Execute the given kind of script for the package. The $kind argument should be either "install" or "uninstall". The $kind and $area argument must be provided.

BUGS
none.