Dear Monks, I have a perfectly working perl/Tk script that we use for network management. It runs on Centos 5.6 and perl version is 5.8.8 I installed a new PC running Centos 5.7 and perl 5.8.8. I made sure all perl modules the script needs are installed. But I keep on getting the following error on the new machine:
Unable to create sub named "" at /usr/lib/perl5/site_perl/5.8.8/i386-l +inux-thread-multi/AnyEvent.pm line 1488.
The lines in the script relevant to this are:
my $inotify = new Linux::Inotify2 or die "unable to create new inotify + object: $!"; # add watchers --watch the snmptrapd.log file $watchObject = $inotify->watch ("/var/log/snmptrapd.log", IN_MODIFY, \ +&processTrap); $inotify_w = AnyEvent->io ( fh => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll ; }, ); MainLoop;
The sub processTrap is defined.If I comment the
$inotify_w= AnyEvent->io (...
line, the code does not give an error and quit. But obviously I need that line. Any wisdom is appreciated...

In reply to Inotify2 + AnyEvent by dlal66

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.