Slackware::Slackget::MediaList - A container of Slackware::Slackget::Media object


Slackware-Slackget documentation Contained in the Slackware-Slackget distribution.

Index


Code Index:

NAME

Top

Slackware::Slackget::MediaList - A container of Slackware::Slackget::Media object

VERSION

Top

Version 1.0.0

SYNOPSIS

Top

This class is used by slack-get to represent a list of medias store in the medias.xml file.

    use Slackware::Slackget::MediaList;

    my $list = Slackware::Slackget::MediaList->new();
    ...

CONSTRUCTOR

Top

new

Please read the Slackware::Slackget::List documentation for more informations on the list constructor.

FUNCTIONS

Top

This class inheritate from Slackware::Slackget::List, so have a look to this class for a complete list of methods.

index_list

Create an index on the MediaList. This index don't take many memory but speed a lot search, especially when you already have the media shortname !

The index is build with the media shortname.

	$list->index_list() ;

get_indexed

Return a media, as well as Get() do but use the index to return it quickly. You must provide a media shortname to this method.

	my $media = $list->get_indexed('slackware') ;

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::MediaList




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.

COPYRIGHT & LICENSE

Top


Slackware-Slackget documentation Contained in the Slackware-Slackget distribution.
package Slackware::Slackget::MediaList;

use warnings;
use strict;

require Slackware::Slackget::List;

our $VERSION = '0.9.11';
our @ISA = qw( Slackware::Slackget::List );

sub new
{
	my ($class,%args) = @_ ;
	my $self={list_type => 'Slackware::Slackget::Media','root-tag' => 'media-list'};
	foreach (keys(%args))
	{
		$self->{$_} = $args{$_};
	}
	bless($self,$class);
	return $self;
}

sub index_list
{
	my $self = shift ;
	$self->{INDEX} = {} ;
	foreach my $media (@{$self->{LIST}})
	{
		$self->{INDEX}->{$media->shortname()} = $media ;
	}
	return 1;
}

sub get_indexed
{
	my ($self, $id) = @_ ;
	return $self->{INDEX}->{$id} ;
}

1; # End of Slackware::Slackget::MediaList