[19759] in Perl-Users-Digest
Perl-Users Digest, Issue: 1954 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 18 06:07:54 2001
Date: Thu, 18 Oct 2001 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1003399507-v10-i1954@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 18 Oct 2001 Volume: 10 Number: 1954
Today's topics:
Re: Can't get the output for shell command from CGI <goldbb2@earthlink.net>
Re: Change Last Modified for all files in a directory <bart.lateur@skynet.be>
Checking a line of string <sasha_lui@yahoo.com>
file upload in perl <steven@steven.com>
Re: Help with write <goldbb2@earthlink.net>
Re: Matching & Merging two text files <goldbb2@earthlink.net>
Re: Need help to find a regexp (Bart Van der Donck)
Re: Need help to find a regexp (Bart Van der Donck)
Re: Perl CGI problem printing Javascript... <swessels@usgn.net>
Re: perl converted to exe is dyeing..please help.. <andrey@flyg.kth.se>
Re: Perl->M$ SQL <goldbb2@earthlink.net>
sendmail not sending mail anymore <nospam@nospam.com>
Re: Splitting on value pairs <bart.lateur@skynet.be>
Re: Splitting on value pairs <tintin@snowy.calculus>
Re: using win32::perms module to get owner. <jimbo@soundimages.co.uk>
Why wont "perl Makefile.PL" recognise perl 5 on DJGPP/W (Mark Carter)
Re: Writing and reading encrypted string (password) <bart.lateur@skynet.be>
Re: Writing and reading encrypted string (password) <dump@the-core.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Oct 2001 03:09:05 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Can't get the output for shell command from CGI
Message-Id: <3BCE8011.9CCF6988@earthlink.net>
Carfield Yim wrote:
>
> I want to display a HTML of java code to my visitor, so I write the
> following script to serve this:
>
> #!/usr/bin/perl -w
> use CGI qw(param);
>
> print "Content-type: text/html";
>
> $command = "/usr/local/bin/java2html < /server/http/java_store/applet/chat/src/com/lyrisoft/auth/mysql/Mysql.java --title \"powered by java2html from gun.org\"|";
My goodness that's ugly. There are much better ways of doing that.
> open(IN, $command) || die "cannot open file for reading: $!";
>
> while (<IN>) { # read a line from the command into $_
> print $_; # print that line to file $b
> }
> close(IN) || die "can't close file: $!";
When closing a filehandle which is a pipe, you also need to include $?
in the error message, or examine it for creating an appropriate message.
unless( close(IN) ) {
my ($sig, $ret) = ($?&255, $?>>8);
die "java2html died from signal $sig" if $sig;
die "java2html exited with code $ret" if $ret;
die "Error closing pipe from java2html $!";
}
> The $command can successful run at shell and display the HTML to
> stdout, however in this CGI I get the following error:
>
> /usr/local/bin/java2html: unrecognized option
> `--code=http://www.carfield.com.hk/java_store/SUN_j2se_runtime_lib_src_1.4/java/lang/String.java'
> can't close file: at /var/www/cgi-bin/java2html.pl line 14.
> [Wed Oct 17 00:50:13 2001] [error] [client 10.0.0.1] Premature end of
> script headers: /var/www/cgi-bin/java2html.pl
>
> why will this happen?
Well, the reason for the part in [] about "premature..." is that perl
buffers STDOUT, so that the error message created by java2html.java was
printed out before your print "content-type: text/html" got done.
The reason for the earlier part is that you have the --title after you
redirect the input of the program... which the shell doesn't like.
I would replace your code with the following:
#!/usr/bin/perl -w
use strict;
$| = 1; # turn on autoflush. Very important sometimes.
print "Content-Type: text/html\n\n";
open( STDIN, "</server/http/java_store/applet/chat/src" .
"/com/lyrisoft/auth/mysql/Mysql.java" ) or do {
print "<HTML><HEAD></HEAD><BODY><XMP>\n";
print "Couldn't open Mysql.java: $!\n";
print "</XMP></BODY></HTML>\n";
exit;
};
{ # extra {} to disable warning "Statement unlikely to be reached"
exec( qw( /usr/local/bin/java2html
--title "powered by java2html from gun.org"
) );
}
print "<HTML><HEAD></HEAD><BODY><XMP>\n";
print "Exec java2html failed: $!\n";
print "</XMP></BODY></HTML>\n";
__END__
This is a much cleaner way to run your program than via open.
NB: This code is untested.
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Thu, 18 Oct 2001 07:59:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Change Last Modified for all files in a directory
Message-Id: <ks2tstge1qahu9kp5ipg73q39dhha65kj9@4ax.com>
BUCK NAKED1 wrote:
>I was using IE5, and had my browser open for several hours, hitting
>"Cntrl R" (along with Refresh in the toolbar) to refresh. Thanks for
>the OT tip... so "Cntrl, Shift, R" reloads, eh? I don't always see a
>Reload function in the IE toolbar, so I thought just a plain "Cntrl R"
>was reloading it.
Hold Ctrl down and press the button in the toolbar (or press F5). Or was
it Shift? No, that's Netscape...
--
Bart.
------------------------------
Date: Thu, 18 Oct 2001 11:57:23 +0200
From: "Sasha" <sasha_lui@yahoo.com>
Subject: Checking a line of string
Message-Id: <9qm7rl$fem$1@newstoo.ericsson.se>
Hi
I am writing a program which receives one line at a time. Each line may have
some comment marked # or data containing name and phone number, I was
wodering if some one could tell me how can I skips or ignore the data
started or after # skips a line if it starts with # or skips a line with
more than two words and save the lines data if it has two words.
The data in a line looks like this
# Here is an example of line data
Peter 2131111111 # correct data it should be saved
Andre 212112 333333 # Wrong data and it should be ignored
Mark 212112 Angel # Wrong data and it should be ignored
My program looks like :
If (open (MYFILE, "data.dat")){
$line = <MYFILE>;
while ($line ne "") # Not end of file {
if (it_is_ a_comment ){ } #dont save it
if (it_is_ a_wrong ){ } # dont save it
if (it_is_correct){ #save it }
}
}
Thank in advance Sasha
------------------------------
Date: Thu, 18 Oct 2001 10:26:08 +0200
From: "Steven" <steven@steven.com>
Subject: file upload in perl
Message-Id: <3bce91a5$0$7109$4d4efb8e@news.be.uu.net>
Dear,
Certain perl scripts (.pl) are located in their working directory on the C
drive. Inside the perl script, we can change to another directory on that
same C drive.
However, changing to the D drive seems impossible.
Question: how do we program script to be able to write a file on another
drive than the one the working directory is located on?
Attaced are the working script (file_upload_ok.pl) and the script that tries
to write to another drive (file_upload_NOK.pl).
Thanks beforehand for a solution or a tip.
Els
SCRIPTS:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
file_upload_NOK.pl
- - - - - - - - -
#!/usr/local/bin/perl
############################################################################
#####
# cgi script to retrieve and store a file to a directory location
#
#
# Special note: Had major difficulty getting EOF from STDIN if using IIS.
The
# workaround is to get exactly the number of bytes needed for
a
# file and not wait for an EOF. This wasn't a problem for
Apache.
############################################################################
#####
############################################################################
#####
# routine to log activity to a file.
############################################################################
#####
sub do_log
{
my($filename, $pref, $msg) = @_;
$LOGFILE = ">>file_upload.log";
# Open/Print/Close the log file. Don't die if you can't open the log
file.
$tod = scalar localtime;
open (LOGF, $LOGFILE);
printf LOGF "%s: %s: %s %s\n", $tod, $pref, $filename, $msg;
close LOGF;
}
############################################################################
#####
# For testing we put out a message to say we are working ok.
############################################################################
#####
sub not_a_post
{
my($meth) = @_;
if ($meth eq "GET") {
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Successful Connection</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H1>Congratulations, file_upload.pl is correctly
installed!!</H1>\n";
print "</BODY>\n";
print "</HTML>\n";
} else { # from command line
print "Congratulations, Perl is correctly configured!\n";
}
}
############################################################################
#####
# Main routine
############################################################################
#####
{
use Env qw(REQUEST_METHOD);
$BLOCK_SIZE=16384; # size of buffer
binmode STDIN; # must be in binary mode!!
if ($REQUEST_METHOD ne "POST") {
not_a_post("$REQUEST_METHOD");
close(STDOUT);
exit;
}
print "Content-type: text/html\n\n";
chomp($TEMP_FILE = <STDIN>);
chomp($DIR = <STDIN>);
chomp($SIZE = <STDIN>);
# delete the carriage return that comes from pc land.
$TEMP_FILE =~ s/\r//;
$DIR =~ s/\r//;
$SIZE =~ s/\r//;
$OUTFILE = "$DIR/$TEMP_FILE";
do_log ($OUTFILE, "Started File", "Size($SIZE)");
open (OUT, ">$OUTFILE") or do_log ($OUTFILE, "Outfile Error", "Error
opening file") and print "NOK" and close(STDOUT) and exit;
binmode OUT; # must also be in binary mode!!
$buf = '';
$len = 0;
# get our initial buffer size
$buflen = $BLOCK_SIZE;
if ($SIZE < $buflen) {
$buflen = $SIZE;
}
# read the file till finished
while ($len = read STDIN, $buf, $buflen){
#do_log ($OUTFILE, "Got Data ", "Length:$len");
syswrite(OUT, $buf, $len);
$SIZE -= $len;
if ($SIZE < $buflen) {
$buflen = $SIZE;
}
}
do_log ($OUTFILE, "Finished File", "Successful!!");
# Send a OK back for ok.
print "OK";
close(STDOUT);
}
############################################################################
#####
############################################################################
#####
############################################################################
#####
- - - - - - - - -
file_upload_ok.pl:
- - - - - - - - - -
#!/usr/local/bin/perl
############################################################################
#####
# cgi script to retrieve and store a file to a directory location
#
#
# Special note: Had major difficulty getting EOF from STDIN if using IIS.
The
# workaround is to get exactly the number of bytes needed for
a
# file and not wait for an EOF. This wasn't a problem for
Apache.
############################################################################
#####
############################################################################
#####
# routine to log activity to a file.
############################################################################
#####
sub do_log
{
my($filename, $pref, $msg) = @_;
$LOGFILE = ">>file_upload.log";
# Open/Print/Close the log file. Don't die if you can't open the log
file.
$tod = scalar localtime;
open (LOGF, $LOGFILE);
printf LOGF "%s: %s: %s %s\n", $tod, $pref, $filename, $msg;
close LOGF;
}
############################################################################
#####
# For testing we put out a message to say we are working ok.
############################################################################
#####
sub not_a_post
{
my($meth) = @_;
if ($meth eq "GET") {
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Successful Connection</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H1>Congratulations, file_upload.pl is correctly
installed!!</H1>\n";
print "</BODY>\n";
print "</HTML>\n";
} else { # from command line
print "Congratulations, Perl is correctly configured!\n";
}
}
############################################################################
#####
# Main routine
############################################################################
#####
{
use Env qw(REQUEST_METHOD);
$BLOCK_SIZE=16384; # size of buffer
binmode STDIN; # must be in binary mode!!
if ($REQUEST_METHOD ne "POST") {
not_a_post("$REQUEST_METHOD");
close(STDOUT);
exit;
}
print "Content-type: text/html\n\n";
chomp($TEMP_FILE = <STDIN>);
chomp($DIR = <STDIN>);
chomp($SIZE = <STDIN>);
# delete the carriage return that comes from pc land.
$TEMP_FILE =~ s/\r//;
$DIR =~ s/\r//;
$SIZE =~ s/\r//;
$OUTFILE = "$TEMP_FILE";
$DIRECTORY = "$DIR";
do_log ($OUTFILE, "Started File", "Size($SIZE)");
chdir("$DIRECTORY") or do_log ($DIRECTORY, "Directory Error", "Could not
change Dir") and print "NOK" and close(STDOUT) and exit;
open (OUT, ">>$OUTFILE") or do_log ($OUTFILE, "Outfile Error", "Error
opening file") and print "NOK" and close(STDOUT) and exit;
binmode OUT; # must also be in binary mode!!
$buf = '';
$len = 0;
# get our initial buffer size
$buflen = $BLOCK_SIZE;
if ($SIZE < $buflen) {
$buflen = $SIZE;
}
# read the file till finished
while ($len = read STDIN, $buf, $buflen){
do_log ($OUTFILE, "Got Data ", "Length:$len");
syswrite(OUT, $buf, $len);
$SIZE -= $len;
if ($SIZE < $buflen) {
$buflen = $SIZE;
}
}
do_log ($OUTFILE, "Finished File", "Successful!!");
# Send a OK back for ok.
print "OK";
close(STDOUT);
}
############################################################################
#####
############################################################################
#####
############################################################################
#####
------------------------------
Date: Thu, 18 Oct 2001 03:24:32 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Help with write
Message-Id: <3BCE83B0.665FCDF@earthlink.net>
Sivaram Krishnan wrote:
>
> I am reading an input ASCII file with the following format:
>
> f00000000 12345678 ABCD 10 20 30
> a00000000 43218765 XYZ 1 2 3
>
> etc.
>
> I am interested in each column. So as I parse
> I get each column into $1, $2 etc.
>
> Now I am interested in WRITING these values, e.g., $1
> into a file as binary data.
>
> $1 which is f0000000 is actually 4 bytes or 32 bits.
Err, no, it's not. It's an ascii string that's 8 bytes long.
> I am using syswrite function with the intent of
> writing out the bit stream l11100000000.... etc.
You mean like printf "%b" does?
> But Perl thinks of $1 as ASCII and writes out the
> ASCII character bit stream not the hex values.
Well, that's what it is, ascii.
> I tried to do $1 + 4 -4 and assign this to another
> variable in the hope that the result would be a
> number but I was unsuccessful.
Well, that's because when it converts the string "f00000000" to a
number, it uses atof, which of course doesn't recognize it as a
hexidecimal string, and produces 0.
> Is there a clean elegant way to do this?
Assuming you only want to convert the first two columns from hex strings
into numeric values, and then convert them into packed binary format,
try something like:
print pack "NN", hex($1), hex($2);
or:
print pack "VV", hex($1), hex($2);
or:
print pack "LL", hex($1), hex($2);
The first outputs bigendian, the second littleendian, and the third your
system's native endian. If you want to print in nuxi format, which is a
scewey half-big-half-little-endian format, you're out of luck.
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Thu, 18 Oct 2001 06:06:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Matching & Merging two text files
Message-Id: <3BCEA9AB.A17E68CC@earthlink.net>
Lou Moran wrote:
>
> I have two Lotus Notes DBs that contain various information about
> employees.
>
> One contains things like Name, Hire Date, etc.. The other contains
> Name, Address, etc.. Now they'd like them to be one. They'd also
> like them to be in CSV format. OK. I made a Notes view that is
> exportable in CSV and I exported them... so far so good.
>
> The format is:
> "Last Name, First Name" , "DOB" , "SSN" , etc. " "," "
> ^^^^^^^
> blank fields
>
> Here are the Perl questions:
>
> I need to read both files and match the Name and merge all the info
> together so that it all falls in under the Name. I know how to open
> and read in a file but I'm a little fuzzy on how to read in two files
> and get them to be one file. Would I read the file in a line at a
> time or all at once?
You read in one, then read in the other, and then output the result.
> I am a lot fuzzy (I'm absolutely furry actually) on how to get the
> names to match up and then get rid of one of them.
>
> For the matching should I strip the quotes? I don't think I actually
> need them.
You don't need them once the data is read into perl, but they *do* need
to be there in the file, otherwise you end up with one field which is
like <"Last Name> and another field like <First Name">
> Are there modules that do just this sort of thing?
Text::CSV and Text::CSV_XS are good for reading and writing CSV files.
Merging is relatively easy.
> (I am not asking anyone to write the code out for me I just don't
> understand what I supposed to be doing to make this happen. I think
> the two files and the matching are what's making it hard for me to get
> this around my head. I mostly use Perl to read log files and move
> things around.)
#!/usr/local/bin/perl -w
use strict;
use Text::CSV_XS;
use vars qw($csv %merged @fields);
$csv = Text::CSV_XS->new( {binary=>1} );
sub merge {
my ($file, $key) = @_;
open( my $fh, "<$file" )
or die "Couldn't open $file: $!";
my $fields = $csv->getline($fh);
my ($primary_key) = grep $_ eq $key, @$fields;
while( my $row = $csv->getline($fh) ) {
@{$merged{$row->[$primary_key]}}{@$fields} = @$row;
}
close $fh or die "Error closing $file: $!";
my %seen;
@fields = grep !$seen{$_}++, @fields, @$fields;
}
# note that if both tables have SSN, then that should
# be used as the primary key, not the person's name.
merge( "table_one.csv", "Last Name, First Name" );
merge( "table_two.csv", "Last Name, First Name" );
open( my $output, ">tables_one_and_two.csv" )
or die "Couldn't open tables_one_and_two.csv: $!";
use IO::Wrap; $output = wraphandle($output);
$csv->print($output, \@fields)
or die "Error in \$csv->print: $!";
while( my ($key, $value) = each %merged ) {
$csv->print($output, \@$value{@fields})
or die "Error in \$csv->print: $!";
}
close $output
or die "Error closing tables_one_and_two.csv: $!";
__END__
NB: This code is untested.
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: 18 Oct 2001 01:15:17 -0700
From: bart@nijlen.com (Bart Van der Donck)
Subject: Re: Need help to find a regexp
Message-Id: <b5884818.0110180015.6d4730a0@posting.google.com>
Mirko Schur <mschur@web.de> wrote in message news:<3BCDCAA3.DB1B0F93@web.de>...
> Hi,
>
> I try to find a regexp for the following task:
>
> In the following string for example
>
> "<b>Important</b> Note: {<i>}The Note{</i>}"
>
> I try to delete the html tags with a regular expression, however
> those enclosed by { and } should not be deleted.
>
> Can anybody find a regexp for that task?
>
> Thanks
>
> Mirko
This should do the job:
#!/usr/bin/perl
# uncomment if web
# print "Content-type: text/html\n\n";
# where is your original html file to be
# converted (full path) ?
$html="/path/to/your/file.html";
# where is your txt file (full path) ?
# file will be used to write the result to
# file must be writable
$txt="/path/to/other/file.txt";
# what is the maximum length of 1 html tag
# let's say
$max=150;
# these variables can be left alone
$|++;
$line=0;
# script starts here
open (R, "<$html") || die "can t read $html: $!";
while (<R>)
{
$t=$_;
for ($q=$max; $q>0;$q++)
{
$p="";
for (1..$q) {$p.=".";}
# here comes the trick ;)
$t=~s/{</{{{/gi;
$t=~s/>}/}}}/gi;
$t=~s/<$p>//gi;
$t=~s/<$p//gi;
$t=~s/$p>//gi;
}
$t=~s/{{{/{</gi;
$t=~s/}}}/>}/gi;
$result.=$t;
$line++;
print "Converting line $line...ok<br>\n";
}
close R;
open (W, ">>$txt") || die "can t write to $txt: $!";
print W $result;
close W;
print "Script finished.\n";
Bart
------------------------------
Date: 18 Oct 2001 01:20:51 -0700
From: bart@nijlen.com (Bart Van der Donck)
Subject: Re: Need help to find a regexp
Message-Id: <b5884818.0110180020.6fe7a87f@posting.google.com>
oops !
for ($q=$max; $q>0;$q++)
must be
for ($q=$max; $q>0;$q--)
Bart
------------------------------
Date: Thu, 18 Oct 2001 07:10:09 GMT
From: "Scott Wessels" <swessels@usgn.net>
Subject: Re: Perl CGI problem printing Javascript...
Message-Id: <lfvz7.15841$B72.3238735@news1.rdc1.az.home.com>
"Brian Carlson" <bcarlso4@bellsouth.net> wrote in message
news:3BCE21AD.2AFDD909@bellsouth.net...
> I have a perl cgi script, that when ran, prints out javascript. I have
> the following in my page....
>
> <SCRIPT LANGUAGE="Javascript" SRC="www.pschallenge.com/cgi-bin/bc.pl"
> type="text/javascript">
> </script>
>
> This doesn't work. I don't get the perl JS code ran on the browser.
> But when I run the perl code from the command line, and paste it in the
> page, it runs fine.
>
> Any thoughts?
>
> Thanks,
> Brian
>
>
it's probably as simple as changing the extension to .cgi, though there are
other possibilities:
-set your server to run .pl as a CGI
if Apache use in conf: AddHandler cgi-script .pl
-ensure permissions are appropriate for dir and file
chmod +x bc.pl
Regards,
Scott
------------------------------
Date: Thu, 18 Oct 2001 10:41:04 +0200
From: Andrey Shipsha <andrey@flyg.kth.se>
Subject: Re: perl converted to exe is dyeing..please help..
Message-Id: <3BCE95A0.2B79D96E@flyg.kth.se>
Jamuna Krishnappa wrote:
>
> Hello everybody,
>
> I have perl program which I converted to an NT service, and once it's
> started, afer 1 or two days, it keeps dyieng..Any reason, Please help
> me..I am very despearate.
Use UNIX/Linux instead. See what happens...
/A.
------------------------------
Date: Thu, 18 Oct 2001 04:02:54 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl->M$ SQL
Message-Id: <3BCE8CAE.2BD4F7BE@earthlink.net>
Jacqui caren wrote:
>
[snip]
> One proviso MS ODBC drivers limit you to one query at a time.
>
> try doing
>
> my $id =1;
>
> my $csr = $dbh->prepare('select title,Child from tbl where id = ?');
> $csr->execute($id);
> my (@recs,$title,$child);
> while (($title,$child) = fetchrow_arrayref()) {
Does this work? What is fetchrow_arrayref being applied to?
Isn't that supposed to be $csr->fetchrow_arrayref ?
Also, since you asked for an arrayref, not an array, it only gets one
item, and puts it in $title. $child will always be undef.
> push @recs,{ID => $id, TITLE => $title};
>
> last unless defined $child;
$child will never be defined.
> $id = $child;
>
> # with crappy MS-ODBC driver (manager) you need
> # a finish/prepare here.
>
> $csr->execute($child);
You can't use one statement handle for two parallel queries. It just
doesn't work. You would have to have two statement handles, each made
by one prepare.
> }
> $csr->finish();
>
> As you can guess this totaly ruins any chances of
> doing reusable cursors etc - a sort of MS go-slower
> stripe.
Your problem looks more like you're trying to do the equivilant of:
while( my ($foo, $bar) = each %hash ) {
while( my ($baz, $quux) = each %hash ) {
... stuff ...
}
}
It's your code's fault, not the fault of ODBC.
--
"What does stupid old man mean pidgin talk?
Shampoo does not talk like a bird."
------------------------------
Date: Thu, 18 Oct 2001 09:52:09 GMT
From: "No Idea" <nospam@nospam.com>
Subject: sendmail not sending mail anymore
Message-Id: <dDxz7.1637$IR4.1088096@news1.denver1.co.home.com>
Hey guys,
I was trying out some new Form2Email scripts today and now all of
a sudden sendmail doesnt want to send mail....
Now, one of the scripts had something unusual (at least something
Ive never seen):
# Mailer command flags: if you want sendmail to queue the mail
until the next run
# (typically around every 10 minutes, use these flags
(recomended, as the script
# can finish faster)
$mail_flags = '-oi -t -odq';
# However, if you can't wait up to ten minutes for the email, and
don't mind the
# script taking a little longer to process, use these flags
(uncomment):
#$mail_flags = '-oi -t';
Now, I tried both options, as the script was only sending 1
email, when supposed to send 2...... and from what I can tell,
my server doesnt run sendmail at regular intervals (afaik)....
So, did the first option set some kind of option to query emails
until sendmail is run????
Also, Im not 100% sure that the above has anything to do with it,
as i was trying several different scripts throughout the night,
but if Im correct, sendmail stopped sending mail when I was
messing with this script....
Is there anyway to get sendmail working again... easily?
Also, my server is a RaQ3 & I dont have root access
------------------------------
Date: Thu, 18 Oct 2001 07:18:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Splitting on value pairs
Message-Id: <la0tstssdt69mj627fsmu111rprqvau17o@4ax.com>
Tintin wrote:
>> @data = /((?:[^" ]|"[^"]*")+)/g;
>
>I tried that, but the time field was still split in two.
Are you sure? Because I got exactly 4 fields out of your example:
id=firewall
time="2001-10-14 12:01:05"
fw=199.9.9.9
src=199.9.9.9
BTW it'd be better not to allow other kinds of whitespace on the "no
quote no space" part, too. Or maybe just disallow all control
characters.
@data = /((?:[^" \000-\040]|"[^"]*")+)/g; # Ascii
--
Bart.
------------------------------
Date: Thu, 18 Oct 2001 17:37:34 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Splitting on value pairs
Message-Id: <eGvz7.24$kv2.287753@news.interact.net.au>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:la0tstssdt69mj627fsmu111rprqvau17o@4ax.com...
> Tintin wrote:
>
> >> @data = /((?:[^" ]|"[^"]*")+)/g;
> >
> >I tried that, but the time field was still split in two.
>
> Are you sure? Because I got exactly 4 fields out of your example:
Not sure what I did the first time. I did cut and past the regex into my
code, but I must have done something else wrong. It works as you say.
------------------------------
Date: Thu, 18 Oct 2001 09:07:57 +0100
From: "jimbo" <jimbo@soundimages.co.uk>
Subject: Re: using win32::perms module to get owner.
Message-Id: <x5wz7.373$cr3.1417@NewsReader>
"analyser" <analysergreat@hotmail.com> wrote
> does anybody know how to get owner using the win32::perms module by
> roth. they have examples on the website.. but none for getting the
> owner..
If you've got the module, you've got the documentation. You may need to
look for it. I found it in the Perms directory as a readme file.
Always look for files such as these that may accompany a module and
reside in the module directory before squawking there are no docs.
The wee code fragment I used to show owner(s):
use strict;
use Win32::Perms;
foreach my $file (<*.plx>) {
my $perms = new Win32::Perms($file);
printf "%-24s:%s\n", $file, $perms->Owner();
}
The output from aforementioned wee code fragment (excerpted):
addrsTest.plx :BUILTIN\Administrators
cat.plx :BUILTIN\Administrators
ckaddr.plx :BUILTIN\Administrators
copy_pic.plx :BUILTIN\Administrators
crap.plx :BUILTIN\Administrators
Example_7_23.plx :BUILTIN\Administrators
Example_7_24.plx :BUILTIN\Administrators
As an aside, you said you found some examples on the we site. Well, I
found the complete documentation, examples and all, on the website. So,
how did you miss it?
http://www.roth.net/perl/perms/
jimbo
;-)
------------------------------
Date: 18 Oct 2001 02:53:41 -0700
From: cartermark46@hotmail.com (Mark Carter)
Subject: Why wont "perl Makefile.PL" recognise perl 5 on DJGPP/Windows?
Message-Id: <1f4dc1f3.0110180153.72e3125d@posting.google.com>
I have downloaded some CPAN files, and the instructions state that to
compile them, I should type:
perl Makefile.PL
When I do this, I get the response:
Unable to find perl 5 ...
If I type:
perl -v
I am told that I am running version 5.005_02.
So what's going on, and how do I fix it?
I am running DJGPP on Windows 95. Admittedly some of the installation is fairly old.
------------------------------
Date: Thu, 18 Oct 2001 08:54:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <s16tstg15l8ksbmoe4i1nhcaukst8ls5cd@4ax.com>
Benjamin Goldberg wrote:
>Then how about you obfuscate it with pack/unpack "u" ?
Both base64 and UU-encoded look far too familiar to any computer
literate. They'd be tempted to decode it, just for the heck of it.
I think I'd use a slightly less trivial approach, and XOR each Ascii
code with a pseudo-random integer less than 32, (except maybe for codes
under 32).
{
my $s;
sub r { $s = shift if @_; $s*=31421; ($s%=0x10000)/0x10000 }
}
$_ = 'Hello, Dolly';
r(125);
$enc = pack 'C*', map { $_^int(32*r()) } unpack 'C*', $_;
print $enc;
r(125);
$dec = pack 'C*', map { $_^int(32*r()) } unpack 'C*', $enc;
print $dec;
(Encoder and decoder are identical)
Result:
^hpb{+;Kvmbs
Hello, Dolly
Note that the "l"'s aren't all converted to the same character.
--
Bart.
------------------------------
Date: Thu, 18 Oct 2001 11:25:03 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <5s7tst4fst8lb53o29p6fs2ljiudi5cne9@4ax.com>
On Wed, 17 Oct 2001 22:42:38 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
>But what if the key is a digest (MD::Digest, a CRC or something like
>that) of the script itself? Once the hacker edits the source to get at
That's a cool idea indeed. I also thought about it today when looking
at the Blowfish module. But how could I get a CRC of the script source
itself from within the program? (First I thought about using the
source of the prog itself as key, but that would be too long)
Lars
--
GPZ900R xxMm+2,5Mm http://www.oeschey.de
GS400 xxMm+1,5Mm http://www.the-core.net
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1954
***************************************