in reply to DBI madness

Can this "redmon" program be run in a command line shell, and does it allow you to redirect printer driver output to its own stdout? (Alternatively, can it simply save the printer driver output to a file?)

The point would be to avoid using redmon's own internal method for invoking your perl program. Have it write or save its output in some "normal" way so that your perl program (running on its own in a command line shell) can read it.

Update: To check whether its an environment issue, you could add this to your perl script, before the DBI connect call:

open( E, ">", "check-env-$$.txt" ); # adjust path to suit your taste print E "$_ => $ENV{$_}\n" for ( sort keys %ENV ); close E;
Then compare the two versions of the check-env file (the one when run from the command line, the other when run from redmon).

Another update: If redmon can be run as a command-line tool, and can write its output to stdout, you could turn the tables: have your perl script run redmon, rather than the other way around:

open( RED, "-|", "redmon arg1 ..." ) or die "redmon failed: $!"; while (<RED>) { # do stuff... print; }

Replies are listed 'Best First'.
Re^2: DBI madness - Got it :)
by rsilvergun (Acolyte) on Jun 17, 2007 at 04:47 UTC
    figures as soon as I give up hope, I find a way to make it work. This line will open the Database with a path instead of from the DSN ->

    $dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=C:\Windows\system32\cmsdb.mdb');

    Thanks for the ENV trick, I didn't realize you could get to the environment variables that easily :D. Man, I love perl.