diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-26 18:00:56 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-26 18:00:56 +0000 |
commit | 666fd833584fe2e3618a397fe9d9a9bdf4c5b94b (patch) | |
tree | 19c4444705fd7f7803e0d7b597659c11d7e85b73 /utils/notify_short/listener.pl | |
parent | 2edd2e4de0f08a0a5f23647ea715f279671a0b89 (diff) |
Doing a simple Perltidy commit so that I can evaluate differences between the branches and make sure patches are up to date
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1103 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'utils/notify_short/listener.pl')
-rw-r--r-- | utils/notify_short/listener.pl | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/utils/notify_short/listener.pl b/utils/notify_short/listener.pl index a9286795..acbb7c91 100644 --- a/utils/notify_short/listener.pl +++ b/utils/notify_short/listener.pl @@ -7,40 +7,46 @@ # By Chris Travers, Metatron Technology Consulting # chris@metatrontech.com # -# Released under the GNU GPL v2.0 or later. See included GPL.txt for more +# Released under the GNU GPL v2.0 or later. See included GPL.txt for more # information. require "config.pl"; use DBI; my $dsn = "dbi:Pg:dbname=$database"; -my $dbh = DBI->connect($dsn, $db_user, $db_passwd, - { AutoCommit => 1, - PrintError => 0, - RaiseError => 1, } +my $dbh = DBI->connect( + $dsn, $db_user, + $db_passwd, + { + AutoCommit => 1, + PrintError => 0, + RaiseError => 1, + } ); my $sth; $dbh->do("LISTEN parts_short"); -while (1){ # loop infinitely - if ($dbh->func ('pg_notifies')){ - &on_notify; - } - sleep $cycle_delay; +while (1) { # loop infinitely + if ( $dbh->func('pg_notifies') ) { + &on_notify; + } + sleep $cycle_delay; } + sub on_notify { - open (MAIL, '|-', "$sendmail"); - $sth = $dbh->prepare(" + open( MAIL, '|-', "$sendmail" ); + $sth = $dbh->prepare( " SELECT partnumber, description, onhand, rop FROM parts WHERE onhand <= rop - "); - $sth->execute; - print MAIL $template_top; - while (($partnumber, $description, $avail, $rop) = $sth->fetchrow_array){ - write MAIL; - } - print MAIL $template_foot; - close MAIL; + " ); + $sth->execute; + print MAIL $template_top; + while ( ( $partnumber, $description, $avail, $rop ) = $sth->fetchrow_array ) + { + write MAIL; + } + print MAIL $template_foot; + close MAIL; } |