Greetings fellow monks, accolates, bishops, etc.

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:

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: $!";
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:
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


In reply to Problems with PP and Posix by monger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



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