Author: coar
Date: Sat Mar 6 15:55:42 2010
New Revision: 919792
URL: http://svn.apache.org/viewvc?rev=919792&view=rev
Log:
Fix Perl shebang, and get DB particulars from the environment
Added:
labs/pulse/data/
labs/pulse/data/processed/ (with props)
labs/pulse/data/queue/ (with props)
Modified:
labs/pulse/analysis/ (props changed)
labs/pulse/analysis/listex-demail.pl
labs/pulse/analysis/listex-load.pl
Propchange: labs/pulse/analysis/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 6 15:55:42 2010
@@ -0,0 +1 @@
+.dbaccess.sh
Modified: labs/pulse/analysis/listex-demail.pl
URL:
http://svn.apache.org/viewvc/labs/pulse/analysis/listex-demail.pl?rev=919792&r1=919791&r2=919792&view=diff
==============================================================================
--- labs/pulse/analysis/listex-demail.pl (original)
+++ labs/pulse/analysis/listex-demail.pl Sat Mar 6 15:55:42 2010
@@ -1,4 +1,4 @@
-#! /usr/local/bin/perl -w
+#! /usr/bin/perl -w
#
# Extract the body of a mail message and feed it to another script.
#
Modified: labs/pulse/analysis/listex-load.pl
URL:
http://svn.apache.org/viewvc/labs/pulse/analysis/listex-load.pl?rev=919792&r1=919791&r2=919792&view=diff
==============================================================================
--- labs/pulse/analysis/listex-load.pl (original)
+++ labs/pulse/analysis/listex-load.pl Sat Mar 6 15:55:42 2010
@@ -1,4 +1,4 @@
-#! /usr/local/bin/perl -w
+#! /usr/bin/perl -w
#
# Read the latest mailing list info and load it into the database.
# Input is either ASCII text formatted like:
@@ -21,14 +21,16 @@
# </site>
# </mailing-lists>
#
+
use strict;
+use Data::Dumper;
use DBI;
use DBD::mysql;
-use Getopt::Long;
use Digest::MD5 qw(md5_hex);
-use XML::Simple qw(:strict);
-use Data::Dumper;
+use Getopt::Long;
+use Symbol;
use XML::LibXML::Common qw(:encoding);
+use XML::Simple qw(:strict);
my $fh = select(STDOUT);
$| = 1;
@@ -36,20 +38,27 @@
$| = 1;
select($fh);
-my $dsn = 'DBI:mysql:database=<dbname>:host=<dbfqhn>';
-my $dbx = DBI->connect($dsn, '<username>', '<password>',
+my $dsn = "DBI:$ENV{PULSE_DBMS}"
+ . ":database=$ENV{PULSE_DB_NAME}"
+ . ":host=$ENV{PULSE_DB_HOST}";
+my $dbx = DBI->connect($dsn, $ENV{PULSE_DB_USER}, $ENV{PULSE_DB_PASSWORD},
{
RaiseError => 0,
PrintError => 1,
});
-my $debug = 0;
-my $dry_run = 0;
Getopt::Long::Configure('bundling');
Getopt::Long::Configure('auto_abbrev');
Getopt::Long::Configure('pass_through');
-GetOptions('d|debug+' => \$debug,
- 'n|no-action' => \$dry_run,
+
+my $debug = 0;
+my $dry_run = 0;
+my $infile = '-';
+
+GetOptions(
+ 'd|debug+' => \$debug,
+ 'f|input-file=s' => \$infile,
+ 'n|no-action' => \$dry_run,
);
my $asof = '1980-01-01';
@@ -67,15 +76,21 @@
my $digesters;
my $moderators;
-debug(2, 'Reading from STDIN');
-while (my $line = <>) {
+$infile = 'STDIN' if ($infile eq '-');
+debug(2, "Reading from $infile");
+my $ifh = \*STDIN;
+if ($infile ne 'STDIN') {
+ $ifh = gensym();
+ open($ifh, '<' . $infile)
+}
+while (my $line = <$ifh>) {
$line =~ s§[\r\n\s]+$§§g;
chomp($line);
next if (! $line);
if ($line =~ /<\?xml/) {
debug(2, 'XML-format detected');
$xml++;
- @lines = <>;
+ @lines = <$ifh>;
chomp(@lines);
unshift(@lines, $line);
next;
@@ -103,6 +118,8 @@
" <digest-subscribers>$digesters</digest-subscribers>",
" </list>");
}
+close($ifh) if ($ifh != \*STDIN);
+
if (! $xml) {
push(@lines, ' </site>') if ($domain);
push(@lines, "</mailing-lists>\n");
Propchange: labs/pulse/data/processed/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 6 15:55:42 2010
@@ -0,0 +1 @@
+*
Propchange: labs/pulse/data/queue/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 6 15:55:42 2010
@@ -0,0 +1 @@
+*
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]