[24370] in Perl-Users-Digest
Perl-Users Digest, Issue: 6559 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 13 18:05:43 2004
Date: Thu, 13 May 2004 15:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 13 May 2004 Volume: 10 Number: 6559
Today's topics:
Re: "Definitive Guide to OOP in Perl"? <Juha.Laiho@iki.fi>
Re: "Definitive Guide to OOP in Perl"? <catcher@linuxmail.org>
Re: "Definitive Guide to OOP in Perl"? (Randal L. Schwartz)
Re: "my" variables and recursive regexp strangeness <pinyaj@rpi.edu>
Re: "my" variables and recursive regexp strangeness <pinyaj@rpi.edu>
Datetime overflow with DBI ODBC setting 19th century da <irhm@clara.net>
Re: grep <raisin@delete-this-trash.mts.net>
Re: Help Me Understand this (Jim Keenan)
help!! perl eats up my memory!! (Elhanan Maayan)
Need Perl Equivalent for C ioctl Functions for Modem Co <hal@thresholddigital.com>
Re: Need Perl Equivalent for C ioctl Functions for Mode <jgibson@mail.arc.nasa.gov>
Password scheme/Persistent session... (krakle)
Re: Perl multiline command syntax <tadmc@augustmail.com>
Re: PERL script to tidy e-mail <ittyspam@yahoo.com>
Re: PERL script to tidy e-mail <e01@removethis.toao.net>
Perldoc versus Man <ewijaya@singnet.com.sg>
Re: Perldoc versus Man <uri@stemsystems.com>
running perl script in cron (Edward)
Re: running perl script in cron (Walter Roberson)
Re: Skipping content in Array within loop and go to th <tadmc@augustmail.com>
stunnel and slow perl cgi <jcharth@hotmail.com>
Re: stunnel and slow perl cgi <jcharth@hotmail.com>
Re: Time Complexity for substr() function (Walter Roberson)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 May 2004 17:32:03 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: "Definitive Guide to OOP in Perl"?
Message-Id: <c80b8r$q2l$1@ichaos.ichaos-int>
kj <socyl@987jk.com> said:
>I just came across (in the 2003.09.25 manpage for Graham Barr's
>Scalar::Util v. 1.13) a reference to "the APress book `Tuomas J.
>Lukka's Definitive Guide to Object-Oriented Programming in Perl'".
>Since I can't find this book in print anywhere (and no mention of
>it at the APress site) I assume that it has not been published yet.
>Does anyone know of the status of this book? Is it still in the
>works, or was the project abandoned?
http://isbn.nu/ seems to recognise the book; lists it as published
in December 2002, and the ISBN is 1893115038.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Thu, 13 May 2004 14:07:11 -0400
From: Robert <catcher@linuxmail.org>
Subject: Re: "Definitive Guide to OOP in Perl"?
Message-Id: <04mdnf9wxL3SJD7dRVn-vA@adelphia.com>
kj wrote:
> I just came across (in the 2003.09.25 manpage for Graham Barr's
> Scalar::Util v. 1.13) a reference to "the APress book `Tuomas J.
> Lukka's Definitive Guide to Object-Oriented Programming in Perl'".
> Since I can't find this book in print anywhere (and no mention of
> it at the APress site) I assume that it has not been published yet.
> Does anyone know of the status of this book? Is it still in the
> works, or was the project abandoned?
>
> kj
>
> P.S. I already own a copy of Conway' "Object Oriented Perl", which
> I think is pretty good, but I find the subject inexhaustible.
Currently only available in the UK. Which may or may not be a problem
for you. : )
Robert
------------------------------
Date: Thu, 13 May 2004 18:25:44 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: "Definitive Guide to OOP in Perl"?
Message-Id: <b93fb295bbe0be3818b100f9b9371813@news.teranews.com>
>>>>> "kj" == kj <socyl@987jk.com> writes:
kj> P.S. I already own a copy of Conway' "Object Oriented Perl", which
kj> I think is pretty good, but I find the subject inexhaustible.
For a more tutorial approach, have you seen my "Learning Perl Objects
References and Modules", the sequel in spirit and form to "Learning Perl"?
print "Just another Perl hacker,"; # the first
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 13 May 2004 17:45:02 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Ian <ijnetnews@hotmail.com>
Subject: Re: "my" variables and recursive regexp strangeness
Message-Id: <Pine.SGI.3.96.1040513173428.1309961A-100000@vcmr-64.server.rpi.edu>
[posted & mailed]
On 13 May 2004, Ian wrote:
>Anybody have any ideas why changing to "my" variables would affect it
>this way?
Someone has already answered this. You can't declare and use the lexical
variable on the same line.
my $rx;
$rx = qr/...(??{ $rx }).../;
But there's another issue here.
># Double-quoted-string data regexp
>$dStringData = qr/
> ([^"\\]|\\.)+ (??{$dStringData})
> |
> "
> /x;
># Matches single or double, single or unquoted strings
>$string = qr/
> (
> " (??{$dStringData})
> )
> /x;
I've stripped out everything but the double-quoted regexes. WHY are these
recursive? I don't see the value of that at all. Why not just
$dStringData = qr{ (?: [^"\\] | \\. )+ }xs;
$string = qr{ " $dStringData " }x;
$dStringData is not gaining anything by being recursive, since once the
non-closing-quote stuff matches, the next thing that will match *is* the
closing quote. So it "recurses" once. Unless, of course, you never match
a closing quote, in which case your regex tries a whole bunch of
permutations before failing.
Run this code:
print "slow\n";
$rx = qr{ (?: [^\\"] | \\. )+ (??{ $rx }) | " }x;
q{"this thing is too slow} =~ m{ " (??{ $rx }) }x;
print "done\n\n";
print "fast\n";
$rx = qr{ (?: [^\\"] | \\. )+ }x;
q{"this thing is too slow} =~ m{ " $rx " }x;
print "done\n\n";
You'll see the bottom one is MUCH MUCH faster. The reason the top one is
slow is because after it fails the first time, the (?:...)+ part
backtracks a bit, and then the (??{ $rx }) can match the part it didn't
match, and then it tries to match a " and fails, and it does this more and
more and more. Every character you add to that string results in a
quadratically longer wait. I took out the "!" at the end of the string
because I got impatient!
And you needn't put $rx inside (??{ ... }) in the outermost regex; it
works fine by itself.
--
Jeff Pinyan RPI Acacia Brother #734 RPI Acacia Corp Secretary
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: Thu, 13 May 2004 17:46:27 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: "my" variables and recursive regexp strangeness
Message-Id: <Pine.SGI.3.96.1040513174539.1323146A-100000@vcmr-64.server.rpi.edu>
On Thu, 13 May 2004, Jeff 'japhy' Pinyan wrote:
>Run this code:
>
> print "slow\n";
> $rx = qr{ (?: [^\\"] | \\. )+ (??{ $rx }) | " }x;
> q{"this thing is too slow} =~ m{ " (??{ $rx }) }x;
> print "done\n\n";
This becomes MUCH MUCH faster if you change $rx to
$rx = qr{ (?: [^\\"] | \\. ) (??{ $rx }) | " }x;
Note that there is no + quantifier on the (?:...) group.
--
Jeff Pinyan RPI Acacia Brother #734 RPI Acacia Corp Secretary
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: Thu, 13 May 2004 18:00:20 +0100
From: "iain" <irhm@clara.net>
Subject: Datetime overflow with DBI ODBC setting 19th century dates with placeholders
Message-Id: <40a3a98f$0$22316$4c56ba96@master.news.zetnet.net>
I'm trying to update 19th century dates in SQL Server.
It works fine with dates on or after 1 Jan 1900, but not before. It is also
OK if the 19th century dates are included as literals in the SQL INSERT or
UPDATE command (with $dbh->do or prepare/execute)
Error message: DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server
Driver]Datetime field overflow (SQL-22008)(DBD: st_execute/SQLExecute
err=-1) at Pat_DOB_error_report.pl line 13.
I've tried all kinds of options like bind_param, SQL_DATE, CAST(? as
datetime). It seems to be interpreted as a date, but the actual year is not
being processed correctly.
I'm not sure if this is a SQL Server or DBD::ODBC issue. I am using recent
versions of everything.
Any ideas for correction or workaround?
Example, using a table called Patients, which has a field called DOB, type
datetime.....
use DBI;
use strict;
my $dbserver="Myserver"; my $dbdatabase="MyDB"; my $dbWinAuth=1;
my $dsn="driver={SQL
Server};SERVER=$dbserver;DATABASE=$dbdatabase;trusted_connection=yes";
my $dbh = DBI->connect("dbi:ODBC:$dsn") or die "cannot connect to database:
$DBI::errstr \n";
$dbh->{AutoCommit}=1;
my $sth = $dbh->prepare("update Patients set DOB=? where PatientID=10");
$sth->execute('1900-01-01'); # works OK
$sth->execute('1799-12-31'); # gives error
------------------------------
Date: Thu, 13 May 2004 13:16:47 -0500
From: Web Surfer <raisin@delete-this-trash.mts.net>
Subject: Re: grep
Message-Id: <MPG.1b0d778ede247f7898981a@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <3988d00.0405120802.252bc16e@posting.google.com>,
zipper59er@yahoo.com says...
> the following script will parse records out of a log file.
>
> my second grep doesn't find any records when it should
> anybody know why (they exist in the file).
>
> -thanx in advance.
>
>
> #!/usr/bin/perl
>
> #make te function calls
> parse_lab_share ();
>
> sub parse_lab_share ()
> {
> my @ins;
> my @outs;
> my @fields;
> my $record;
> my $login_str;
> my $logout_str;
> my $i;
>
> unless ( open VNTILOG, "./vnti.log" )
> {
> die "Cannot open the vector log file: $!";
> }
> @ins = grep /VECGI/
> && !/ERROR/
> && !/Error/
> && !/Fragment/,
> <VNTILOG>;
> foreach ( @ins )
> {
> @fields = split;
> if ( $fields[14] eq "in" )
> {
> $login_str =
> "$fields[2]-$fields[1]-$fields[5]$fields[3]";
> $record =
> "$fields[23],$login_str,$fields[10],$fields[17]";
> @outs = grep /$fields[23]/, <VNTILOG>;
> foreach ( @outs )
> {
> @fields = split;
> print ( "$fields[23]\n" );
> }
> }
> }
>
Your 1st grep statement reads in *ALL* the records from the open file,
so the 2nd grep statement has nothing left to read.
------------------------------
Date: 13 May 2004 10:13:20 -0700
From: jkeen_via_google@yahoo.com (Jim Keenan)
Subject: Re: Help Me Understand this
Message-Id: <196cb7af.0405130913.5f61402d@posting.google.com>
"George Kinley" <georgekinley@hotmail.com> wrote in message news:<QaFoc.16263$k4.327971@news1.nokia.com>...
> Hi
> I am learning to use "Format" function , most of the things I can understand
> except how to write to different FILEHANDLE
> use FileHandle;
>
> OUTF->format_name("My_Other_Format");
>
> OUTF->format_top_name("My_Top_Format");
>
> I know this stunt works, but I cant understand how it works,
Let's first ask: Do you understand how to use Perl's built-in
select() function to change the default filehandle?
If not, then you probably shouldn't be attempting to use the more
complex, object-oriented interface provided by FileHandle.pm. What
are you attempting to accomplish that requires this approach as
opposed to select()?
Jim Keenan
------------------------------
Date: 13 May 2004 10:33:38 -0700
From: emaayan@hotmail.com (Elhanan Maayan)
Subject: help!! perl eats up my memory!!
Message-Id: <ec817d75.0405130933.15b284ed@posting.google.com>
hi..
i've written small program to test soap attachments against java axis:
it should run on a loop until it receive a response from the servie to
stop
use strict;
use SOAP::Lite;
use SOAP::MIME;
use MIME::Entity 50.01; #private module
use IO::Dir;
my $id=1;
my @files =glob "*.tiff";
my $count=0;
my $i=0;
my $index=0;
my $total=@files;
my $r=0;
do{
$index=$i % $total;
{
my $ent = MIME::Entity->build( (Path=> $files[$index],Id=> $id) );
my $som = SOAP::Lite
# ->readable(1)
->uri("urn:Testme")
->parts(($ent) )
->proxy("http://localhost:8080/axis/Testme.jws")
->echo(SOAP::Data->name("source")->attr( {'href'=>$id} ));
$r=$som->result;
}
$i++;
}while($r!=-99);
print "Total: $i";
when i looked at the task manager i kept seeing how the memory usage
is growing and growing, it was only released when the script ended..
any way to improve this?
i tried placing inner brackets inside the loop in order to force that
my variables go out of scope (didn't worked off course)..
------------------------------
Date: Thu, 13 May 2004 18:57:23 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Need Perl Equivalent for C ioctl Functions for Modem Control
Message-Id: <nyPoc.2020$Dz.162996@attbi_s52>
I have a problem with my mode, which I am controlling from
Device::SerialPort. It usually works (meaning I can run a Perl script that
uses my modem and it'll be able to control it easily). After the system
has rebooted, or after I've run minicom and exited, my Perl scripts can't
control the modem. If I rum minicom and quit without resetting the modem,
my Perl script works.
I figure there must be something in the modem that I have to set (or reset
or change) that I'm missing. I do not know C, but was able to go through
the minicom source (it's in C), and find out that when I exit, an extra
routine is run to reset the modem to previous settings. There is also an
opposite routine, to save settings (but no matter what the settings before
running minicom, whenever I run it and exit, my Perl script still won't
work).
Here's the part of the C code that gets the modem info:
tcgetattr(fd, &savetty);
ioctl(fd, TIOCGETP, &sg);
ioctl(fd, TIOCGETC, &tch);
ioctl(fd, TIOCLGET, &lsw);
ioctl(fd, TIOCMODG, &m_word);
And here's the part that restores it when I exit minicom:
tcsetattr(fd, TCSANOW, &savetty);
ioctl(fd, TIOCSETP, &sg);
ioctl(fd, TIOCSETC, &tch);
ioctl(fd, TIOCLSET, &lsw);
ioctl(fd, TIOCMODS, &m_word);
From my understanding, ioctl is changing the settings on the modem. I
figure if I knew what it was changing, I could make sure I set it to what
works for my Perl script in that script. I'm not clear if "tcgetattr" is
storing the ENTIRE modem configuration or not. It would help to know if it
does. Also knowing what is being changed in the ioctl calls (TIOCSETP,
TIOCSETC, TIOCLSET, TIOCMODS) would help, too. Can anyone tell me what the
program is doing or what settings would be the equivalent in working with
the modem in Device::SerialPort? While there are web pages with these
terms mentioned, they are always used in the context of people who already
know about them.
Thanks for any help!
Hal
------------------------------
Date: Thu, 13 May 2004 12:46:35 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Need Perl Equivalent for C ioctl Functions for Modem Control
Message-Id: <130520041246351771%jgibson@mail.arc.nasa.gov>
In article <nyPoc.2020$Dz.162996@attbi_s52>, Hal Vaughan
<hal@thresholddigital.com> wrote:
> I have a problem with my mode, which I am controlling from
[...]
>
> Here's the part of the C code that gets the modem info:
>
> tcgetattr(fd, &savetty);
> ioctl(fd, TIOCGETP, &sg);
> ioctl(fd, TIOCGETC, &tch);
> ioctl(fd, TIOCLGET, &lsw);
> ioctl(fd, TIOCMODG, &m_word);
>
> And here's the part that restores it when I exit minicom:
>
> tcsetattr(fd, TCSANOW, &savetty);
> ioctl(fd, TIOCSETP, &sg);
> ioctl(fd, TIOCSETC, &tch);
> ioctl(fd, TIOCLSET, &lsw);
> ioctl(fd, TIOCMODS, &m_word);
>
> From my understanding, ioctl is changing the settings on the modem.
tcsetattr and ioctl are changing settings in the terminal driver, not
the modem. There is very limited direct control of a modem, which is
probably attached to your computer via an RS-232 interface. Your
computer normally controls the modem by sending characters to it over
the serial line using "AT" commands.
> I
> figure if I knew what it was changing, I could make sure I set it to what
> works for my Perl script in that script. I'm not clear if "tcgetattr" is
> storing the ENTIRE modem configuration or not.
tcgetattr is saving the contents of the termios structure. See man 4
termios and /usr/include/sys/termois.h for details (if you are on a
unix system).
> It would help to know if it
> does. Also knowing what is being changed in the ioctl calls (TIOCSETP,
> TIOCSETC, TIOCLSET, TIOCMODS) would help, too.
The first four calls to ioctl are getting and saving the parameters,
special characters, local modes, and modem control state (see ioctl.h,
ioctl_compat.h, or ttycom.h). The next four are restoring these same
values. What exactly these are, I do not know.
> Can anyone tell me what the
> program is doing or what settings would be the equivalent in working with
> the modem in Device::SerialPort? While there are web pages with these
> terms mentioned, they are always used in the context of people who already
> know about them.
See "Advanced Programming in the UNIX Environment" by W. Richard
Stevens for an explanation of what some of the flags mean.
------------------------------
Date: 13 May 2004 11:46:20 -0700
From: krakle@visto.com (krakle)
Subject: Password scheme/Persistent session...
Message-Id: <237aaff8.0405131046.4e887b84@posting.google.com>
I'm creating members only service with perl (I will be using mod_perl)
for a busy web site. I need to create a Members Area that is pass
protected.
Originally I wanted to generate a random SID upon logging in and
storing the SID in mySQL and also creating a cookie on the users
computer to 'keep the user logged in'. However, I was told using
cookies may not be a good idea. So the idea of storing the SID in the
URL or hidden inputs arised. I really do not want to do this.
Is there anyways I can implement a password protected members area
with perhaps a persistent session without the use of cookies? Any
implementation ideas? I've seen sites like FaceTheJury.com which
validates a login and they don't have SIDs in the URL or cookies
created for this purpose.
Please don't suggesst .htpasswd it is out of the question being that
it does linear style lookups and I need more control over the
sessions.
------------------------------
Date: Thu, 13 May 2004 10:27:49 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl multiline command syntax
Message-Id: <slrnca74vl.94a.tadmc@magna.augustmail.com>
Nigel <s.usenet@nigel.com.au> wrote:
> I am trying to use perl to find and replace in a large text file but I
> cannot seem to get it to search over multiple lines.
Searching over multiple lines in not the problem.
Getting multiple lines to search over in the first place is the problem.
> # cat file.txt | perl -p - i -e
-p reads only one line at a time.
> I have tried many combinations
Try this one:
perldoc -q matching
I'm having trouble matching over more than one line. What's wrong?
> I have read everywhere about using /m but i
> dont understand where to use it.
Use it when you want ^ and $ to mean "begin/end of line" instead
of meaning "begin/end of string".
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 May 2004 11:21:17 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: PERL script to tidy e-mail
Message-Id: <20040513112038.I15402@dishwasher.cs.rpi.edu>
On Thu, 13 May 2004, Experienced but Undocumented wrote:
> Does anyone know of a PERL script to tidy up line breaks and quote marks (>)
> from e-mail message bodies?
>
> Thanks
Perl. Not PERL.
How about
http://search.cpan.org/~dconway/Text-Autoformat-1.12/lib/Text/Autoformat.pm
Paul Lalli
------------------------------
Date: Thu, 13 May 2004 16:44:56 GMT
From: "Experienced but Undocumented" <e01@removethis.toao.net>
Subject: Re: PERL script to tidy e-mail
Message-Id: <cCNoc.2860$9P6.2832@clgrps12>
> On Thu, 13 May 2004, Experienced but Undocumented wrote:
>
> > Does anyone know of a PERL script to tidy up line breaks and quote marks
(>)
> > from e-mail message bodies?
"Paul Lalli" <ittyspam@yahoo.com> wrote
> How about
>
http://search.cpan.org/~dconway/Text-Autoformat-1.12/lib/Text/Autoformat.pm
Thanks! Just what I needed.
------------------------------
Date: Fri, 14 May 2004 01:53:59 -0000
From: Edward Wijaya <ewijaya@singnet.com.sg>
Subject: Perldoc versus Man
Message-Id: <opr7yvj9cluj0cst@news.singnet.com.sg>
Hi,
Is there any content and usability difference between
perldoc and man.
I have only "man perl" at my Linux toolbox.
However accessing information about function
would not work as in perldoc.
Like: man perl -f sbstr
won't do
Can I access the direct explanation
of the particular function straight away from 'man'?
Or I need to install perldoc instead?
Thanks so much for your time.
Regards
Edward WIJAYA
SINGAPORE
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
------------------------------
Date: Thu, 13 May 2004 17:58:03 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perldoc versus Man
Message-Id: <x7d658ciqc.fsf@mail.sysarch.com>
>>>>> "EW" == Edward Wijaya <ewijaya@singnet.com.sg> writes:
EW> Is there any content and usability difference between
EW> perldoc and man.
EW> I have only "man perl" at my Linux toolbox.
EW> However accessing information about function
EW> would not work as in perldoc.
EW> Like: man perl -f sbstr
EW> won't do
EW> Can I access the direct explanation
EW> of the particular function straight away from 'man'?
EW> Or I need to install perldoc instead?
for basic printing of a perl doc page they are equivilent. there can be
some minor differences in formatting depending on the man and paging
program (more, less) used.
but perldoc does know about various parts of the docs that man doesn't
and that is what those extra options do. -f prints the doc for a single
function out of perlfunc which has dozens of entries. this is much nicer
than a full man page of the funcs. -q will do a search of the FAQ and
return relevent entries, another thing man can't do. but some man
systems have keyword search stuff (built in like man -k or added on like
glimpse). and there are many man reader programs (i like tkman (if only
it were written in perl!)) which make life easier too.
and there is also perldoc.com which has the perldocs for
multiple versions (which is useful) in html and searchable.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 13 May 2004 09:58:51 -0700
From: egoduk@hotmail.com (Edward)
Subject: running perl script in cron
Message-Id: <587a2724.0405130858.130ee52a@posting.google.com>
Can't seem to get this working.
Crontab entry:
55 17 * * * /usr/home/edward/perl/perfanalyser/plTest 2>&1
Script (plTest):
#!/usr/local/bin/perl
open TEST, ">>/usr/home/edward/perl/perfanalyser/test.txt";
print TEST "hello\n";
Cron job fails:
Your "cron" job on ldtcce04
/usr/home/edward/perl/perfanalyser/plTest 2>&1
produced the following output:
ld.so.1: /usr/local/bin/perl: fatal: libgdbm.so.2: open failed: No
such file or directory
Killed
Tried:
55 17 * * * su - edward /usr/home/edward/perl/perfanalyser/plTest 2>&1
Cron job fails:
our "cron" job on ldtcce04
su - edwardo /usr/home/edward/perl/perfanalyser/plTest 2>&1
produced the following output:
/usr/home/edward/perl/perfanalyser/plTest: open: command not found
/usr/home/edward/perl/perfanalyser/plTest: print: command not found
I added to edward's .profile:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/ccs/bin
export PATH
LD_LIBRARY_PATH=/usr/local/lib:enfinity0/oracle_client/lib
export LD_LIBRARY_PATH
Any ideas?
Thanks,
Edward
------------------------------
Date: 13 May 2004 17:11:23 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: running perl script in cron
Message-Id: <c80a7r$lmv$1@canopus.cc.umanitoba.ca>
In article <587a2724.0405130858.130ee52a@posting.google.com>,
Edward <egoduk@hotmail.com> wrote:
:Can't seem to get this working.
:55 17 * * * /usr/home/edward/perl/perfanalyser/plTest 2>&1
:Cron job fails:
:ld.so.1: /usr/local/bin/perl: fatal: libgdbm.so.2: open failed: No
:such file or directory
:I added to edward's .profile:
:PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/ccs/bin
:export PATH
:LD_LIBRARY_PATH=/usr/local/lib:enfinity0/oracle_client/lib
:export LD_LIBRARY_PATH
cron jobs are not interactive jobs, and don't automatically source
your .profile. Try
55 17 * * * . /usr/home/edward/.profile; /usr/home/edward/perl/perfanalyser/plTest 2>&1
--
Beware of bugs in the above code; I have only proved it correct,
not tried it. -- Donald Knuth
------------------------------
Date: Thu, 13 May 2004 10:23:47 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Skipping content in Array within loop and go to the next (of NEXT function)
Message-Id: <slrnca74o3.94a.tadmc@magna.augustmail.com>
Edward Wijaya <ewijaya@singnet.com.sg> wrote:
> On Thu, 13 May 2004 00:04:08 -0500, Tad McClellan <tadmc@augustmail.com>
> wrote:
>> Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>> What happened when you tried it?
> It excecute the array's contents and it doesn't
> give infinite loop. But the output is to large
> to check whether it satisfy the condition.
Then try it again with a smaller data set.
>> Have you read the documentation for next() ?
>>
>> perldoc -f next
> Not the man page, but the Camel Book (Chapter 2.6).
Don't do that.
Books are out of date before they are even published.
The docs that ship with perl are kept current, you should check
the std docs *first*.
The std docs are a required resource.
Books are merely a "nice to have" resource.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 May 2004 19:10:17 GMT
From: joe <jcharth@hotmail.com>
Subject: stunnel and slow perl cgi
Message-Id: <Xns94E89A376C7B9josephthecianet@207.69.154.202>
Hi I am running a demo of my webmail client
at http://www.wittyadmin.com
When i run the demo without stunnel the cgi works fast. when i run it using
stunnel it runs slow and sometimes i must submit forms a couple of times.
If i use sslwrap it gets even worse.
would this improve using the speedy back end?
I wonder how does webmin use stunnel to do the same thing with out
perfomance problems?
thanks
------------------------------
Date: Thu, 13 May 2004 19:49:15 GMT
From: joe <jcharth@hotmail.com>
Subject: Re: stunnel and slow perl cgi
Message-Id: <Xns94E8A0D236512josephthecianet@207.69.154.202>
client=no
socket = r:TCP_NODELAY=1
cert=/etc/webmin/miniserv.pem
connect=10.0.1.3:80
ok i found the problem nodelay does the trick
------------------------------
Date: 13 May 2004 15:20:19 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Time Complexity for substr() function
Message-Id: <c803nj$d2i$1@canopus.cc.umanitoba.ca>
In article <opr7ylpdkkuj0cst@news.singnet.com.sg>,
Edward Wijaya <ewijaya@singnet.com.sg> wrote:
:Any idea of the time complexity of the substr()
:in Perl?
:Is it under linear time?
:Any reference I can go to for that?
There's always the source...
perl knows the length of strings. Strings are stored as arrays
of characters, so whether you are going from the front or the back,
it's a fairly simple address calculation and length calculation.
Then it's just a matter of strncpy() and promoting the result
to a perl variable structure.
substr() is thus [near] constant-time with respect to the length of the
original string, and linear with respect to the length of the
extracted string.
However, this calculation goes out the window when you are using
unicode; I have never looked at the internal details of how
unicode is handled. substr() is defined in terms of characters,
not in terms of bytes, and the description of length() makes it clear
that the two are not the same.
--
Live it up, rip it up, why so lazy?
Give it out, dish it out, let's go crazy, yeah!
-- Supertramp (The USENET Song)
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6559
***************************************