[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bricolage-commits
Subject:    [Bricolage-Commits] Simplified the NOTICE filtering code.
From:       David Wheeler <wheeler () users ! sourceforge ! net>
Date:       2002-08-30 1:43:50
[Download RAW message or body]

Log Message:
-----------
Simplified the NOTICE filtering code. Thanks to Tim Ellis on the pgsql-admin
mail list for the tip! Can you tell that I'm not much of a Perl golfer? ;-) I
also deleted the comments about using grep instead of Perl -- seemed
unnecessary.

Modified Files:
--------------
    /cvsroot/bricolage/bricolage/bin:
        bric_pgimport
    /cvsroot/bricolage/bricolage/inst:
        db.pl
    /cvsroot/bricolage/bricolage/inst/upgrade/lib:
        bric_upgrade.pm
["wheeler-200283014350-diff.txt" (wheeler-200283014350-diff.txt)]

Index: bric_pgimport
===================================================================
RCS file: /cvsroot/bricolage/bricolage/bin/bric_pgimport,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -d -r1.10 -r1.11
--- bric_pgimport	30 Aug 2002 00:24:32 -0000	1.10
+++ bric_pgimport	30 Aug 2002 01:43:47 -0000	1.11
@@ -41,13 +41,9 @@
 
 # Tell STDERR to ignore PostgreSQL NOTICE messages by forking another Perl to
 # filter them out.
-open STDERR, "| perl -e 'while (<>) { print unless /^NOTICE:  / }'"
+open STDERR, "| perl -ne 'print unless /^NOTICE:  /'"
   or die "Cannot pipe STDERR: $!\n";
 
-# This would also work, but we *know* that we have already Perl to work with.
-#open STDERR, "| grep -v '^NOTICE:  '"
-#  or die "Cannot pipe STDERR to grep\n";
-
 # Setup some initial values.
 initialize();
 
@@ -350,11 +346,6 @@
 	print "\n";
     }
     print "Done.\n" unless $opt_q;
-
-my $t1 = Benchmark->new;
-my $td = timediff($t1, $t0);
-print "the code took: ", timestr($td), "\n";
-    exit;
 }
 
 1;
Index: db.pl
===================================================================
RCS file: /cvsroot/bricolage/bricolage/inst/db.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- db.pl	30 Aug 2002 00:24:32 -0000	1.4
+++ db.pl	30 Aug 2002 01:43:47 -0000	1.5
@@ -49,12 +49,8 @@
 
 # Tell STDERR to ignore PostgreSQL NOTICE messages by forking another Perl to
 # filter them out.
-open STDERR, "| perl -e 'while (<>) { print unless /^NOTICE:  / }'"
+open STDERR, "| perl -ne 'print unless /^NOTICE:  /'"
   or die "Cannot pipe STDERR: $!\n";
-
-# This would also work, but we *know* that we have already Perl to work with.
-#open STDERR, "| grep -v '^NOTICE:  '"
-#  or die "Cannot pipe STDERR to grep\n";
 
 # setup database and user while connected to dummy template1
 my $dbh = db_connect('template1');
Index: bric_upgrade.pm
===================================================================
RCS file: /cvsroot/bricolage/bricolage/inst/upgrade/lib/bric_upgrade.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- bric_upgrade.pm	30 Aug 2002 00:24:32 -0000	1.11
+++ bric_upgrade.pm	30 Aug 2002 01:43:48 -0000	1.12
@@ -117,13 +117,8 @@
 
 # Tell STDERR to ignore PostgreSQL NOTICE messages by forking another Perl to
 # filter them out.
-open STDERR, "| perl -e 'while (<>) { print unless /^NOTICE:  / }'"
+open STDERR, "| perl -ne 'print unless /^NOTICE:  /'"
   or die "Cannot pipe STDERR: $!\n";
-
-# This would also work, but we *know* that we have already Perl to work with.
-#open STDERR, "| grep -v '^NOTICE:  '"
-#  or die "Cannot pipe STDERR to grep\n";
-
 
 =head1 EXPORTED FUNCTIONS
 
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-Commits mailing list
Bricolage-Commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-commits

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic