perlnewbieak has asked for the wisdom of the Perl Monks concerning the following question:
use Config::Simple; use warnings; $cfg = new Config::Simple(); $cfg->read('../config/Amis_a.conf'); use Cwd qw(abs_path); $dbh = DBI->connect('dbi:mysql:' . $DB_schema . ';' . $DB_server , $DB +_login , $DB_password) or die "Connection Error: $DBI::errstr\n"; my $status; my $message; open(MYFILE, "<err_output_types.txt"); # open for input flock(MYFILE, LOCK_EX); seek(MYFILE, 0, SEEK_SET); my(@lines) = <MYFILE>; # read file into list my $size = @lines; print "Size $size\n"; foreach $line (@lines) { print "$line"; } close(MYFILE); if ($size !=0) { $status=ERROR; $message="Program failed due to Errors"; } else { $status=OK; $message="Program ended successfully"; } my $path = abs_path($0); print "$path\n"; print $message; my $sth = $dbh->prepare(<<SQL); INSERT IGNORE INTO DBtst.logs(Status,Message,Origin)VALUES('$status',' +$message','$path') ; SQL $sth->execute() or die $DBI::errstr;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: find the path of perl script
by kennethk (Abbot) on Dec 17, 2009 at 17:24 UTC | |
|
Re: find the path of perl script
by ercparker (Hermit) on Dec 17, 2009 at 17:53 UTC | |
|
Re: find the path of perl script
by gulden (Monk) on Dec 17, 2009 at 18:00 UTC | |
by kalyanrajsista (Scribe) on Dec 18, 2009 at 10:43 UTC | |
|
Re: find the path of perl script
by ercparker (Hermit) on Dec 18, 2009 at 22:01 UTC | |
by afoken (Chancellor) on Dec 19, 2009 at 19:39 UTC |