I'm trying to get the hang of POE and followed this tutorial on perl.com: Building Applications with POE.

Problem is when I try the code used in the tutorial (copy & past, the download doesn't work) it only works partially.

The TCP-server starts up, accepts connections but after entering a test string ('foo=bar&quux=perl') and hitting enter it stops with this failure message:
Can't call method "put" on an undefined value at ./tcp_server.pl line 110.

Problem is the method put is called with a defined value, Data Dumper gives this:

$VAR1 = { 'quux' => 'perl', 'foo' => 'bar' }; $VAR1 = 2;
Code snippet (line 110 is the $_HEAP part)

sub client_input { my ($input, $wheel_id) = @_[ARG0, ARG1]; use Data::Dumper; print Dumper $input; print Dumper $wheel_id; $_[HEAP]->{clients}->{ $wheel_id }->put( $input ); }
Complete code can be found here: Orchid's scratchpad
Help much appreciated (if you need more information let me know!).

In reply to POE method problem (building applications with POE) by Orchid_NL

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.