Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!VAX1.CC.UAKRON.EDU!math-cs.kent.edu!news From: gorpong@kentvax.kent.edu (Gordon C. Galligher) Newsgroups: comp.lang.perl Subject: Re: Perl 3.0 PL28 package and subroutine PROBLEMS (ie: I NEED HELP) Keywords: Package, Subroutine Message-ID: <1990Sep4.221950.17628@math-cs.kent.edu> Date: 4 Sep 90 22:19:50 GMT References: <1990Sep4.190721.8505@math-cs.kent.edu> Organization: Kent State University Lines: 30 Assuming, of course, that I get the first problem solved, what I want to know is how to get some code in the package top to be executed whenever the file is 'require'd or 'do'd (not dude). I have this: # # Does a real alarm() function exist? # eval "alarm(10); alarm(0);"; # Set, then unset (to test) if ( length($@) == 0 ) { $ALARMEXISTS = 1; # Yeah, use alarm() in perl } else # No, so make sure we can { # emulate it in here. ($version, $patchlevel) = $] =~ /(\d+\.\d+).*\nPatch level: (\d+)/; die "Cannot use alarm() in pre-Perl 3.0 PL9 release\n" if $version < 3.0 || ($version >= 3.0 && $patchlevel < 9.0); } This is just in the beginning, and the only thing before it is: package ALARM; and some comments. Is there something else I need to do to get this executed? I also set up some global variables there because I assumed they would be executed when the 'do' happened (or the 'require'). Have I made a bad assumption, or is something else wrong? Perl did pass all of the tests. As I have said many times today, any help you can give me would be greatly appreciated. -- Gordon.