[11719] in Perl-Users-Digest
Perl-Users Digest, Issue: 5319 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 7 12:07:13 1999
Date: Wed, 7 Apr 99 09:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 7 Apr 1999 Volume: 8 Number: 5319
Today's topics:
Beginner PERL Question, Inserting into Sql database coldfusion200029@my-dejanews.com
Re: Beginner PERL Question, Inserting into Sql database (Jonathan Stowe)
Re: buggy counter? (Sam Holden)
Re: buggy counter? <mis@sparc.spb.su>
Re: buggy counter? (Sam Holden)
Re: Debugger has problems with forking programs. (Randal L. Schwartz)
Re: Debugger has problems with forking programs. (Bart Lateur)
Re: duplicate checker (Abigail)
Enclosing a binary within perl <howard.pierce@medtronic.com>
Re: Enclosing a binary within perl (Sam Holden)
Re: flocking question - worried <c-denman@dircon.co.uk>
Re: flocking question - worried <c-denman@dircon.co.uk>
Re: flocking question - worried (Sam Holden)
Re: flocking question - worried <jdf@pobox.com>
Re: Hash help (Abigail)
Re: here docs vs qq quote operator. Just personal prefe <jeromeo@atrieva.com>
Re: HTML in email <aspinelli@ismes.it>
Inheriting functions from modules <mmcmahon@noshore.net>
Re: Installing CPAN modules <newsposter@cthulhu.demon.nl>
Re: Internal Timer <aqumsieh@matrox.com>
RE: LWP Request Discrepancy <dsaff@tvisions.com>
LWP::UserAgent timeout not working? (Dan Wilga)
Re: Monitoring the state of a serial port HELLLPPPPP <lucio@corp.netcom.net.uk>
Re: Monitoring the state of a serial port HELLLPPPPP (Jonathan Stowe)
Re: Most elegant random string generator? (Abigail)
Perl calls PGP cryptoman@my-dejanews.com
Perl run from IIS would not see an env variable? desafinado@jazzvalley.com
Re: random number ( -w ) <bradw@newbridge.com>
require on WinNT <ev@kzed.com>
Re: require on WinNT (David Turley)
Re: Sending a email using PERL <kmcfadden@claravista.com>
wanted: elegant inverse operation for vec <Wm.Blasius@ks.sel.alcatel.de>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Apr 1999 14:22:50 GMT
From: coldfusion200029@my-dejanews.com
Subject: Beginner PERL Question, Inserting into Sql database
Message-Id: <7efpni$3ut$1@nnrp1.dejanews.com>
I was wondering how to enter data in to a sql database, I have a bunch of
lists of users, and addresses that I wanted to enter into a Sql Database. I
have read that using the split command I can split the data and enter them
seperatly into the database.....but I am not sure exactl how this
works....please help!!!!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 07 Apr 1999 15:14:08 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Beginner PERL Question, Inserting into Sql database
Message-Id: <370b739d.25884322@news.dircon.co.uk>
On Wed, 07 Apr 1999 14:22:50 GMT, coldfusion200029@my-dejanews.com
wrote:
>I was wondering how to enter data in to a sql database, I have a bunch of
>lists of users, and addresses that I wanted to enter into a Sql Database. I
>have read that using the split command I can split the data and enter them
>seperatly into the database.....but I am not sure exactl how this
>works....please help!!!!
>
I'm not entirely sure what you mean so we're even ;-}
I am assuming that you have some character delimited file like:
usr_name|address|otherstuff
<etc>
You will need to *open* the file and read each row in a *while* loop
and *split* the row on the separator character.
All of the above hightlighted keywords are documented in the either
the perlop or perlfunc manpages.
However whern it comes to inserting this data into some unspecified
database it becomes more difficult. Generally you would use the DBI
interface if a DBD module is available for your database. Or possibly
if you are using windows Win32::ODBC module.
/J\
------------------------------
Date: 7 Apr 1999 12:00:52 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: buggy counter?
Message-Id: <slrn7gmi7k.sho.sholden@pgrad.cs.usyd.edu.au>
On Wed, 7 Apr 1999 15:40:32 +0400, Manida Ivan <mis@sparc.spb.su> wrote:
>Hello fellow perl wizards,
>
>a simple question that might be just some major misunderstanding on my
>side. Anyway, please tell me why the following simpliest counter
>(irrelevant parts left aside) resets the count to zero every few days or
>so (in general, it works allright):
No, it resets it to 1.
>
>#!/usr/bin/perl
>
>my $data_file = "../data/visits.cnt";
>
>open(COUNT,"$data_file") || die "can't open counter file";
>my $count = <COUNT>;
>close(COUNT);
>chop($count) if $count =~ /\n$/;
>
>$count++;
>
>open(COUNT,">$data_file") || die "couldn't write";
>&lock(COUNT);
>print COUNT "$count";
>&unlock(COUNT);
>close(COUNT);
>
>#and some functions
>
>my $file;
>sub lock {
> $file = @_;
> flock($file,2);
> seek($file, 0, 2);
>}
>
>sub unlock {
> $file=@_;
> flock($file,8);
>}
>
># end of functions
You don't lock the file for reading...
That the following can happen :
process A opens the file for reading
process A reads the file and gets a value of 112
process A closes the file
process A opens the file for writing truncating it at the same time
process A locks the file
process B opens the file for reading
process B reads the file and gets nothing (which becomes 1 when you ++ it)
since process B doesn't check try to lock the file it ignores
the lock that process A has...
process B closes file
process A writes 113 to file
process A closes file
proccess A now opens, locks, writes 1 to the file and closes it.
Even if you add locking to the read you will still have a race due to truncating
the file, and then locking it - so a process could read the empty file in the
before it gets locked...
What you should really do is read the documentation that comes with perl :
perlfaq5 : I still don't get locking. I just want to increment the number
in the file. How can I do this?
Might provide some light on the matter don't you think?
Also that chop stuff is a bit silly have a look at :
perldoc -f chomp
And anyway you never write a newline to the file so how can one get there?
Plus perl doesn't really care about the newline... the ++ cause it to be
dropped when the string gets converted into a number anyway...
--
Sam
Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work." --Larry Wall
------------------------------
Date: Wed, 7 Apr 1999 16:51:19 +0400
From: Manida Ivan <mis@sparc.spb.su>
Subject: Re: buggy counter?
Message-Id: <Pine.GSO.4.02.9904071648020.29274-100000@minerva.sparc.spb.su>
On 7 Apr 1999, Sam Holden wrote:
> You don't lock the file for reading...
>
> That the following can happen :
>
> process A opens the file for reading
> process A reads the file and gets a value of 112
> process A closes the file
> process A opens the file for writing truncating it at the same time
> process A locks the file
> process B opens the file for reading
> process B reads the file and gets nothing (which becomes 1 when you ++ it)
> since process B doesn't check try to lock the file it ignores
> the lock that process A has...
> process B closes file
> process A writes 113 to file
> process A closes file
> proccess A now opens, locks, writes 1 to the file and closes it.
How dumb could I be to miss that one :( Thanks! That really explains the
situation.
> Even if you add locking to the read you will still have a race due to truncating
> the file, and then locking it - so a process could read the empty file in the
> before it gets locked...
>
> What you should really do is read the documentation that comes with perl :
>
> perlfaq5 : I still don't get locking. I just want to increment the number
> in the file. How can I do this?
Oops, guess I missed that. Perl documentation is a huge one, I'll be sure
to pay more attention to it.
> Might provide some light on the matter don't you think?
>
> Also that chop stuff is a bit silly have a look at :
>
> perldoc -f chomp
>
> And anyway you never write a newline to the file so how can one get there?
> Plus perl doesn't really care about the newline... the ++ cause it to be
> dropped when the string gets converted into a number anyway...
Yup, you're absolutely right.
Really sorry for distracting you with such a simple question, and big
thankyou for the answer!
--
Ivan S. Manida
------------------------------
Date: 7 Apr 1999 13:15:48 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: buggy counter?
Message-Id: <slrn7gmmk4.t3r.sholden@pgrad.cs.usyd.edu.au>
On Wed, 7 Apr 1999 16:51:19 +0400, Manida Ivan <mis@sparc.spb.su> wrote:
>On 7 Apr 1999, Sam Holden wrote:
>
>> What you should really do is read the documentation that comes with perl :
>>
>> perlfaq5 : I still don't get locking. I just want to increment the number
>> in the file. How can I do this?
>
>Oops, guess I missed that. Perl documentation is a huge one, I'll be sure
>to pay more attention to it.
perl comes with a tool called perldoc which is really usefu for things
like this (it's not perfect and I'm sure TomC has a better script
somewhere...).
'perldoc -q <regular expression>' lists all the FAQS whose headings
match the regex. So 'perldoc -q lock' would have found that FAQ (and a few
others).
For more information on this tool every perl user should know well, try
the obvious :
perldoc perldoc
--
Sam
Remember that the P in Perl stands for Practical. The P in Python
doesn't seem to stand for anything.
--Randal Schwartz in <8cemsabtef.fsf@gadget.cscaper.com>
------------------------------
Date: 07 Apr 1999 06:40:19 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <m1lng45z24.fsf@halfdome.holdit.com>
>>>>> "William" == William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de> writes:
William> You send me mail, you get mail back and I don't have the slightest
William> notion of why you would care if the rest of the newsgroup knows if
William> you got an Email Cc: or not. If you're all that het up about it, I
William> suggest you just killfile all mails with Newsgroups: in the header
William> and be happy.
There's no necessary correlation between "Newsgroups:" in the mail
header (which isn't even a standard mail header!) and the fact that
it was also posted to Usenet. Please don't be so presumptuous.
This is Ilya's complaint, and mine as well. If someone stealth-cc's
me, it can really get my goat. Especially if I construct a lengthy
personal response, which I often do.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 07 Apr 1999 13:56:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <370c6342.610930@news.skynet.be>
William Blasius #42722 wrote:
>it seems you
>didn't even bother to read my previous posts (including one I Cc'd
>to you in response to your mail to me - that's 'C' as in courtesy,
>maybe you should look it up; try Webster's courtesy)
I'm not sure about that. I have also heard that "cc" comes from "carbon
copy". No courtesy in that.
That doesn't mean that people are free to be impolite. ;-)
Bart.
------------------------------
Date: 7 Apr 1999 15:01:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: duplicate checker
Message-Id: <7efrvg$6h9$1@client2.news.psi.net>
Surgie (SPAMBLOCKsurgie@bellsouth.net) wrote on MMXLIV September MCMXCIII
in <URL:news:ECvO2.4381$gv2.867068@news2.mco>:
?? I'm wondering if there was a built-in perl function to check if 2 arrays
?? have any of the same entries, and if not if anyone has a good function I
?? could use?
FAQ.
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
------------------------------
Date: Wed, 07 Apr 1999 07:06:46 -0500
From: Medtronic Employee <howard.pierce@medtronic.com>
Subject: Enclosing a binary within perl
Message-Id: <370B4A56.905F3510@medtronic.com>
I've dutifully searched the FAQs and the web and not found an answer to this
question,
so I'm posting it here:
The Question
--------------
Is there any way I can embed a binary within a perl script and have the perl
script execute
it? (either directly or by writing it to a file and then doing a "system" or
shell "open" on
that file)
What I've Tried
----------------
Defining a variable (with double and single quotes, and as a HERE document) to
contain
the binary (just reading it into the editor [vim] at that location). Using
double or single
quotes leads to unpaired quote problems and using HERE documents results in
"Can't
find string terminator "END-GREP-HERE-DOC" anywhere before EOF at test.pl
line 8."
Why I want to
---------------
Why would I want to do such a screwy thing? Because I'm stuck working on
Windows
machines, so I can't assume the users have "grep" installed (Cygnus win32 port
of GNU's
grep), yet I much prefer to use it over perl's own internal searching because
it's a lot
faster. Am I just stuck with slow searching?
If you have a solution, please email it to me at:
howard.pierce@medtronic.com
------------------------------
Date: 7 Apr 1999 12:52:52 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Enclosing a binary within perl
Message-Id: <slrn7gml93.t3r.sholden@pgrad.cs.usyd.edu.au>
[posted and mailed]
Medtronic Employee <howard.pierce@medtronic.com> wrote:
>I've dutifully searched the FAQs and the web and not found an answer to this
>question,
>so I'm posting it here:
>
>The Question
>--------------
>Is there any way I can embed a binary within a perl script and have the perl
>script execute
>it? (either directly or by writing it to a file and then doing a "system" or
>shell "open" on
>that file)
>
>What I've Tried
>----------------
>Defining a variable (with double and single quotes, and as a HERE document) to
>contain
>the binary (just reading it into the editor [vim] at that location). Using
>double or single
>quotes leads to unpaired quote problems and using HERE documents results in
>"Can't
>find string terminator "END-GREP-HERE-DOC" anywhere before EOF at test.pl
>line 8."
HERE documents won't work anyway since they _always_ add a newline on the
end (though I guess you could chom?p).
>
>Why I want to
>---------------
>Why would I want to do such a screwy thing? Because I'm stuck working on
>Windows
>machines, so I can't assume the users have "grep" installed (Cygnus win32 port
>of GNU's
>grep), yet I much prefer to use it over perl's own internal searching because
>it's a lot
>faster. Am I just stuck with slow searching?
Slow searching might be the best solution...
Using __END__ might be a way to imbed the binary in the script in a
readable fashion (since it would seperate it from the script...
Putting control characters and the like in the script sounds a bit
aweful to me, wouldn't want to ftp it in text mode...
You could also use something like :
perl -pe 's/(.)/sprintf "\\%o", ord $1/egs'
to convert the binary into an nicer form that will enable you to use it
as a normal string (you might want to remove the 's' on the end, since
that will be a _long_ line...).
Is there a reason you can't just distribute the grep binary with the
script.
--
Sam
We prefer English to remain a rich language, quirky, sloppy, and full
of redundancy. Same for Perl.
--Larry Wall
------------------------------
Date: Wed, 7 Apr 1999 13:06:58 +0100
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: flocking question - worried
Message-Id: <370b4a37@glitch.nildram.co.uk>
Fair enough, I had a bad morning.....
ChrisD
Sam Holden wrote in message ...
>On Wed, 7 Apr 1999 08:58:38 +0100, Chris Denman <c-denman@dircon.co.uk>
wrote:
>>Why has everyone jumped to the conclusion that I have written a page
.
.
.
------------------------------
Date: Wed, 7 Apr 1999 13:17:08 +0100
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: flocking question - worried
Message-Id: <370b4c9a@glitch.nildram.co.uk>
The database system has been custom written for the particular project.
Every record needs a unique reference number to make them easily accessable
from a web site. To get the next record number, I could count the number of
records, but this takes up too much server time - and the numbering of the
files isn't always linear. Records can be deleted, therefore leaving gaps.
The other problem is that each record is a separate file (there is a good
reason for this) so other files could be added in the mean time (I don't
think that you can flock a dir?)
Anyhows, if the server crashes, the flocked files become unlocked (as I have
just found out).
Also, this week (hopefully) our new dedicated server will be installed in
telehouse on a 150Mb pipe (mmmm) with 2Mb line from the office - can't wait
(loads of problems solved there!)
ChrisD
Sam Holden wrote in message ...
>On Wed, 7 Apr 1999 08:47:54 +0100, Chris Denman <c-denman@dircon.co.uk>
wrote:
>>Before you get on your high horse, the code in question is NOT a page hit
>>counter. The counter keeps track of records in a database and is
>>incremented as records are added.
>
>Wouldn't it make more sense for the database to keep track of how many
>records it has - since it needs to know anyway...
>
>>
>>Plus, the code never crashes, the server does (due to others sharing it).
>
>The as stated you have bigger problems. Getting a server that doesn't
>crash would be a good investment...
>
>--
>Sam
>
>In case you hadn't noticed, Perl is not big on originality.
> --Larry Wall
------------------------------
Date: 7 Apr 1999 13:02:56 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: flocking question - worried
Message-Id: <slrn7gmls0.t3r.sholden@pgrad.cs.usyd.edu.au>
On Wed, 7 Apr 1999 13:17:08 +0100, Chris Denman <c-denman@dircon.co.uk> wrote:
>The database system has been custom written for the particular project.
>Every record needs a unique reference number to make them easily accessable
>from a web site. To get the next record number, I could count the number of
>records, but this takes up too much server time - and the numbering of the
>files isn't always linear. Records can be deleted, therefore leaving gaps.
>
>The other problem is that each record is a separate file (there is a good
>reason for this) so other files could be added in the mean time (I don't
>think that you can flock a dir?)
Wouldn't it be simpler to have a server process that does this instead of
the database user processes doing it. Then the counter is simply kept in the
servers memory. When the server starts up it either reads the first number
to use from a file, or does a one time check for th highest used number. At
shut down it writes it to the file, or does nothing depending on which
system is used???
If there already is a server then why is it using a file to keep track
of the count instead of a few bytes of memory?
Of course you know the situation _much_ better than I do and
so probably have your reasons that make perfect sense. I'd be interested
to hear them I must admit...
I've used a program that put each record in a seperate file. I sure hope
you are using subdirectories based on some hashing function... 10000+
files in one directory does not a happy file system make...
--
Sam
the Emacs editor is horrible
--Linus Torvalds
------------------------------
Date: 07 Apr 1999 09:15:57 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: flocking question - worried
Message-Id: <m3emlwa7w2.fsf@joshua.panix.com>
"Chris Denman" <c-denman@dircon.co.uk> writes:
> I am relatively new to perl, but not new to programming - I have coded on
> z80 based processors up to programming the Sony Playstation.
But apparently you're new to Usenet.
> I asked a simple question where what the counter was for was not
> really relevant. I only asked whether a file that is locked stays
> locked after a crash.
You come to comp.lang.perl.misc and ask a question that has nothing
whatsoever to do with Perl, and then complain when you don't get
spoonfed. Silly troll.
> That as may be not a be a perl specific question, but many good perl
> programmers must have come across this sort of problem in the past (and
> yes, it is also platform dependent).
Many Perl programmers are also good cooks, but you don't see anyone
asking for tips on making omelettes, do you?
I've seen your other posts.
"Now, I should have found the appropriate command myself, but this
group is great for getting a quick response."
"I know this is not strictly a PERL question, but I have a query I
think many of you out there could helpme with."
"anyone got a rtf->html converter in perl?"
"Anyone know of a good GUI for perl?"
I'm not going to be trolled anymore. *plonk*
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 7 Apr 1999 15:04:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Hash help
Message-Id: <7efs60$6h9$2@client2.news.psi.net>
John Christena (john.christena@tivoli.com) wrote on MMXLIV September
MCMXCIII in <URL:news:370A4C43.83EB9336@tivoli.com>:
;; Hello. I have a hash that contains several scalar variables. I want to
;; reference members of this hash and have the value of the scalar
;; interpreted. Is this possible?
;;
;; Such as:
;;
;; $varname="list"
;; $hashname{$varname}=?
;;
;; I would like the hash to point to the variable $varname and be
;; recognized as that variable with the value of $varname. Any hints are
;; appreciated.. Thx.
Did you try? What happened when you tried?
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Wed, 07 Apr 1999 08:04:24 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <370B73F8.48DBF65F@atrieva.com>
Abigail wrote:
> Nah. It's as easy to change q{$foo} to qq{$foo} as it is to change
> "$foo" to q "$foo", or '$foo' to qq '$foo'.
OK, so its a poor example. It becomes a bit more problematic with
longer strings.
q{Abigail's JAPH said "Foo"};
qq{Abigail's JAPH said "$foo"};
Quote-like metacharacters are a Good Thing. Thats my story, and I'm
sticking to it.
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Wed, 07 Apr 1999 14:49:00 +0200
From: Andrea Spinelli <aspinelli@ismes.it>
Subject: Re: HTML in email
Message-Id: <370B543C.69B9F700@ismes.it>
Philip Newton wrote:
> You will probably also want to use a here-doc for this:
>
> print MAIL <<"EOMAIL";
> From:
> Subject:
> bla
> bla bla
> etc.
> EOMAIL
>
> Saves you having to type "print MAIL" and "\n" over and over again, and
> also keeps you from having to escape the quotation marks.
Philip did not say that you have variable-substitution within
here documents:
print MAIL <<"EOMAIL";
From: $in{'author'}
Subject: $a_variable_with_the_subject
Dear $recipient,
you seem to have forgotten that you bill was due on $date.
bla bla
etc.
EOMAIL
------------------------------
Date: Wed, 07 Apr 1999 15:21:59 GMT
From: Matt McMahon <mmcmahon@noshore.net>
Subject: Inheriting functions from modules
Message-Id: <rKKO2.57$x67.3516@news.shore.net>
I am putting together a web page for my company and am usng several perl
scripts for searches and whatnot of the pages contents. These scripts
have several functions in common that I am putting into their own module
that the other scripts will use. I want to make my new module use CGI.pm
and export the standard functions from there to whatever scripts use it.
The (non-working) code I have tried is:
package my_module;
use Exporter();
use CGI qw(:standard);
@ISA = qw(Exporter CGI);
@EXPORT = qw(func1, func2, ...) # I don't name any CGI.pm functions here
@EXPORT_OK = qw(func1, func2, ...)
.
.
.
the scripts that use it have
use my_module;
I am figuring that I need to export the CGI.pm functions somehow through
my_module.pm. The camel book hasn't helped me with this. Basically I
wan't to be able to use only my_module.pm and get all the functions of
my_module and CGI.pm. Any advice?
Thanks
Matt
------------------------------
Date: Wed, 07 Apr 1999 11:31:00 -0400
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Installing CPAN modules
Message-Id: <370B7A33.4760D5E@cthulhu.demon.nl>
Donny Widjaja wrote:
>
> Hi,
>
> I have a question about installing CPAN modules.
> I try to install a CPAN module on my virtual server (I am not a root and
> I can't be a root).
> I do it in the following step "perl Makefile.pl", "make" and 'make
> install PREFIX="usr/local"'.
>
> The problem occurs in the 'make install PREFIX="usr/local"', and these
> are the output that I got.
[snip]
Try specifying the prefix as an absolute path, something like
PREFIX=/home/xxx/user/local
or whatever the path to the directory you want to use is
Erik
------------------------------
Date: Wed, 7 Apr 1999 10:55:29 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Internal Timer
Message-Id: <x3yaewko4ys.fsf@tigre.matrox.com>
joe <eule@halifax.rwth-aachen.de> writes:
> Alvin Yong wrote:
> >
> > Hi,
> > I need some urgent help in perl...I wonder if I cld use an internal timer
> > function or code one so I can execute my main program every 5 mins, do I
> > have resort to writing a very large loop
> I solved the same problem some days ago with a short loop using time():
>
> $Time = time;
> while((time - $Time) <= 5) #5 == 5 sec.
> {
> }
>
> It's not nice, but it works. I'm still searching for a better solution
> ...
>
> Joe
Yukh ... you should be using sleep() .. or maybe even alarm().
perldoc -f sleep
perldoc -f alarm
HTH,
Ala
------------------------------
Date: Wed, 7 Apr 1999 08:15:34 +0100 (Eas)
From: David Saff <dsaff@tvisions.com>
Subject: RE: LWP Request Discrepancy
Message-Id: <14091.1558.107000.323184@gargle.gargle.HOWL>
> I was trying out LWP on diffrent URL's but what caught my attention
> was the fact that the simple get method
>
> $res = get('http://www.yahoo.com/r/ar');
>
> worked on a spesific URL above, and many more from the Yahoo site, while
> the more robust $ua->request method
>
> $res = $ua->request(HTTP::Request->new(GET =>
> 'http://www.yahoo.com/r/ar'));
>
> failed?
It's hard to know exactly what's happening there. First, I assume
that you are using HTTP::Request::Common, in which case 'get' whould
be 'GET' in the first method.
Second, if that's true, although you have two variables named $res,
they hold different values: the first $res holds an HTTP::Request
object, and the second holds an HTTP::Response object. (see the code below)
Your post lacks several elements that would have made it easier to
respond to:
1) A completely runnable piece of code to test.
2) Your version of Perl and OS.
For me, trying this piece of code works as expected on my system:
>>> start code <<<
#!perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use strict;
my $ua = new LWP::UserAgent;
my $res = GET('http://www.yahoo.com/r/ar');
print "------ONE------\n" . $ua->request($res)->content;
my $res2 = $ua->request(HTTP::Request->new(GET => 'http://www.yahoo.com/r/ar'));
print "------TWO------\n" . $res2->content;
>>> end code <<<
My system is (from `perl -v`, running on Windows NT):
>>> version <<<
This is perl, version 5.005_02 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-1998, Larry Wall
Binary build 509 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 13:37:15 Jan 5 1999
>>> end version <<<
Share and Enjoy,
David Saff
TVisions
------------------------------
Date: Wed, 07 Apr 1999 10:38:15 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: LWP::UserAgent timeout not working?
Message-Id: <dwilgaREMOVE-0704991038150001@wilga.mtholyoke.edu>
I just installed libwww-perl-5.42 and am having problems with
LWP::UserAgent taking far too long to timeout for a host that is not
responding. Instead of taking the 15 seconds I'm asking it to, it takes
about 13 minutes. I tested this URL with Netscape, and it took the
customary couple of minutes to timeout.
I am also using HTML-Parser-2.22, MIME-Base64-2.11, URI-1.02, and
libnet-1.0606. This is a Linux machine running Perl 5.005_02.
Here is a sample:
use LWP::UserAgent;
use HTTP::Request;
my $ua = new LWP::UserAgent;
$ua->timeout(15); # 15 seconds
my $req = new HTTP::Request 'HEAD' =>
'http://falcon.eku.edu/honors/beyond-mla/';
my $res = $ua->request($req);
print "Got ".$res->status_line."\n";
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Wed, 07 Apr 1999 16:08:43 +0100
From: Lucio Godoy <lucio@corp.netcom.net.uk>
Subject: Re: Monitoring the state of a serial port HELLLPPPPP
Message-Id: <370B74FB.32CFA923@corp.netcom.net.uk>
plz hellllllppppppp
Lucio Godoy wrote:
>
> Hi All;
>
> I would like to monitor the state of my serial port, for instance:
>
> if port is high or 1 do something and when the port is low or 0 do
> something else.
>
> But i dont know how to interact with the serial ports. I use a linux
> box, /dev/ttyS0.
>
> How can i do that, plz ?
>
> THank you
>
> Lucci
--
==========================
Lucio Godoy
Netcom Internet Limited
http://www.netcom.net.uk
Tel:01344 395500
==========================
------------------------------
Date: Wed, 07 Apr 1999 15:32:40 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Monitoring the state of a serial port HELLLPPPPP
Message-Id: <370b7a04.27522917@news.dircon.co.uk>
On Wed, 07 Apr 1999 16:08:43 +0100, Lucio Godoy
<lucio@corp.netcom.net.uk> wrote:
>plz hellllllppppppp
>
>Lucio Godoy wrote:
>>
>> Hi All;
>>
>> I would like to monitor the state of my serial port, for instance:
>>
>> if port is high or 1 do something and when the port is low or 0 do
>> something else.
>>
>> But i dont know how to interact with the serial ports. I use a linux
>> box, /dev/ttyS0.
>>
>> How can i do that, plz ?
>>
Ok calm down - I would go and read the perlfaq8 manpage wherein it
hath a section entitled:
=head2 How do I read and write the serial port?
which goes into some detail on this matter.
/J\
------------------------------
Date: 7 Apr 1999 15:13:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Most elegant random string generator?
Message-Id: <7efsnc$6h9$3@client2.news.psi.net>
Tramm Hudson (hudson@swcp.com) wrote on MMXLV September MCMXCIII in
<URL:news:7eea79$j56@llama.swcp.com>:
@@
@@ Anyway, here is my version of the program:
@@
@@ #!/usr/bin/perl -w
@@ use strict;
@@
@@ my $len = shift || 10;
@@ my @chars = ( 0..9 , 'A'..'Z', 'a'..'z' );
@@ my $key = join '', map { $chars[rand @chars] } (1..$len);
@@ print "$key\n";
@@ __END__
@@
@@ Or is that too obfuscated? Any better ideas Abigail?
For weird values of 'better':
my @chars = (0 .. 9, 'A' .. 'Z', 'a' .. 'z');
(my $key = 0 x (shift || 10)) =~ s/0/$chars[rand @chars]/ge;
print $key, "\n";
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: Wed, 07 Apr 1999 13:27:53 GMT
From: cryptoman@my-dejanews.com
Subject: Perl calls PGP
Message-Id: <7efmgj$1c8$1@nnrp1.dejanews.com>
Hi,
I am trying to write Script to call PGP's functions:
open (WRITEME, "|pgpv message.sig -o message");
print WRITEME "\n";
close (WRITEME);
It should force a Carriage Return when PGP asks:
"File to check signature against [message]: "
But it doesn't work. I tried the same script on "rm -i test.txt" and it
works. Could u tell me is there any probleme with PGP or do I have to do it a
different way.
Thanks!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 07 Apr 1999 15:21:20 GMT
From: desafinado@jazzvalley.com
Subject: Perl run from IIS would not see an env variable?
Message-Id: <7eft59$6vo$1@nnrp1.dejanews.com>
Hi everybody,
I am running a web server using the following system:
OS: NT 4.0
HTTP server: IIS 3.0
Perl: ActiveState Perl 5.004
As an administrator, I have created an environment variable
called PERL5LIB containing an additional libraries root for Perl.
Perl perfectly recognizes it when I ask $ENV{'PERL5LIB'}
or when I ask @INC.
Perl run under IIS would recognize it neither as $ENV{'PERL5LIB'}
(it says "") nor in @INC (it does not list the value of $ENV{'PERL5LIB'}).
What is the problem?
Thank you,
Vic.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 07 Apr 1999 11:06:28 -0400
From: bj <bradw@newbridge.com>
Subject: Re: random number ( -w )
Message-Id: <op1iub8ii6j.fsf@newbridge.com>
sholden@pgrad.cs.usyd.edu.au (Sam Holden) writes:
> On Wed, 07 Apr 1999 10:31:53 GMT, IndexFinger.com <indexfinger@usa.net> wrote:
> >> I'm now going to assume you are joking...
> >
> >I'm not.
>
> Well read your own bloody documentation then. I'm not going to tell you
> the answer to a question that is answered in the documentation you
> have.
Sounds like he is not going to warn you again....
bj
------------------------------
Date: Wed, 7 Apr 1999 10:19:01 -0400
From: "Eddy Viscous" <ev@kzed.com>
Subject: require on WinNT
Message-Id: <7efpkb$245@news-central.tiac.net>
Hello All,
I'm trying to require some files from a script running on a WinNT server.
The require statement works fine on UNIX machines but not on NT. The
require statement simply can't see the files. Is there something
fundamentaly different about an NT machine that would cause this to happen?
Thanks
EV
------------------------------
Date: Wed, 07 Apr 1999 14:28:05 GMT
From: dturley@binary.net (David Turley)
Subject: Re: require on WinNT
Message-Id: <370b6a3a.11371279@news.erols.com>
On Wed, 7 Apr 1999 10:19:01 -0400, "Eddy Viscous" <ev@kzed.com> wrote:
>Hello All,
>I'm trying to require some files from a script running on a WinNT server.
>The require statement works fine on UNIX machines but not on NT. The
>require statement simply can't see the files. Is there something
>fundamentaly different about an NT machine that would cause this to happen?
Where are you putting the require'd files? require works fine for me
on NT. I usually put the require'd files int he same dir as the
script.
If you don't, you'll either need to give the path to the file, or
alter @INC.
use lib '/absolute/path/to/files/';
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley/
------------------------------
Date: Wed, 07 Apr 1999 13:39:45 GMT
From: Kevin <kmcfadden@claravista.com>
Subject: Re: Sending a email using PERL
Message-Id: <7efn70$1sf$1@nnrp1.dejanews.com>
Please check the CPAN archives for various mail/mime modules which make this
whole business much easier. For instance:
ftp://ftp.spu.edu/pub/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/M
IME/MIME-Lite-1.130.tar.gz
is excellent and extremely useful for sending attachments, too. You don't
need to send mail through sendmail (you could use another mail host, for
instance).
Kevin
In article <yO6N2.1536$04.1237@stones>,
"Sandwell" <JK@sandwell98.free-online.co.uk> wrote:
> I am writing a script which requires sending a email to the web master. I
> have tried the following script, without much luck. I have pasted the FULL
> script, if you could be give me an ideas??
>
> #!/usr/bin/perl -w
>
> $to='graeme\@sandwell98.free-online.co.uk';
> $from='graeme\@sandwell98.free-online.co.uk';
> $subject='Thank you for your inquiry';
> $text='Dear reader\n\nThank you for your recent inquiry.';
>
> &email($to,$from,$subject,$text);
>
> sub email {
> local($to,$from,$sub,$letter) = @_;
> $to=~s/@/\@/;
> $from=~s/@/\@/;
> open(MAIL, "|/usr/sbin/sendmail") || die
> "Content-type: text/text\n\nCan't open /usr/lib/sendmail!";
> print MAIL "To: $to\n";
> print MAIL "From: $from\n";
> print MAIL "Subject: $sub\n";
> print MAIL "$letter\n";
>
> Thank-You for you help,
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 07 Apr 1999 14:15:58 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: wanted: elegant inverse operation for vec
Message-Id: <370B4C7E.167EB0E7@ks.sel.alcatel.de>
Greetings:
the Subject pretty much says it all. I'm trying to come up with an
elegant way to turn a sparse bitfield into a set of "bit numbers".
ie: 00100100 becomes 2 5
I'd happily settle for an algorithm to get the number for a single
bit, but I'm having a bit of a bad brain day. There must be a good
popular idiom for this, iteration seems so...so...so...repetitive!
TIA
Wm Blasius
Stuttgart
--
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5319
**************************************