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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.