shirirules > WebService-GData-0.0501 > WebService::GData::Collection

Download:
WebService-GData-0.0501.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.0104   Source   Latest Release: WebService-GData-0.06

NAME ^

WebService::GData::Collection - Composite class redispatching method calls to query the items data.

SYNOPSIS ^

    use WebService::GData::Collection;

    #array ref of link nodes
    my $links = new WebService::GData::Collection($links);

    #search through the nodes for a certain value
    my $reponse_url = $links->rel('video.responses')->[0];
   
    #access the object as if it was an array reference
    $links->[0];
    
    #loop through it as if it was a normal array reference
    foreach my $link (@$links) {
        #$link->rel...
    }

DESCRIPTION ^

inherits from WebService::GData::BaseCollection

This package accepts an array reference containing identic nodes (link nodes, category nodes,video nodes...). Once feed with some data, you can call a node method by specifying a search string. The instance will simply redispatch the call to all its children and return any children that match(=~m/$search/) your query.

CONSTRUCTOR

new

Create a Collection instance.

Parameters

collection:ArrayRef - (optional) an array reference of nodes or identic instances.

Returns

WebService::GData::Collection instance

Example

    use WebService::GData::Collection;
    
    my $collection = new WebService::GData::Collection();
    
    $collection->[0] = new WebService::GData::Node::AuthorEntity();
    
    or
    my $collection = new WebService::GData::Collection(\@authors);     

OVERLOAD

In order to fake array reference behavior, the array reference context is overloaded to return the actual array stored in the instance.

Example

    use WebService::GData::Collection;

    my $authors = new WebService::GData::Collection(\@authors);     
    
    foreach my $author (@$authors) {
        $author->name;
    }
    
    push @$author,new WebService::GData::Node::AuthorEntity();

BUGS AND LIMITATIONS ^

If you do me the favor to _use_ this module and find a bug, please email me i will try to do my best to fix it (patches welcome)!

AUTHOR ^

shiriru <shirirulestheworld[arobas]gmail.com>

LICENSE AND COPYRIGHT ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: