[16405] in Perl-Users-Digest
Perl-Users Digest, Issue: 3817 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 27 03:05:40 2000
Date: Thu, 27 Jul 2000 00:05:14 -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: <964681514-v9-i3817@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 27 Jul 2000 Volume: 9 Number: 3817
Today's topics:
Re: CGI passing parameters <glodalec@yahoo.com>
Re: CGI passing parameters (Prasanth A. Kumar)
Re: CGI->new(*FORM) Problem... (David Efflandt)
Re: cperl-mode.el (Ilya Zakharevich)
Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
Re: difference between two times in seconds (Logan Shaw)
Re: difference between two times in seconds <uri@sysarch.com>
Re: difference between two times in seconds (Gwyn Judd)
Re: difference between two times in seconds (Logan Shaw)
Re: difference between two times in seconds (Logan Shaw)
Re: Do I Need Chomp? <was Critiques, please> (Decklin Foster)
Does anybody know how to use ptkdbw? <fgeiger@datec.at>
Does anybody know how to use ptkdbw? <fgeiger@datec.at>
Re: exactly WHEN will PP-3rd be in bookstores, etc? An (David Combs)
Re: Formatting text file (Bernard El-Hagin)
HTTP/1.1 404 Object Not Found ... The system cannot fin (Nils-Eric Pettersson)
Newbie needs HELP... NET::TELNET <spiro.theologo@getronics.com>
newbie question, can a perl program run 24/7 drdementor@my-deja.com
Re: newbie question, can a perl program run 24/7 (Decklin Foster)
Re: newbie question, can a perl program run 24/7 (David Efflandt)
Re: newbie question, can a perl program run 24/7 (Philip 'Yes, that's my address' Newton)
Re: Nobody loves me? (Doma)
Re: Nobody loves me? (Abigail)
Re: plotting graph <dvoon@my-deja.com>
Search Question <lenny123@redhotant.com>
Re: Warnings and undefs (John M. Gamble)
Re: Warnings and undefs (John M. Gamble)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Jul 2000 07:09:10 +0200
From: Mouse <glodalec@yahoo.com>
Subject: Re: CGI passing parameters
Message-Id: <397FC3F6.DDD@yahoo.com>
Eelke Kleijn wrote:
>
> instead of using:
> /cgi-bin/GETFILE
> you could use:
> /cgi-bin/GETFILE?file=$file&num=$num;
>
> The the GETFILE (supposing it is a cgi file) could retrieve the parameters
> bij using the url_param() function, which is used in the same way as the
> param() function.
>
> Hope this helps,
> Eelke Kleijn
>
> "Mouse" <glodalec@yahoo.com> schreef in bericht
> news:397ED6FF.4BF@yahoo.com...
> > Hi !
> >
> > I have main CGI script called MAIN. It receive two parameters,
> > file and num (/cgi-bin/MAIN?file=myfile&num=100)
> >
> > #!/usr/local/bin/perl
> > use CGI qw/:standard/;
> > $file=param('file');
> > $num=param('num');
> > ...
> > @ARRAY=`/cgi-bin/GETFILE';
> > foreach $X (@ARRAY)
> >
>
> > print $X;
> > }
> > ...
> >
> > As you have noticed, I call another perl program called GETFILE.
> > How can I pass parameters from MAIN to GETFILE ?
> > I don't like
> > '/cgi-bin/GETFILE ' . $file . ' ' . $num
> > and then asking for ARGV[]
> > If its possible, I would like to use the same param('<name>') in
> > GETFILE.
> >
> > Any hints ?
> >
> >
> > Alex
/cgi-bin/GETFILE?file... cannot be run, because command will not be
found. There should not be ? char after GETFILE.
Alex
------------------------------
Date: Thu, 27 Jul 2000 06:03:13 GMT
From: kumar1@home.com (Prasanth A. Kumar)
Subject: Re: CGI passing parameters
Message-Id: <m3n1j4yusf.fsf@C654771-a.frmt1.sfba.home.com>
Mouse <glodalec@yahoo.com> writes:
> Eelke Kleijn wrote:
> >
> > instead of using:
> > /cgi-bin/GETFILE
> > you could use:
> > /cgi-bin/GETFILE?file=$file&num=$num;
> >
> > The the GETFILE (supposing it is a cgi file) could retrieve the parameters
> > bij using the url_param() function, which is used in the same way as the
> > param() function.
> >
> > Hope this helps,
> > Eelke Kleijn
> >
> > "Mouse" <glodalec@yahoo.com> schreef in bericht
> > news:397ED6FF.4BF@yahoo.com...
> > > Hi !
> > >
> > > I have main CGI script called MAIN. It receive two parameters,
> > > file and num (/cgi-bin/MAIN?file=myfile&num=100)
> > >
> > > #!/usr/local/bin/perl
> > > use CGI qw/:standard/;
> > > $file=param('file');
> > > $num=param('num');
> > > ...
> > > @ARRAY=`/cgi-bin/GETFILE';
> > > foreach $X (@ARRAY)
> > >
> >
> > > print $X;
> > > }
> > > ...
> > >
> > > As you have noticed, I call another perl program called GETFILE.
> > > How can I pass parameters from MAIN to GETFILE ?
> > > I don't like
> > > '/cgi-bin/GETFILE ' . $file . ' ' . $num
> > > and then asking for ARGV[]
> > > If its possible, I would like to use the same param('<name>') in
> > > GETFILE.
> > >
> > > Any hints ?
> > >
> > >
> > > Alex
> /cgi-bin/GETFILE?file... cannot be run, because command will not be
> found. There should not be ? char after GETFILE.
>
> Alex
When I first started using the Perl CGI module, I was quite surprized
that there isn't a function included to encode an url like as follows:
(this is from memory so there might be a syntax error or two...)
a({-url=>encode_url("/cgi-bin/submit.pl",
key=>$row[0],
foo=>$row[1])}, $row[0])
Basically, I might be doing this while forming a table from rows
fetched from a sql database where each table row has a link to another
cgi script to which associated parameters from the row are passed.
I ended up creating such a function encode_url myself which takes a
base url and the remaining parameters are hash pairs which form the
keys and values which are encoded and concated to the base url and
returned as a string.
While this function is only a few lines of code, I wonder why such a
useful function isn't included? Is there already a suitable function
in the Perl CGI module which I am missing?
--
Prasanth Kumar
kumar1@home.com
------------------------------
Date: Thu, 27 Jul 2000 05:38:11 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: CGI->new(*FORM) Problem...
Message-Id: <slrn8nvilv.h8o.efflandt@efflandt.xnet.com>
On Wed, 26 Jul 2000 09:24:12 -0400, Phil Zampino <zampino@squidco.com> wrote:
>In article <slrn8nsjf8.eb1.efflandt@efflandt.xnet.com>,
>efflandt@xnet.com wrote:
>
>> >I'm trying to write better Perl by switching a routine I have handled
>> >manually to Perl/CGI.
>> >
>> >The routine stores off the current form passed to a CGI program then
>> >calls an authorization routine, which eventually re-calls the original
>> >CGI program. When the program is re-called it looks for the presence of
>> >the stored form file, and if it exists and the user is now authorized it
>> >reloads the form data.
>
>> >The problem is that on returning to the CGI program, my restore doesn't
>> >seem to bring back the form data, but instead some kind of HASH value- I
>> >can't figure out how to properly read it back in using Perl/CGI
>> >techniques. I've tried 23 permutations of loading the data back in
>> >(FORMS, *FORMS, \*FORMS) and I've looked at umpteen sites on the web on
>> >how to do this. While I've seen specific techniques for pulling back
>> >the form data and manually parsing the stored data, I've seen no generic
>> >method for restoring the stored data back into a CGI form available to
>> >my program.
>> >
>> >Can anyone tell me what I'm doing wrong, or what the trick is to
>> >restoring this data?
>>
>> Not quite, try:
>>
>> $q = new CGI(FORMS);
>> print "Query Variables",$q->p;
>> foreach ($q->param) { print "$_ = ",$q->param($_),$q->br; }
>
>
>That works great, but introduces a new mystery to me... previously I
>could refer to my form variables as param('myVar') in my calling
>program. That still works if the user is authorized and the form is
>restored by the same invocation of my local authorization routine.
>
>However, if the real authorization program is called and my perl routine
>is called again, then the calling program no longer can refer to
>param("myVar") but must use $query->param("myVar"). The latter works in
>both cases, so I suppose I should just use that syntax always, but I'm
>curious why I can get away with param("myVar") when the authorization
>program is not called.
>
>To try to explain that better:
>
>(1)
>myProg->localAuth
> localAuth->auth_check #user is authorized
>myProg can use param("myVar")
>
>BUT
>
>(2)
>myProg->localAuth
> localAuth->auth_check # user is NOT authorized
> auth_check->authenticate
> authenticated->myProg # now go to (1)
>myProg must use $query->param("myVar")
Apparently you are using function method to originally get the data from
the form, so param('foo') works, but when you save it to a file and then
reload it, I think you have to use object method ($query->param('foo')) or
at least if you want to distinguish just submitted params from params
loaded from a file. I have used an array to load multiple sets of data:
$i = 0;
while (!eof(FILE)) { $q[$i++] = new CGI(FILE); }
foreach $q (@q) {
foreach ($q->param) {
print "$_ = ",$q->param($_),"\n";
}
print "\n";
}
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: 27 Jul 2000 04:14:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: cperl-mode.el
Message-Id: <8locvn$pqr$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was NOT sent to Kai Großjohann
<Kai.Grossjohann@CS.Uni-Dortmund.DE>],
who wrote in article <vafaefbk73r.fsf@lucy.cs.uni-dortmund.de>:
> On Thu, 20 Jul 2000, Sam Lay wrote:
>
> > BTW, how do you locate unbalanced parens, etc. in an elisp source?
>
> Go to beginning of buffer, hold down C-M-n till Emacs beeps.
I use the following:
(global-set-key [C-M-right] 'up-list)
(global-set-key-wise [C-M-left] '(up-list -1))
These move you out of enclosing block. So go to the beginning, nad
use C-M-right.
Ilya
------------------------------
Date: Wed, 26 Jul 2000 20:59:02 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <0ec4c663.445c56a8@usw-ex0108-061.remarq.com>
Abigail, my record looks like this:
<p align=center><font size="1">Reference:
964062454<br>.....
I need to extract the reference number 9xxxxxxxx and then
compare with the time(). Reference no was also obtained
from time() at the time of posting. In the following code,
if the difference is greater than 3 days, the record will
be deleted. I first use the separator "Reference: " and
then separate again using "<BR>". Then I get the ref no
from the left-hand side. If the condition is true, the
first record is deleted. The loop is then repeated. I
believe the code is inefficient. Care to correct it? TIA.
$threedays = 3*86400;
open(old, "<$base\\$dbold");
open(new, ">$base\\$dbnew");
flock(old, 2);
flock(new, 2)
select(new);
while (<old>)
{
chomp;
@pare=split(/Reference: /);
@reference=split(/<br>/);
$datethen=$reference[0];
$difference = time() - $datethen;
if ($difference > $threedays)
{
next if 1;
seek(old,0,0);
seek(new,0,2);
print new $_;
}
flock(old, 8);
flock(new, 8);
close(old);
close(new);
rename($old, "$base\\dbnew");
rename($new, "$base\\dbold");
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Wed, 26 Jul 2000 23:07:34 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <0590a25e.65e37a07@usw-ex0108-061.remarq.com>
Sorry, reposting because the HTML tags didn't show up.
Ignore the double quotation marks. The record looks like
this:
" <p align=center><font size="1">Reference:
964062454<br>..."
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Wed, 26 Jul 2000 23:12:23 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <00019ddb.6724ab58@usw-ex0108-061.remarq.com>
Here's the chomp part again (ignore the double quotation
marks):
"
chomp;
@pare=split(/Reference: /);
@reference=split(/<br>/);
$datethen=$reference[0];
"
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Wed, 26 Jul 2000 23:23:47 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <049504fe.6a1e1707@usw-ex0108-061.remarq.com>
Hope everything show's up ok now:
{
chomp;
@pare=split(/Reference: /);
@reference=split(/<br>/);
$datethen=$reference[0];
}
Record (ignore {} brackets):
{
<p align=center><fonr size="1">Reference: 964062454<br>
}
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: 27 Jul 2000 01:10:46 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8lojp6$o20$1@provolone.cs.utexas.edu>
In article <8lnsh4$ml7$1@provolone.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
>But as long as we're avoiding using the built-in operators, I think
>this is more fun:
>
> sub datediff
> {
> @_ = @_;
> push (@_, shift) if $_[0] > $_[1];
>
> --$_[1] while $_[0]--;
> pop;
> }
By the way, in case nobody noticed, the "@_ = @_" section
really is necessary. I was hoping someone would comment
on it, partly because although I *think* understand why,
I'm not sure. Anyway, if I run this loop:
foreach my $foo ( 0 .. 10 )
{
print "10 minus $foo is ", &datediff(10,$foo), "\n";
}
I get this:
10 minus 0 is 10
10 minus 1 is 9
10 minus 2 is 8
10 minus 3 is 7
10 minus 4 is 6
10 minus 5 is 5
10 minus 6 is 4
10 minus 7 is 3
10 minus 8 is 2
10 minus 9 is 1
10 minus 10 is 0
but if I comment out the "@_ = @_", I get this:
10 minus 0 is 10
10 minus 1 is 9
10 minus 2 is 8
10 minus 3 is 7
10 minus 4 is 6
10 minus 5 is 5
10 minus 6 is 4
10 minus 7 is 3
10 minus 8 is 2
10 minus 9 is 1
Modification of a read-only value attempted at /tmp/foo.pl line 6.
Is $_[0] secretly some kind of reference into the caller's
argument list or something? And why does setting @_ to
itself clear this status?
Just curious...
- Logan
------------------------------
Date: Thu, 27 Jul 2000 06:23:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: difference between two times in seconds
Message-Id: <x74s5c6qh6.fsf@home.sysarch.com>
>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
LS> In article <8lnsh4$ml7$1@provolone.cs.utexas.edu>,
LS> Logan Shaw <logan@cs.utexas.edu> wrote:
>> sub datediff
>> {
>> @_ = @_;
>> push (@_, shift) if $_[0] > $_[1];
>>
>> --$_[1] while $_[0]--;
>> pop;
>> }
LS> By the way, in case nobody noticed, the "@_ = @_" section
LS> really is necessary. I was hoping someone would comment
LS> on it, partly because although I *think* understand why,
LS> I'm not sure. Anyway, if I run this loop:
LS> but if I comment out the "@_ = @_", I get this:
LS> Modification of a read-only value attempted at /tmp/foo.pl line 6.
LS> Is $_[0] secretly some kind of reference into the caller's
LS> argument list or something? And why does setting @_ to
LS> itself clear this status?
read perlsub. @_ is aliased to the args passed to a sub. assigning @_
does a copy of the real values. reusing @_ for the copy is just subterfuge
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 27 Jul 2000 06:32:26 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: difference between two times in seconds
Message-Id: <slrn8nvm1j.1o5.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>There's nothing that can't be solved with a regex.
I wonder if this is really true though. My copy of the Dragon Book (you
know the compiler design one) says that the things that cannot be
matched by a regex include:
1) sets of balanced parentheses (probably true)
2) repeating strings eg. wcw where "w" is a string consisting of 'a's
and 'b's (don't know if I believe that one myself eg /([ab]+)c\1/)
3) regular expressions can be used to denote only a fixed number of
repetitions or an unspecified number of repetitions (he then goes on to
say "two arbitrary numbers cannot be compared to see whether they are
the same which is patently bullcr*p so I'm probably not understanding
it). He says that we cannot describe a Hollerith string from early
versions of fortran of the form "nHa1a2a3...an" because the number of
characters following the H must match the decimal number before H.
Comments?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I'm glad I was not born before tea.
-- Sidney Smith (1771-1845)
------------------------------
Date: 27 Jul 2000 01:32:26 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8lol1q$o58$1@provolone.cs.utexas.edu>
In article <x74s5c6qh6.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
>
> LS> Is $_[0] secretly some kind of reference into the caller's
> LS> argument list or something? And why does setting @_ to
> LS> itself clear this status?
>
>read perlsub. @_ is aliased to the args passed to a sub. assigning @_
>does a copy of the real values. reusing @_ for the copy is just subterfuge
O.K., but I'm still curious why it works in 10 out of the 11 cases. It
seems like in 9 out of the 10 cases where it does work, it's modifying
both values anyway. So why does it suddenly break only when $_[0] hits
zero?
- Logan
------------------------------
Date: 27 Jul 2000 01:47:59 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8loluv$o6f$1@provolone.cs.utexas.edu>
In article <slrn8nvm1j.1o5.tjla@thislove.dyndns.org>,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could Abigail <abigail@foad.org>
>say such a terrible thing:
>
>>There's nothing that can't be solved with a regex.
>
>I wonder if this is really true though. My copy of the Dragon Book (you
>know the compiler design one) says that the things that cannot be
>matched by a regex include:
One thing regular code can do that a regular expression can't do (as
far as I know) is to have an infinite loop.
However, before someone comes along and points out the flaw in that
statement, I'll add the stipulation that the regular expression must be
of a finite length, i.e. it's no fair to write this:
/1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16 . . .
Of course, this infinite length regular expression would have to have
an infinite length string to match against.
As long as we're coming up with regular expression challenges, I want
to see somebody write a regular expression to find the prime
factorization of an number. Heck, you can even do the
$string = '1' x $number;
thing (and match against $string) and I will still be impressed.
- Logan
------------------------------
Date: Thu, 27 Jul 2000 05:17:11 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Do I Need Chomp? <was Critiques, please>
Message-Id: <rBPf5.7374$f_5.31004@news1.rdc1.ct.home.com>
BUCK NAKED1 <dennis100@webtv.net> writes:
> Do I need to add "chomp" (as I have now done) in the coding below? Why
> or why not? Doesn't "truncate" do the same thing as "chomp"?
No and no. truncate works on filehandles, chomp works on strings. A
trailing newline will be ignored when you use your scalar as a number.
> sysopen(COUNT, $counter, O_RDWR|O_CREAT) or die "Can't OPEN data
> file for READING and WRITING: $!";
>
> flock(COUNT, LOCK_EX) or die "Cannot get an EXCLUSIVE LOCK on data
> file: $!";
>
> my $num = <COUNT> || 0;
<snip>
OK, this appears to be a re-implementation of what you get if you look
up perldoc -q lock. I find the <COUNT> || 0 bit interesting, as
anything that is not a number (undef, "", "blah") will be treated as
zero when you use it as a number later. I assume the authors of
perlfaq had a reason for this? I can't quite see it.
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: Thu, 27 Jul 2000 08:39:13 +0200
From: "Franz GEIGER" <fgeiger@datec.at>
Subject: Does anybody know how to use ptkdbw?
Message-Id: <8lolhr$42q$1@pollux.ip-plus.net>
Hello all,
I once had a module that allowed me to debug Perl scripts visually and I
think it was ptkdbw.pm. I'm working on new hardware now and didn't do Perl
for a long time. My problem is now that I cannot figure out how to
install/use it. perl -d ptkdbw.pm does not work even if I try it with path
imformation.
This all happens on a NT4.0 machine. Perl is ActiveState's.
Any hint is appreciated.
Best regards
Franz GEIGER
------------------------------
Date: Thu, 27 Jul 2000 08:43:10 +0200
From: "Franz GEIGER" <fgeiger@datec.at>
Subject: Does anybody know how to use ptkdbw?
Message-Id: <8lolhs$42q$2@pollux.ip-plus.net>
Hello all,
I once had a module that allowed me to debug Perl scripts visually and I
think it was ptkdbw.pm. I'm working on new hardware now and didn't do Perl
for a long time. My problem is now that I cannot figure out how to
install/use it. perl -d ptkdbw.pm does not work even if I try it with path
imformation.
This all happens on a NT4.0 machine. Perl is ActiveState's.
Any hint is appreciated.
Best regards
Franz GEIGER
------------------------------
Date: 27 Jul 2000 06:52:01 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: exactly WHEN will PP-3rd be in bookstores, etc? Anyone know?
Message-Id: <8lom6h$9ei$1@slb6.atl.mindspring.net>
In article <397ee793@news.jakinternet.co.uk>,
Andy <andy@andy(SPAM).co.uk> wrote:
>I have a copy ordered at amazon, and it said they expect it on 7th August
>
Finally, I can actually CONTRIBUTE to this group,
and try to maybe a tiny bit compensate for
all the TOTALLY STUPID questions I have asked.
www.bookpool.com sells O'Reilly books at 40% off.
Lots of other books it sells at 20 or more %.
But -- lots of cs books they don't offer at all.
For the ones it DOES have -- truly a great deal!
David
PS: after asking my PPv3 question (that started this
thread), I went to oreilly and saw that it finally
had been issued -- then went to bookpool to see
if they had it (else would have gone to
www.readmedotdoc.com "readme.doc", but with longwinded
url, which is better (in price) than amazon, but
not as low as bookpool, or amazon) for it.
David
------------------------------
Date: Thu, 27 Jul 2000 06:14:52 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Formatting text file
Message-Id: <slrn8nvki1.61h.bernard.el-hagin@gdndev25.lido-tech>
On Thu, 27 Jul 2000 00:05:20 GMT, Coy <coy@coystoys.com> wrote:
>: I guess (also untested, but has a good chance of being correct) that I
>: won't see another post from you.
>
>incorrect, but hey. we are all entitled to our 'opinions' now aren't we ?
He killefiled you, Einstein, so it's very improbable that he'll ever
read any of your "contributions" again.
Bernard
--
perl -le 'open(JustAnotherPerlHacker,"")or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'
------------------------------
Date: Thu, 27 Jul 2000 05:31:13 GMT
From: nils-eric@telia.com (Nils-Eric Pettersson)
Subject: HTTP/1.1 404 Object Not Found ... The system cannot find the file specified.
Message-Id: <397fc229.1900593@news1.telia.com>
I have a perl program that should connect to a server and get a page
from it.
I can connect to the server but when I try to get to page I only get a
message that the server can't find it.
Instead of the page I get this header:
HTTP/1.1 404 Object Not Found
Set-Cookie:...;
path=/
Server: Microsoft-IIS/4.0 Date:
Thu, 27 Jul 2000 05:01:46 GMT
Content-Type: text/html
Content-Length: 102
The system cannot find the file specified.
I think the problem is on the row telling the server to send a page:
print SOCKET "GET $page 1.1\n\n";
This I think because the server answers.
Is there anyone who can help me:
My program look like this:
#!/usr/bin/perl -w
use strict;
use DBI;
use Socket;
sub open_SOCKET;
sub hamta_sida;
print "Content-type: text/html\n\n";
print get_page ("http://server/path/page.end");
sub open_SOCKET {
my ($server_namn, $port) = @_;
$port = getservbyname($port, 'tcp') if $port !~ /^[0-9]/;
socket SOCKET, PF_INET, SOCK_STREAM, 0 or die "socket: $!";
connect (SOCKET, sockaddr_in($port, inet_aton($server_namn)));
}
sub get_page {
my ($page) = @_;
my ($server, $text, $row) = "";
unless ($page =~ m{http://(.*?)(/.*)})
{die "Anropa programmet som: $0"."http://server/path/page.\n"}
$server = $1;
$page = $2;
if (open_SOCKET($server, "http")) {
select SOCKET;
$| = 1;
select STDOUT;
print SOCKET "GET$page 1.1\n\n";
while ($row = <SOCKET>)
{$text.=$row;}
close SOCKET;
$text;
}
else {" WRONG "}
}
/Nils-Eric Pettersson
------------------------------
Date: Thu, 27 Jul 2000 09:02:33 +0200
From: "Spiro" <spiro.theologo@getronics.com>
Subject: Newbie needs HELP... NET::TELNET
Message-Id: <8lom5h$a6d$1@ctb-nnrp2.saix.net>
Hi
I need some help and cannot figure out what I have done wrong here.....
The script keeps timing out on
$t->waitfor('/Username:.*$/');
Thanks a mil......
#!/apps2/perl -w
use Net::Telnet ();
open(HOSTS, "hosts") || die ;
open(SHOW, ">show") || die ;
while(<HOSTS>)
$t = new Net::Telnet (Timeout => 10);
$t->open($HOSTS);
$t->waitfor('/Username:.*$/');
$t->print("spiro");
$t->waitfor('/Password:.*$/');
$t->print("abc");
$t->print("term len 0");
$t->print("sh proc cpu");
($cpu) = $t->waitfor('/PID/');
if($cpu =~ /five minutes: ([0-9]+)/){
$fiveminload = $1;
}
$t->print("sh run");
($config) = $t->waitfor('/banner /');
if($config =~ /hostname ([A-Za-z0-9]+)/){
$hstname = $1;
# print "$hstname\n";
}
print SHOW "$hstname\t$fiveminload";
}
close SHOW;
close HOSTS
------------------------------
Date: Thu, 27 Jul 2000 04:59:15 GMT
From: drdementor@my-deja.com
Subject: newbie question, can a perl program run 24/7
Message-Id: <8lofj2$qr4$1@nnrp1.deja.com>
can a perl program run continously?
how is it executed initially then?
what type of file is it?
does it have to be compiled?
I want a program that will read emails from multiple pop accounts from
the same domain and "digest" the contents of the incomming emails.
is this possible?
I dont need specifics just a few pointers to get me though the learning
curve, i know how ot code just new to perl. oop or structured, im good,
just not familiar with the web side of things as well as software.
thanks for your help
Jim
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 05:22:00 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: newbie question, can a perl program run 24/7
Message-Id: <YFPf5.7375$f_5.31072@news1.rdc1.ct.home.com>
drdementor@my-deja.com <drdementor@my-deja.com> writes:
> can a perl program run continously?
Yes.
> how is it executed initially then?
The same way you would run any other program.
> what type of file is it?
Perl.
> does it have to be compiled?
You can write a version of perl that doesn't compile if you like.
> I want a program that will read emails from multiple pop accounts from
> the same domain and "digest" the contents of the incomming emails.
I think what you are looking for is called `fetchmail' and `formail',
not `Perl'.
> is this possible?
Anything's possible, especially not needing to reinvent the wheel.
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: Thu, 27 Jul 2000 06:03:50 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: newbie question, can a perl program run 24/7
Message-Id: <slrn8nvk62.h8o.efflandt@efflandt.xnet.com>
On Thu, 27 Jul 2000, drdementor@my-deja.com <drdementor@my-deja.com> wrote:
>can a perl program run continously?
Yes.
>how is it executed initially then?
The same as any other script.
>what type of file is it?
A perl script.
>does it have to be compiled?
No.
>I want a program that will read emails from multiple pop accounts from
>the same domain and "digest" the contents of the incomming emails.
>
>is this possible?
>
>I dont need specifics just a few pointers to get me though the learning
>curve, i know how ot code just new to perl. oop or structured, im good,
>just not familiar with the web side of things as well as software.
Any Unix/Linux system should have procmail that is automatically triggered
anytime a user receives mail and you set up a ~/.procmailrc file to tell
it what to do. It can filter on most anything in the mail and then
forward mail or drop spam into /dev/null or break apart a digest into
individual messages, etc. And it can be set up to keep a running backup
of the last X number of e-mails, so if your filter is broken, you can peek
at the original message to see what you need to fix.
So you might want to take a look at 'man procmail' before attempting to
reinvent the wheel.
But if you do roll your own, you may want to set up something with cron or
some other scheduler, depending upon your OS.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Thu, 27 Jul 2000 06:11:47 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: newbie question, can a perl program run 24/7
Message-Id: <397fce54.122692490@news.nikoma.de>
On Thu, 27 Jul 2000 04:59:15 GMT, drdementor@my-deja.com wrote:
> can a perl program run continously?
Yes, just like a program in any language that has loops or jumps.
> how is it executed initially then?
/home/you $ perl yourfile.pl
> what type of file is it?
Plain text. With Perl commands in it.
> does it have to be compiled?
Yes, but Perl does that for you :-).
> I want a program that will read emails from multiple pop accounts from
> the same domain and "digest" the contents of the incomming emails.
>
> is this possible?
Yes.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Thu, 27 Jul 2000 05:39:49 GMT
From: mail@nomail.com (Doma)
Subject: Re: Nobody loves me?
Message-Id: <397fc96c.15092872@news.videotron.ca>
People don't like you? hehe well I don't either, but I will help. Try
to insert something like:
formail -r -I 'From: "Jason" <jason@domain.com>' ;
I don't use your formatting, (I'm not used to the new one yet) but it
work for me. Basically it replace the From header using formail. Take
a look to formail man pages. I also set sendmail with SENDMAIL -oi -t
Hope this help you.
>
>As always, TIA!
>-Jason
>
><snippet>
>foreach $name (<INPUT>) {
> chomp;
> $from = "Jason <jason\@domain.com>";
> $subject = "shtuff goes here";
> $mailer = Mail::Mailer->new("sendmail");
> $mailer->open({ From => $from,
> To => $name,
> Subject => $subject,
> }) || die "can't open: $!";
> print $mailer $body;
> $mailer->close();
> }
></snippet>
>
------------------------------
Date: 27 Jul 2000 02:35:49 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Nobody loves me?
Message-Id: <slrn8nvm1t.vcg.abigail@alexandra.foad.org>
Clinton A. Pierce (clintp@geeksalad.org) wrote on MMDXXII September
MCMXCIII in <URL:news:o4Mf5.52714$fR2.477843@news1.rdc1.mi.home.com>:
%%
%% Try this: I have similar problems here faking "geeksalad.org" headers when
%% that's not my ISP or relay host.
%%
%% The mail host is on your box? Then telnet to the SMTP port and try lying
%% about who you are. You can find instructions for sending mail manually
%% on the net. (Look for "MAIL FROM" and "RCPT TO" stuff in the instructions.)
%%
%% If you find that, even by lying, you can't get sendmail to give you the
%% correct return address then you have to investigate sendmail's configuration.
%%
%% Become "root" or another trusted sendmail user, and try sending mail
%% from the command line with "sendmail -f". If that works, great. I think
%% -f only lets you set the user name though, not the domain. So then...
... you install qmail where you only have to set 3 environment variables.
And creating a few short files in your qmail control directory, you will
make sure all possible headers reflect the domain you want your mail to
come from.
Abigail
--
# Perl 5.6.0 broke this.
%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: Thu, 27 Jul 2000 06:21:28 GMT
From: dVoon <dvoon@my-deja.com>
Subject: Re: plotting graph
Message-Id: <8lokd6$tu1$1@nnrp1.deja.com>
In article <397FAE07.D4188449@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
> dVoon wrote:
> ...
> > I know how to use Perl to retrieve data from database and then
generate
> > an HTML table. But is there a way of using Perl to plot graphs (e.g.
> > line graph showing composite index) and send the graph to HTML
client? I
> > thought of using Perl to retrieve the data and send it to a java
applet
> > (which plots graphs) as argument, but since I don't know java, are
there
> > other ways to do it?
> ...
> > Daniel
> ...
> Sure. Just include an <img src="whatever.pl"> tag in your CGI
script's
> output, and write whatever.pl to generate a Content-type corresponding
> to an image, like image/gif, perhaps. Then use any image-generation
> module in Perl, like maybe GD, to create an image of the type
specified
> in Content-type on standard output. Best to set STDOUT to binmode. I
> find this technique works very well for generating on-the-fly graphs
of
> data for the web. If you need to pass parameters from the generated
> HTML to whatever.pl, you can do that by placing them like <img
> src="whatever.pl?p1=v1&p2=v2">. Of course, it is good to include the
> width and height of the image in the img tag so the web page will
render
> before the image is compeltely transmitted.
> --
> Bob Walton
>
Thanks Bob. Do you have any working example on using GD module to plot
graphs? And where do I get more info on this module?
Daniel
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 07:35:42 -0700
From: "Paul Moseley" <lenny123@redhotant.com>
Subject: Search Question
Message-Id: <397fd89f$1@news.jakinternet.co.uk>
I have a search engine at www.marketchat.co.uk its a financial site that
searches for stockmarket websites in the uk and us. Im not an expert
on CGI/Perl prgramming and got the program from a website. It works
well, Would it be very hard to change the script to include on Add your
URL to have a radio button with US Site / UK Site and then on the search
display a Flag for the right country, or is this to hard to do , just a
thought
Paul
p.moseley@btinternet.com
------------------------------
Date: 27 Jul 2000 05:18:34 GMT
From: jgamble@ripco.com (John M. Gamble)
Subject: Re: Warnings and undefs
Message-Id: <8logna$gqs$1@gail.ripco.com>
In article <397fe3b1.42929367@news.newsguy.com>,
Keith Calvert Ivey <kcivey@cpcug.org> wrote:
>jgamble@ripco.com (John M. Gamble) wrote:
>
>>$ p56 -we '@x = (1, undef, 3); print join(":", @x), "\n";'
>>Use of uninitialized value in join at -e line 1.
>>1::3
>
>I don't have an answer to the warnings question, but there's
>always
>
> print join(":", map {defined ? $_ : ''} @x), "\n";
>
>You could even use
>
> print join(":", map {$_ || ''} @x), "\n";
>
>if 0 never occurs in @x.
>
>Out of curiosity, if you're treating undef as '', why not just
>use '' instead?
>
I'm not. That's how the data is returned to me. And a '' is
not the same as an undef.
I considered the map or grep or foreach route (all accomplishing
the same thing) but i don't want to preprocess data when i shouldn't
have to.
Fortunately, i've found an answer: 'no warnings qw(uninitialized);'
It's not the best answer, since it would also cover up real problems
with undefined variables, but it's there at least.
-john
February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.
--
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, '227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US. E-mailing denotes acceptance of these terms.
------------------------------
Date: 27 Jul 2000 05:25:05 GMT
From: jgamble@ripco.com (John M. Gamble)
Subject: Re: Warnings and undefs
Message-Id: <8loh3h$gsi$1@gail.ripco.com>
In article <8lm3v5$f5o1@intranews.dresdnerbank.de>,
Dr. Peter Dintelmann <Peter.Dintelmann@dresdner-bank.com> wrote:
> Hi,
>
>John M. Gamble schrieb in Nachricht <8llpti$rth$1@gail.ripco.com>...
>>
>>What is - or should be - the proper category to disable warnings for
>>joining lists with undefs in them? For example (with warnings):
>
> warnings can be swichted on/off using $^W.
Erm, the whole point of 'use warnings' or 'no warnings' is to
*avoid* using $^W.
Part of my problem is apparently the way that i posed the question.
It appears that using -w in my test case was a bad idea, i should
have typed:
p56 -e 'use warnings; {...#warnings tests here}'
whereupon i would have found out that the weird results i had gotten
don't happen, and only 'no warnings qw(uninitialized)' stops the
warning message in join().
It's not ideal. My list variable is not, after all, undefined, only
an element of it is, and using this 'no warning' construct could still
cover up messages that i should be seeing. But it's better than
nothing.
-john
February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.
--
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, '227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US. E-mailing denotes acceptance of these terms.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3817
**************************************