in reply to Parental Variables

Thank you for your fast replies.

Unfortunately I can't use modules (because the person who this is for is a paranoid .... who is scared of the evilness that might be lurking in a module some "hacker" made -- not joking).

Because of this, I can't use the Time::HiRes module. I'm trying to display the load times of my scripts (in less than seconds). My sub for this is:
sub getTimeOfDay { syscall(116,$tod,0); my($s,$ms) = unpack("LL",$tod); return $s + $ms / 1000000; } $tod = "\0\0\0\0\0\0\0\0";
...and basically I just get the start time and end time and compare them.

I want to add it to my subs file so I don't have to add that code to every script. The problem is that it won't work (script crashes/error 500/whatever you want to call it) unless $tod is defined in the script itself. The error log contains no information too.

I tried "do" and it didn't work. I also tried defining $tod in BEGIN and that did work, but the script would crash about 4 out of every 5 times (which I find just weird).

I've been going crazy reading pages and pages of Perl help on the internet, and I've gotten nowhere, finally decided to ask and that's what I'm doing.

Replies are listed 'Best First'.
Re: Re: Parental Variables
by CountZero (Bishop) on Feb 25, 2004 at 21:16 UTC
    If you can save a file on the computer your script runs on, you can save a module. A module is no big deal; it is just a file which name normally ends in .pm and which must return the value of '1'.

    It is no different from your .lib file.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law