Slackware::Slackget::List - A generic list abstraction.


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.

Index


NAME

Top

Slackware::Slackget::List - A generic list abstraction.

VERSION

Top

Version 1.0.1

SYNOPSIS

Top

This class is a generic list abstraction. Most of the time it rely on Perl implementation of list operation, but it also implements some sanity checks.

This class is mainly designed to be inherited from.

    use Slackware::Slackget::List;

    my $list = Slackware::Slackget::List->new();
    $list->add($element);
    $list->get($index);
    my $element = $list->Shift();




CONSTRUCTOR

Top

new

This class constructor take the followings arguments :

* list_type. You must provide a string which will specialize your list. Ex:

	For a Slackware::Slackget::Package list :
		my $packagelist = new Slackware::Slackget::List (list_type => 'Slackware::Slackget::Package') ;

* root-tag : the root tag of the XML generated by the to_XML method.

	For a Slackware::Slackget::Package list :
		my $packagelist = new Slackware::Slackget::List ('root-tag' => 'packagelist') ;




* no-root-tag : to disabling the root tag in the generated XML output.

	For a Slackware::Slackget::Package list :
		my $packagelist = new Slackware::Slackget::List ('no-root-tag' => 1) ;

A traditionnal constructor is :

	my $speciallist = new Slackware::Slackget::List (
		'list_type' => 'Slackware::Slackget::Special',
		'root-tag' => 'special-list'
	);

But look at special class Slackware::Slackget::*List before creating your own list : maybe I have already do the work :)

FUNCTIONS

Top

add

Add the element passed in argument to the list. The argument must be an object of the list_type type.

	$list->add($element);

get

return the $index -nth object in the list

	$element = $list->get($index);

get_all

return a reference on an array containing all packages.

	$arrayref = $list->get_all();

Shift

Same as the Perl shift. Shifts of and return the first object of the Slackware::Slackget::List;

	$element = $list->Shift();

If a numerical index is passed shift and return the given index.

to_XML (deprecated)

Same as to_xml(), provided for backward compatibility.

to_xml

return an XML encoded string.

	$xml = $list->to_xml();

to_HTML (deprecated)

Same as to_html(), provided for backward compatibility.

to_html

return an HTML encoded string.

	$xml = $list->to_html();

to_string

If this class is subclassed and if the subclass have a __to_string() method this is one is called.

If not, this method is an alias for to_xml().

Length

Return the length (the number of element) of the current list. If you are interest by the size in memory you have to multiply by yourself the number returned by this method by the size of a single object.

	$list->Length ;

empty

Empty the list

	$list->empty ;

AUTHOR

Top

DUPUIS Arnaud, <a.dupuis@infinityperl.org>

BUGS

Top

Please report any bugs or feature requests to bug-Slackware-Slackget@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Slackware::Slackget::List




You can also look for information at:

* Infinity Perl website

http://www.infinityperl.org/category/slack-get

* slack-get specific website

http://slackget.infinityperl.org

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Slackware-Slackget

* CPAN Ratings

http://cpanratings.perl.org/d/Slackware-Slackget

* Search CPAN

http://search.cpan.org/dist/Slackware-Slackget

ACKNOWLEDGEMENTS

Top

Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.

SEE ALSO

Top

COPYRIGHT & LICENSE

Top


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.