Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    POE::Component::Generic 0.1401

    Download button

    No screenshots available
    Downloads: 378  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.7/5)
    4 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David Davis and Teknikill Software | More programs
    Perl Artistic License / FREE
    February 5th, 2012, 23:32 GMT [view history]
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    POE::Component::Generic description

    A POE component that provides non-blocking access to a blocking object.

    POE::Component::Generic is a POE component that provides non-blocking access to a blocking object.

    SYNOPSIS

    use POE::Component::Generic;

    my $telnet = POE::Component::Generic->spawn(

    # required; main object is of this class
    package => 'Net::Telnet',

    # optional; Options passed to Net::Telnet->new()
    object_options => [ ],

    # optional; You can use $poco->session_id() instead
    alias => 'telnet',
    # optional; 1 to turn on debugging
    debug => 1,
    # optional; 1 to see the child's STDERR
    verbose => 1,

    # optional; Options passed to the internal session
    options => { trace => 1 },

    # optional; describe package signatures
    packages => {
    'Net::Telnet' => {
    # Methods that require coderefs, and keep them after they
    # return.

    # The first arg is converted to a coderef
    postbacks => { option_callback=>0 }
    },
    'Other::Package' => {
    # only these methods are exposed
    methods => [ qw( one two ) ],

    # Methods that require coderefs, but don't keep them
    # after they return
    callbacks => [ qw( two ) ]
    }
    }
    );

    # Start your POE session, then...

    $telnet->open( { event => 'result' }, "rainmaker.wunderground.com");
    # result state
    sub result {
    my ($kernel, $ref, $result) = @_[KERNEL, ARG0, ARG1];

    if( $ref->{error} ) {
    die join(' ', @{ $ref->{error} ) . "n";
    }
    print "connected: $resultn";
    }


    # Setup a postback
    $telnet->option_callback( {}, "option_back" );

    # option_back state
    sub option_back {
    my( $obj, $option, $is_remote,
    $is_enabled, $was_enabled, $buf_position) = @_[ARG0..$#_];
    # See L for a discussion of the above.

    # NOTE: Callbacks and postbacks can't currently receive objects.
    }

    # Use a callback
    # Pretend that $other was created as a proxy to an Other::Package object
    $other->two( {}, sub { warn "I was called..." } );

    my $code = $session->postback( "my_state" );
    $other->two( {}, $code );

    POE::Component::Generic is a POE component that provides a non-blocking wrapper around any object. It works by forking a child process with POE::Wheel::Run and creating the object in the child process. Method calls are then serialised and sent via STDIN to the child to be handled. Return values are posted back to your session via STDOUT. This means that all method arguments and return values must survive serialisation. If you need to pass coderefs, use "callbacks", "postbacks" or "factories".
    Method calls are wrapped in eval in the child process so that errors may be propagated back to your session. See "OUTPUT".

    Output to STDERR in the child, that is from your object, is shown only if debug or verbose is set.

    STDOUT in the child, that is from your object, is redirected to STDERR and will be shown in the same circomstances.

    Product's homepage

    Requirements:

    · Perl

    What's New in This Release: [ read full changelog ]

    · Tweak 02_pod_coverage.t
    · Require 5.6
    · no strict 'subs'; in Net::SSH2 code

      


    TAGS:

    POE component | Perl module | Perl library | POE | Perl | module

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM