NAME
slackget10::Package - This class is the internal representation of a package for slack-get 1.0
VERSION
Version 1.0.0
SYNOPSIS
This module is used to represent a package for slack-get
use slackget10::Package;
my $package = slackget10::Package->new('package-1.0.0-noarch-1');
$package->setValue('description',"This is a test of the slackget10::Package object");
$package->fill_object_from_package_name();
CONSTRUCTOR
The constructor take two parameters : a package name, and an id (the namespace of the package like 'slackware' or 'linuxpackages')
my $package = new slackget10::Package ('aaa_base-10.0.0-noarch-1','slackware');
The constructor automatically call the fill_object_from_package_name() method.
You also can pass some extra arguments like that :
my $package = new slackget10::Package ('aaa_base-10.0.0-noarch-1', 'package-object-version' => '1.0.0');
The constructor return undef if the id is not defined.
FUNCTIONS
setValue
Set the value of a named key to the value passed in argument.
$package->setValue($key,$value);
merge
This method merge $another_package with $package. WARNING: $another_package will be destroy in the operation (this is a collateral damage ;-), for some dark preocupation of memory.
This method overwrite existing value.
$package->merge($another_package);
getValue
Return the value of a key :
$string = $package->getValue($key);
_setId [PRIVATE]
set the package ID (normally the package complete name, like aaa_base-10.0.0-noarch-1). In normal use you don't need to use this method
$package->_setId('aaa_base-10.0.0-noarch-1');
get_id
return the package id (full name, like aaa_base-10.0.0-noarch-1).
$string = $package->get_id();
fill_object_from_package_name
Try to extract the maximum informations from the name of the package. The constructor automatically call this method.
$package->fill_object_from_package_name();
extract_informations
Extract informations about a package from a string. This string must be a line of the description of a package.
$package->extract_informations($data);
This method is designe to be called by the slackget10::SpecialFiles::PACKAGES class, and automatically call the clean_description() method.
to_XML
return the package as an XML encoded string.
$xml = $package->to_XML();
to_string
Alias for to_XML()
description
return the description of the package.
$string = $package->description();
clean_description
remove the "<package_name>: " string in front of each line of the description. Change < to < and > to >. Finally remove extra tabulation (for identation).
$package->clean_description();
print_restricted_info
Print a part of package information.
$package->print_restricted_info();
print_full_info
Print all informations found in the package.
$package->print_full_info();
fprint_restricted_info
Same as print_restricted_info, but output in HTML
$package->fprint_restricted_info();
fprint_full_info
Same as print_full_info, but output in HTML
$package->fprint_full_info();
grab_info_from_description
Try to find some informations in the description. For example, packages from linuxpackages.net contain a line starting by Packager: ..., this method will extract this information and re-set the package-maintener tag.
The supported tags are: package-maintener, info-destination-slackware, info-packager-mail, info-homepage, info-packager-tool, info-packager-tool-version
$package->grab_info_from_description();
filelist
return the list of files in the package. WARNING: by default this list is not included !
$string = $package->filelist();
name
return the name of the package. Ex: for the package aaa_base-10.0.0-noarch-1 name() will return aaa_base
my $string = $package->name();
compressed_size
return the compressed size of the package
$number = $package->compressed_size();
uncompressed_size
return the uncompressed size of the package
$number = $package->uncompressed_size();
location
return the location of the installed package.
$string = $package->location();
conflicts
return the list of conflicting pakage.
$string = $apckage->conflict();
suggests
return the suggested package related to the current package.
$string = $package->suggest();
required
return the required packages for installing the current package
$string = $package->required();
architecture
return the architecture the package is compiled for.
$string = $package->architecture();
version
return the package version.
$string = $package->version();
AUTHOR
DUPUIS Arnaud, <a.dupuis@infinityperl.org>
BUGS
Please report any bugs or feature requests to bug-slackget10-Package@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=slackget10. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2005 DUPUIS Arnaud, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.