monger has asked for the wisdom of the Perl Monks concerning the following question:
This is all on Windows. Sorry I didn't post that the first time.
I beseech you all for aid in my noble quest. I am writing a small script to pull out syslog records containing the flag "WARNING". The box that this will run on is a Perl-less machine, so I'm using pp to generate an .exe file. It worked well with my initial script. Now, I have changed it, and brought in the Posix module. Here's the script:
This script runs fine from either Cygwin or Windows with Perl. When I compile it, I get no errors. But when I attempt to run it, I get the following error:use strict; use warnings; use Posix qw(strftime); no strict 'refs'; no strict 'subs'; my $regex = 'WARNING'; my $dir = "L:\\vpn\\"; my $out = "L:\\vpn\\difflogs\\vpnwarn.out"; my $time = POSIX::strftime "%Y%m%d",localtime; my $newtime = ($time -1); my $log = $newtime.".log"; open OUT, ">$out", || die "Can't open outfile: $!"; open LOG, "$dir$log", || die "Can't open logfile: $!"; while (<LOG>) { if (m/$regex/g) { print OUT $_ . "\n"; } } close LOG; close OUT || die "Can't close VPN outfile: $!";
Can't locate loadable object for module POSIX in @INC (@INC contains: CODE(0x1281fd0) CODE(0x12fd6fc) .) at ../blib/lib/PAR/Heavy.pm line 101 Compilation failed in require at script/vpnwarn.pl line 9. BEGIN failed--compilation aborted at script/vpnwarn.pl line 9.What the Posix module is affording me is to use strftime to obtain the date and shift it into a format that matches the names of the logfiles that I am parsing automatically. For example, the script runs shortly after midnight to parse yesterday's file. It gets todays date, in the proper numeric string, YYYYMMDD, and subtracts 1.
If anyone has any wisdom, links, etc that would help diagnose this ailment, I would greatly appreciate. I looked briefly at using the the "Poor Man's strftime()" by liz http://perlmonks.org/index.pl?node_id=290054 However, I don't think it'll meet the needs of this job. I would like to get the Posix module up in the compiled version quickly!
Thanks, Monger
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with PP and Posix
by flyingmoose (Priest) on Dec 19, 2003 at 17:09 UTC | |
by monger (Friar) on Dec 19, 2003 at 18:18 UTC | |
by monger (Friar) on Dec 19, 2003 at 18:08 UTC |