Re: Event Module

[email protected] (Joshua Pritikin)
Newsgroups perl.loop
Message-ID <[email protected]>
>I'm trying the Event module ... starting out with an early example
>cut&paste (I changed trhe #! line) from the pdf doc.  It is not finding
>Event/all_watchers.pm
>
>Attached is:
>  console log from installing the module
>  a listing of the test pgm
>  output from running it
>
>Any idea what I'm doing wrong?

Sounds like a typo.  Thanks for the bug report.

Can you skip this one and try the next example?

>#
># perl Makefile.PL
>Writing Makefile for Event
># make
>gcc -c -Ic -Ilib/Event -I/usr/local/include -O     -DVERSION=\"0.81\"
>-DXS_VERSION=\"0.81\" -fPIC
>-I/usr/local/lib/perl5/5.00503/sun4-solaris/CORE  Event.c
>Running Mkbootstrap for Event ()
>chmod 644 Event.bs
>LD_RUN_PATH="" gcc -o blib/arch/auto/Event/Event.so  -G -L/usr/local/lib
>Event.o
>chmod 755 blib/arch/auto/Event/Event.so
>cp Event.bs blib/arch/auto/Event/Event.bs
>chmod 644 blib/arch/auto/Event/Event.bs
>Manifying blib/man3/Event::MakeMaker.3
>Manifying blib/man3/Event.3
># make test
>PERL_DL_NONLAZY=1 /local/bin/perl -Iblib/arch -Iblib/lib
>-I/usr/local/lib/perl5/5.00503/sun4-solaris
>-I/usr/local/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests
>$verbose); $verbose=0; runtests @ARGV;' t/*.t
>t/attach_to.........ok
>t/bored.............ok
>t/callback..........ok
>t/data..............ok
>t/delete............ok
>t/eval..............ok
>t/fifo..............ok
>t/group.............ok
>t/hook..............ok
>t/hup...............ok
>t/idle..............ok
>t/idle2.............skipping test on this platform
>t/io................ok
>t/leak..............ok
>t/leak2.............ok
>t/loop..............ok
>t/now...............ok
>t/reenter...........ok
>t/signal............ok
>t/timeout_cb........ok
>t/timer.............ok
>t/unconfigured......ok
>t/var...............ok
>All tests successful, 1 test skipped.
>Files=23,  Tests=110, 62 wallclock secs (11.63 cusr +  2.29 csys = 13.92
>CPU)
># make install
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Event/Event.so
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Event/Event.bs
>Files found in blib/arch --> Installing files in blib/lib into
>architecture dependend library tree!
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/signal.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/Watcher.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/idle.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/MakeMaker.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/timer.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/type.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/typemap
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/EventAPI.h
>Installing /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/io.pm
>
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/var.pm
>Installing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event/group.pm
>Installing /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event.pm
>Installing /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event.pod
>Installing /usr/local/lib/perl5/5.00503/man/man3/Event::MakeMaker.3
>Installing /usr/local/lib/perl5/5.00503/man/man3/Event.3
>Writing
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Event/.packlist
>Appending installation info to
>/usr/local/lib/perl5/5.00503/sun4-solaris/perllocal.pod
>
>
>
>jcolten@eclipse /export/home/jcolten/Event-0.81: cat try2
>#!/local/bin/perl
>
># set pragma
>use strict;
>
># load module
>use Event qw(loop unloop);
>
># install initial watcher
>Event->io(fd=>\*STDIN, poll=>'r', cb=>\&io);
># start loop
>loop;
># FUNCTIONS ###########################################################
># io handler
>sub io
>{
># read line
>my $cmd=<STDIN>;
>chomp $cmd;
># stop processing, if necessary
>unloop, return if uc($cmd) eq 'QUIT';
># get alarm data
>warn("[Error] Wrong format in \"$cmd\".\n"), return unless
>$cmd=~/^(\d+)\s+(.+)/;
>my ($period, $msg)=($1, $2);
># install a new one shot alarm timer
>Event->timer(
>prio => 2, # before IO;
>at => time+$period, # set alarm;
>cb => sub # callback;
>{
>warn "[Alarm] $msg\n"; # inform
>$_[0]->w->cancel; # clean up
>},
>repeat => 0, # one shot;
>);
># display a message
>warn '[Info] Your timer "', $msg, '" is running.', "\n";
>}
>
>
>
>
>
>jcolten@eclipse /export/home/jcolten/Event-0.81: ./try2
>Can't locate loadable object for module Event in @INC (@INC contains:
>/usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
>/usr/local/lib/perl5/site_perl/5.005 .) at
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event.pm line 23
>BEGIN failed--compilation aborted at ./try2 line 7.
>Can't locate Event/all_watchers.pm in @INC (@INC contains:
>/usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
>/usr/local/lib/perl5/site_perl/5.005 .) at
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event.pm line 50.
>        ...propagated at
>/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Event.pm line 51.
>END failed--cleanup aborted at ./try2 line 7.
>jcolten@eclipse /export/home/jcolten/Event-0.81:
>jcolten@eclipse /export/home/jcolten/Event-0.81:

_____________________________________________________________
Thank you for choosing LinuxQuestions.
http://www.linuxquestions.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.