POE::Component::CPAN::LinksToDocs::No404s::Remember - non-blocking wrapper around CPAN::LinksToDocs::No404s::Remember module


POE-Component-CPAN-LinksToDocs-No404s-Remember documentation  | view source Contained in the POE-Component-CPAN-LinksToDocs-No404s-Remember distribution.

Index


NAME

Top

POE::Component::CPAN::LinksToDocs::No404s::Remember - non-blocking wrapper around CPAN::LinksToDocs::No404s::Remember module

SYNOPSIS

Top

    use strict;
    use warnings;

    use POE qw(Component::CPAN::LinksToDocs::No404s::Remember);

    my $poco = POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn;

    POE::Session->create(
        package_states => [ main => [qw(_start response )] ],
    );

    $poe_kernel->run;

    sub _start {
        $poco->link_for( {
                tags => 'map,RE,Acme::BabyEater,POE',
                event => 'response',
            }
        );
    }

    sub response {
        print "$_\n" for @{ $_[ARG0]->{response} };

        $poco->shutdown;
    }

Using event based interface is also possible of course.

DESCRIPTION

The module is a non-blocking wrapper around CPAN::LinksToDocs::No404s::Remember module which provides interface to lookup documentation by eating either predefined tags or module names

CONSTRUCTOR

Top

spawn

    my $poco = POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn;

    POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn(
        alias => 'linker',
        obj_args => {
            tags => { foos => 'bars' },
            db_file => 'some_file.db',
        },
        options => {
            debug => 1,
            trace => 1,
            # POE::Session arguments for the component
        },
        debug => 1, # output some debug info
    );

The spawn method returns a POE::Component::CPAN::LinksToDocs::No404s::Remember object. It takes a few arguments, all of which are optional. The possible arguments are as follows:

alias

    POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn(
        alias => 'linker'
    );

Optional. Specifies a POE Kernel alias for the component.

obj_args

    POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn(
        obj_args => {
            tags => { foos => 'bars', },
            db_file => 'some_file.db',
        },
    );

The obj_args argument takes a hashref as a value which will be dereferenced directly into CPAN::LinksToDocs::No404s::Remember constructor. See documentation for the constructor of CPAN::LinksToDocs::No404s::Remember module for possible arguments this hashref can contain.

options

    my $poco = POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn(
        options => {
            trace => 1,
            default => 1,
        },
    );

Optional. A hashref of POE Session options to pass to the component's session.

debug

    my $poco = POE::Component::CPAN::LinksToDocs::No404s::Remember->spawn(
        debug => 1
    );

When set to a true value turns on output of debug messages. Defaults to: 0.

METHODS

Top

session_id

    my $poco_id = $poco->session_id;

Takes no arguments. Returns component's session ID.

shutdown

    $poco->shutdown;

Takes no arguments. Shuts down the component.

ACCEPTED EVENTS

Top

event

    { event => 'results_event', }

Mandatory. Specifies the name of the event to emit when results are ready. See OUTPUT section for more information.

tags

    { tags => 'map,RE,Acme::BabyEater,POE' }

Mandatory. Takes a scalar string containing comma separated predefined tags or module names. For list of predefined tags see CPAN::LinksToDocs.

session

    { session => 'other' }

    { session => $other_session_reference }

    { session => $other_session_ID }

Optional. Takes either an alias, reference or an ID of an alternative session to send output to.

user defined

    {
        _user    => 'random',
        _another => 'more',
    }

Optional. Any keys starting with _ (underscore) will not affect the component and will be passed back in the result intact.

shutdown

    $poe_kernel->post( linker => 'shutdown' );

Takes no arguments. Tells the component to shut itself down.

OUTPUT

Top

    $VAR1 = {
        'response' => [
            'http://perldoc.perl.org/functions/map.html',
            'http://perldoc.perl.org/functions/grep.html',
            'http://search.cpan.org/perldoc?Acme::BabyEater',
            'Not found'
        ],
        'tags' => 'map,grep,Acme::BabyEater,Zoffer',
        '_user' => 'foos',
    };

The event handler set up to handle the event which you've specified in the event argument to link_for() method/event will recieve input in the $_[ARG0] in a form of a hashref. The possible keys/value of that hashref are as follows:

response

    {
        'response' => [
            'http://perldoc.perl.org/functions/map.html',
            'http://perldoc.perl.org/functions/grep.html',
            'http://search.cpan.org/perldoc?Acme::BabyEater',
            'Not found'
        ],
    }

The response key will contain a (possibly empty) arrayref of links to documentation. This is the same arrayref that you would get from CPAN::LinksToDocs::No404s::Remember's link_for() method. See documentation for CPAN::LinksToDocs::No404s::Remember module for more information.

tags

    { 'tags' => 'map,grep,Acme::BabyEater,Zoffer', }

The tags key will contain whatever you've passed in tags argument to link_for() method/event.

user defined

    { '_blah' => 'foos' }

Any arguments beginning with _ (underscore) passed into the link_for() event/method will be present intact in the result.

SEE ALSO

Top

POE, CPAN::LinksToDocs::No404s::Remember

AUTHOR

Top

Zoffix Znet, <zoffix at cpan.org> (http://zoffix.com, http://haslayout.net

BUGS

Top

Please report any bugs or feature requests to bug-poe-component-cpan-linkstodocs-no404s-remember at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-CPAN-LinksToDocs-No404s-Remember. 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 POE::Component::CPAN::LinksToDocs::No404s::Remember

You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-CPAN-LinksToDocs-No404s-Remember

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/POE-Component-CPAN-LinksToDocs-No404s-Remember

* CPAN Ratings

http://cpanratings.perl.org/d/POE-Component-CPAN-LinksToDocs-No404s-Remember

* Search CPAN

http://search.cpan.org/dist/POE-Component-CPAN-LinksToDocs-No404s-Remember

COPYRIGHT & LICENSE

Top


POE-Component-CPAN-LinksToDocs-No404s-Remember documentation  | view source Contained in the POE-Component-CPAN-LinksToDocs-No404s-Remember distribution.