[15984] in Perl-Users-Digest
Perl-Users Digest, Issue: 3396 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 16 18:15:50 2000
Date: Fri, 16 Jun 2000 15:15:26 -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: <961193726-v9-i3396@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Jun 2000 Volume: 9 Number: 3396
Today's topics:
read single chars <soeder@ai-lab.fh-furtwangen.de>
Re: read single chars (Tad McClellan)
Re: read single chars <tcuffel@exactis.com>
Re: read single chars <lauren_smith13@hotmail.com>
Re: read single chars <tcuffel@exactis.com>
Re: read single chars <billy@arnis-bsl.com>
Re: read single chars <trevor@trevorsky.com>
Re: Referer Security : http://username:password URL's (John Stanley)
Re: Referer Security : http://username:password URL's <lr@hpl.hp.com>
Re: Referer Security : http://username:password URL's <makau@multimania.com>
Re: Referer Security : http://username:password URL's (Abigail)
Re: Referer Security : http://username:password URL's <lr@hpl.hp.com>
Re: regexp question (David Wall)
Re: regexp question <dlibby@lhs.com>
Re: regexp question <dlibby@lhs.com>
Re: Single quotes in SQL queries <lr@hpl.hp.com>
Re: subdomain name forwarding scripts ?? <todd@mrnoitall.com>
Re: Taryag Perl (Craig Berry)
Re: Taryag Perl <care227@attglobal.net>
Re: Text substitution problem (Craig Berry)
Re: Text substitution problem <tina@streetmail.com>
Re: Text substitution problem <lr@hpl.hp.com>
Re: Translating from a code reference back to a functio <rootbeer@redcat.com>
Re: Unix database for Perl (Steve Leibel)
Re: Unix database for Perl <care227@attglobal.net>
Using link checking scripts with Dynamo server (newbie <bellamy_walton@my-deja.com>
Re: Very strange DBI:mysql-problem! jsunden@my-deja.com
Re: Where is a Perl/CGI site. <antonio_gonzalez@wap3.net>
Writing line of death to log <dem@achilles.net>
Re: Writing line of death to log <billy@arnis-bsl.com>
Re: Writing line of death to log (Abigail)
Re: Writing line of death to log <billy@arnis-bsl.com>
Re: Writing line of death to log <lr@hpl.hp.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Jun 2000 20:27:46 +0200
From: Oliver Soeder <soeder@ai-lab.fh-furtwangen.de>
Subject: read single chars
Message-Id: <394A71A2.788F9B12@ai-lab.fh-furtwangen.de>
Hello I have a stupid question, but I am a novice.
$chars=<STDIN>
This reads in a string, how can i read it as single chars?
Thanx
------------------------------
Date: Fri, 16 Jun 2000 13:58:36 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: read single chars
Message-Id: <slrn8kkqmc.986.tadmc@magna.metronet.com>
On Fri, 16 Jun 2000 20:27:46 +0200, Oliver Soeder <soeder@ai-lab.fh-furtwangen.de> wrote:
>but I am a novice.
That is no excuse.
Usenet practice *requires* that you check the FAQ before posting.
There is no exception for novices.
Monitor news.announce.newusers
>how can i read it as single chars?
^^^^
^^^^
perldoc -q char
"How can I read a single character from a file? From the keyboard?"
It appears that the answer is already on your hard disk!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 16 Jun 2000 13:04:28 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: read single chars
Message-Id: <mBu25.2725$Ck1.292331@den-news1.rmi.net>
Oliver Soeder wrote in message <394A71A2.788F9B12@ai-lab.fh-furtwangen.de>...
>Hello I have a stupid question, but I am a novice.
>
>$chars=<STDIN>
>
>This reads in a string, how can i read it as single chars?
Do this first:
$/ = \1;
$/ is the input separator, normally set to \n. However, if you set
it to a reference to an integer, it read no more than that many
characters at a time. This is to support fixed length non delimited
records, but it works for your situation as well.
man perlvar for more info.
-T
------------------------------
Date: Fri, 16 Jun 2000 11:40:13 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: read single chars
Message-Id: <8ids97$jh8$1@brokaw.wa.com>
Oliver Soeder <soeder@ai-lab.fh-furtwangen.de> wrote in message
news:394A71A2.788F9B12@ai-lab.fh-furtwangen.de...
> Hello I have a stupid question, but I am a novice.
>
> $chars=<STDIN>
>
> This reads in a string, how can i read it as single chars?
Hi Novice,
I am having trouble figuring out exactly what you want. Do you want
A) To read in the input as an array of characters like C?
$chars = <STDIN>;
@chararray = split (//, $chars);
or
B) To read in a single character (not wait for an Enter)?
perlfaq5: How can I read a single character from a file? From the keyboard?
Lauren
------------------------------
Date: Fri, 16 Jun 2000 13:26:25 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: read single chars
Message-Id: <UVu25.2730$Ck1.293967@den-news1.rmi.net>
Tad McClellan wrote in message ...
>On Fri, 16 Jun 2000 20:27:46 +0200, Oliver Soeder <soeder@ai-lab.fh-furtwangen.de> wrote:
>
>>but I am a novice.
>
>
>That is no excuse.
>
>Usenet practice *requires* that you check the FAQ before posting.
>
>There is no exception for novices.
[snip]
A little quick with the trigger finger there, cowboy...
His full question boiled down to "Can I read one character from a file
using <> syntax?"
The faq gives a few answers more geared mostly towards keyboard input
and OS incompatibility problems. It does not provide an answer to
the question he posted, or in my opinion, a good answer to reading
a single char from a file in general.
------------------------------
Date: Fri, 16 Jun 2000 19:39:24 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: read single chars
Message-Id: <8idvpa$6q5$1@nnrp1.deja.com>
In article <394A71A2.788F9B12@ai-lab.fh-furtwangen.de>,
Oliver Soeder <soeder@ai-lab.fh-furtwangen.de> wrote:
> Hello I have a stupid question, but I am a novice.
>
> $chars=<STDIN>
>
> This reads in a string, how can i read it as single chars?
>
IMHO read() or sysread() functions:
perldoc -f read
(or http://www.cpan.org/doc/manual/html/pod/perlfunc/read.html)
perldoc -f sysread
(or http://www.cpan.org/doc/manual/html/pod/perlfunc/sysread.html)
If you need to read just one key from terminal,
then see FAQ "How do I read just one key without waiting for a return
key?" (and related) in 'perldoc perlfaq8'
(or http://www.cpan.org/doc/manual/html/pod/perlfaq8.html).
Good luck.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 14:38:09 -0700
From: "Trevor Sky Garside" <trevor@trevorsky.com>
Subject: Re: read single chars
Message-Id: <H2x25.36$LA4.40100@news.pacbell.net>
"Tim" <tcuffel@exactis.com> wrote in message
news:mBu25.2725$Ck1.292331@den-news1.rmi.net...
>
> Oliver Soeder wrote in message
<394A71A2.788F9B12@ai-lab.fh-furtwangen.de>...
> >Hello I have a stupid question, but I am a novice.
> >
> >$chars=<STDIN>
> >
> >This reads in a string, how can i read it as single chars?
>
>
> Do this first:
>
> $/ = \1;
>
> $/ is the input separator, normally set to \n. However, if you set
> it to a reference to an integer, it read no more than that many
> characters at a time. This is to support fixed length non delimited
> records, but it works for your situation as well.
Don't forget to set $/ back to "\n" when you're done.
--Trevor
------------------------------
Date: 16 Jun 2000 18:05:35 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Referer Security : http://username:password URL's
Message-Id: <8idq9f$l5$1@news.NERO.NET>
In article <8idk0i$tc7$1@nnrp1.deja.com>,
Makau Divangamene <makau@multimania.com> wrote:
>I have noticed that when you click a link within a
>http://un:pw@www.url.com/... document, the full URL containing the
>password is sent to the visited url through the $ENV{HTTP_REFERER}
>variable, which is extremely dangerous ...
So don't do it.
>However I have found out that sometimes the "un:pw" part is hidden (by
>the http server?).
This is a perl issue, how?
>If you want to verify this, go to : www.club-fripons.com
>At the bottom of the page, it will show you the FULL URL you came from!
Ahh, the answer to "why is this person posting here?" It's a
click-through scam.
>Is there any way to prevent this, apart from redefining the referer
>with the LWP's modules?
Don't click on random URL's you find posted to newsgroups.
>PS : I know this message is more targeted to the cgi-authoring group
>but that newsgroup seems to be just plain dead (after posting a
>message, you usually get a reply after 2 days, if someone actually
>replies ...).
It seems "right place" is not important to you, but "fast response" is.
I'd suggest you post your question to alt.flame or talk.origins, then.
You'll get a MUCH faster response.
------------------------------
Date: Fri, 16 Jun 2000 11:33:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Referer Security : http://username:password URL's
Message-Id: <MPG.13b412d34c086b2898ab90@nntp.hpl.hp.com>
In article <8idk0i$tc7$1@nnrp1.deja.com> on Fri, 16 Jun 2000 16:18:46
GMT, Makau Divangamene <makau@multimania.com> says...
> I have noticed that when you click a link within a
> http://un:pw@www.url.com/... document, the full URL containing the
> password is sent to the visited url through the $ENV{HTTP_REFERER}
> variable, which is extremely dangerous ...
>
> However I have found out that sometimes the "un:pw" part is hidden (by
> the http server?).
>
> If you want to verify this, go to : www.club-fripons.com
> At the bottom of the page, it will show you the FULL URL you came from!
You prick! Thanks for posting a URL that might have cost me my job had
my boss just happened to wander by when I was accessing it.
You now have the distinction of being the first and only entry in my
kill-file.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 16 Jun 2000 19:19:22 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: Re: Referer Security : http://username:password URL's
Message-Id: <8iduj9$5rb$1@nnrp1.deja.com>
Dude I'm sorry for posting that url but it is the only one I've found
that actually gives you the FULL URL that includes un/pw. I tried it on
my own server but it did not. It was really _not_ intended for spam I
swear. Anyone who knows me knows I'm not a spammer, far from that.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Jun 2000 16:07:03 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Referer Security : http://username:password URL's
Message-Id: <slrn8kl35l.mlf.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCDLXXXI September MCMXCIII in
<URL:news:MPG.13b412d34c086b2898ab90@nntp.hpl.hp.com>:
{} In article <8idk0i$tc7$1@nnrp1.deja.com> on Fri, 16 Jun 2000 16:18:46
{} GMT, Makau Divangamene <makau@multimania.com> says...
{} >
{} > If you want to verify this, go to : www.club-fripons.com
{} > At the bottom of the page, it will show you the FULL URL you came from!
{}
{} You prick! Thanks for posting a URL that might have cost me my job had
{} my boss just happened to wander by when I was accessing it.
While I don't want to imply that I think Makau was right in posting what
he did, I think it's silly to just follow links from Usenet postings
if you work in a situation that accessing a single web site can get
you fired.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Fri, 16 Jun 2000 14:19:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Referer Security : http://username:password URL's
Message-Id: <MPG.13b439b85f2e4b0f98ab95@nntp.hpl.hp.com>
In article <slrn8kl35l.mlf.abigail@alexandra.delanet.com> on 16 Jun 2000
16:07:03 EDT, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCDLXXXI September MCMXCIII in
> <URL:news:MPG.13b412d34c086b2898ab90@nntp.hpl.hp.com>:
> {} In article <8idk0i$tc7$1@nnrp1.deja.com> on Fri, 16 Jun 2000 16:18:46
> {} GMT, Makau Divangamene <makau@multimania.com> says...
> {} >
> {} > If you want to verify this, go to : www.club-fripons.com
> {} > At the bottom of the page, it will show you the FULL URL you came from!
> {}
> {} You prick! Thanks for posting a URL that might have cost me my job had
> {} my boss just happened to wander by when I was accessing it.
>
> While I don't want to imply that I think Makau was right in posting what
> he did, I think it's silly to just follow links from Usenet postings
> if you work in a situation that accessing a single web site can get
> you fired.
Yeah. Well, the firing is theoretical, as I could simply point to the
newsgroup message to which I was trying to respond. (I doubt that they
would fire me for doing that. :-)
But there has to be a certain amount of trust in this newsgroup. This
Makau has posted here many times, though usually not usefully, so
presumably deserved some trust. But evidently not!
I can feel violated, even without being actually raped.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Jun 2000 14:47:52 -0400
From: darkon@one.net (David Wall)
Subject: Re: regexp question
Message-Id: <8F5598342darkononenet@206.112.192.118>
tadmc@metronet.com (Tad McClellan) wrote in
<slrn8kj8pc.80i.tadmc@magna.metronet.com>:
>On 15 Jun 2000 22:47:33 -0400, David Wall <darkon@one.net> wrote:
>>tadmc@metronet.com (Tad McClellan) wrote in
>><slrn8ki5hb.7c8.tadmc@magna.metronet.com>:
>>
>>>On Thu, 15 Jun 2000 18:01:18 GMT, derekl <dlibby@lhs.com> wrote:
>>>>
>>>>I have a long string containing constructs similar to the following,
> ^^^^^^^^^^
>
>>>> .string1(string2)
[snip]
>>
>>Um, what if the string has non-word characters?
>
>Then it wouldn't be "similar to" the sample given.
Well, maybe... see below.
>Poor specs yield poor programs.
Oh, I agree. I interpreted 'similar to' as something like 'having the form
of', so a string like '.$$$$$$(%%%%%%%)' would be similar to
'.string1(string2)'. <shrug> All in the way you look at it, I guess, given
the slippery nature of the word 'similar', and certainly not worth wasting
alot of time on. I was just interested in the different ways of approching
the problem, i.e.; just playing.
--
David Wall
darkon@one.net
------------------------------
Date: Fri, 16 Jun 2000 20:09:51 GMT
From: derekl <dlibby@lhs.com>
Subject: Re: regexp question
Message-Id: <8ie1hv$89u$1@nnrp1.deja.com>
Thanks for all the help. I finally ended up using:
s{\.(\w*)(\s*)\((\w*)\)}{.$3$2($1)}g;
The (\s*) is in there because the structure of the file was such that a
newline and a series of spaces could appear between the end of the
first string and the parantheses.
.string1
(string2)
Putting the whitespace back also allowed me to keep the linelenghts
similar to the original file, except for the difference in lengths of
the 2 strings, which is purely an aesthetic modfication on my part.
I think I'm beginning to love PERL!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 20:18:25 GMT
From: derekl <dlibby@lhs.com>
Subject: Re: regexp question
Message-Id: <8ie21u$8oh$1@nnrp1.deja.com>
By the way, the strings contained only word characters except for the
potential whitespace at the end of lines that I mentioned in my
previous posts. I'll try to be more clear next time.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 11:22:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Single quotes in SQL queries
Message-Id: <MPG.13b41046fb0ef50198ab8f@nntp.hpl.hp.com>
In article <394A5B4E.235AF0FB@lycosmail.com> on Fri, 16 Jun 2000
18:52:30 +0200, Johannes <gedichte@lycosmail.com> says...
...
> You have to make sure that your value is correctly quoted:
>
> $country = $dbh->quote($value);
> $sth = $dbh->prepare("SELECT * FROM country WHERE country = ?");
> $sth->execute($country);
Quoting in the above case is not needed. That is the beauty of using a
placeholder, rather than interpolating (as in your next example).
> You can also insert the correctly quoted string into the SQL statement:
> $country = $dbh->quote($value);
> $sth = $dbh->prepare("SELECT * FROM country WHERE country = '$country'");
> $sth->execute();
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 16 Jun 2000 12:15:39 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: Re: subdomain name forwarding scripts ??
Message-Id: <394A6E42.303FC8ED@mrnoitall.com>
Ramya wrote:
> Hi,
> I am not sure a javascript can do this or you need a cgi/perl script
> but here is what I am looking for. I have a domain name www.myname.com
> and I want to create subdomain names like music.myname.com ,
> geek.myname.com etc. which in turn will be pointing to
> www.myname.com/music and www.myname.com/geek for there respective index
> pages. Could anybody suggest any sites with such scripts even for a
> nominal fee.
> Thanks for the info in advance,
> Ramya.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
http://freescripts.blacksheep3d.com
look for virtual
------------------------------
Date: Fri, 16 Jun 2000 21:00:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Taryag Perl
Message-Id: <skl5at74is4180@corp.supernews.com>
abe kohen (abekohen@cloud9.net) wrote:
: > What is "Taryag"?
:
: What is "Perl?" (The scripting language?)
Well, assuming the 'e' is handled by pointing, we get Peh-Resh-Lamed,
80+200+30, or 310. :)
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 16 Jun 2000 17:03:14 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Taryag Perl
Message-Id: <394A9612.8333D36F@attglobal.net>
Craig Berry wrote:
>
> abe kohen (abekohen@cloud9.net) wrote:
> : > What is "Taryag"?
> :
> : What is "Perl?" (The scripting language?)
>
> Well, assuming the 'e' is handled by pointing, we get Peh-Resh-Lamed,
> 80+200+30, or 310. :)
>
Now I' _sure_ this has gone too far!
------------------------------
Date: Fri, 16 Jun 2000 21:17:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Text substitution problem
Message-Id: <skl6b7b0is448@corp.supernews.com>
Johannes (gedichte@lycosmail.com) wrote:
: If $postinput is a multiline string you should use: $postinput =~
: s/=//mg;
The /m modifier only makes a difference if the match string contains ^ or
$, which this one does not.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: 16 Jun 2000 21:22:51 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Text substitution problem
Message-Id: <8ie5rb$4mbdj$5@fu-berlin.de>
hi,
Craig Berry <cberry@cinenet.net> wrote:
> Johannes (gedichte@lycosmail.com) wrote:
> : If $postinput is a multiline string you should use: $postinput =~
> : s/=//mg;
> The /m modifier only makes a difference if the match string contains ^ or
> $, which this one does not.
and if the pattern contains "."
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Fri, 16 Jun 2000 14:35:22 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Text substitution problem
Message-Id: <MPG.13b43d7669e092ef98ab97@nntp.hpl.hp.com>
In article <8ie5rb$4mbdj$5@fu-berlin.de> on 16 Jun 2000 21:22:51 GMT,
Tina Mueller <tina@streetmail.com> says...
> Craig Berry <cberry@cinenet.net> wrote:
> > Johannes (gedichte@lycosmail.com) wrote:
> > : If $postinput is a multiline string you should use: $postinput =~
> > : s/=//mg;
>
> > The /m modifier only makes a difference if the match string contains ^ or
> > $, which this one does not.
>
> and if the pattern contains "."
No. That is irrelevant. You are thinking of /s.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 16 Jun 2000 14:52:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Translating from a code reference back to a function name
Message-Id: <Pine.GSO.4.10.10006161449220.21108-100000@user2.teleport.com>
On Fri, 16 Jun 2000, aml wrote:
> Does anyone know how to translate from a code reference back to the
> full function or method name? If you examine a code reference in the
> debugger it does this for you, so it's obviously possible, but I
> haven't a clue how.
Well, there's no guarantee that there _is_ a name for a given code ref.
But if there is, you could walk the symbol tables to find it. It may be
faster and easier to simply save a copy of the name in the first place,
along with the reference. Of course, the question remains: if you're not
debugging, what would you need the name for?
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 16 Jun 2000 11:34:08 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: Re: Unix database for Perl
Message-Id: <stevel-1606001134120001@192.168.100.2>
In article <x6p25.4103$bc4.281608@news1.primary.net>, "Bob Tate"
<btate@primary.net> wrote:
> Anyone know a good database for a Unix system that Perl will talk to.
Most people will suggest Mysql, the most popular free database. However
Mysql does not have transactions and does not implement all of the
language, such as subqueries. I prefer Postgres, a free open-source
database that has full SQL features. You can download Postgres at
http://www.postgresql.org/.
To use it with perl, get DBI and DBD::Pg from CPAN.
Steve L
------------------------------
Date: Fri, 16 Jun 2000 14:37:57 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Unix database for Perl
Message-Id: <394A7405.64FD0ED@attglobal.net>
Steve Leibel wrote:
>
> Most people will suggest Mysql, the most popular free database. However
> Mysql does not have transactions and does not implement all of the
> language, such as subqueries. I prefer Postgres, a free open-source
> database that has full SQL features. You can download Postgres at
> http://www.postgresql.org/.
>
Or, as Abigail suggested, something like Sybase, which has its own
sybperl to work with it. I like Sybase alot, but prefer MySQL for
my games.
------------------------------
Date: Fri, 16 Jun 2000 19:54:58 GMT
From: Bella <bellamy_walton@my-deja.com>
Subject: Using link checking scripts with Dynamo server (newbie question)
Message-Id: <8ie0m9$7lb$1@nnrp1.deja.com>
Hi All,
I have an interesting problem. We're trying to write an html link
checker. Most methods use the HEAD command from the HTML::LinkExtor
module, which of course is far superior than using GET (which follows
re-directed links).
Here's the problem, we serve our pages through Dynamo on an Apache web
server. The HEAD response is not supported by Dynamo.
So if you check a bad page say "http://www.domainname.com/blahblah" with
HEAD, Dynamo returns nothing, Apache sends back the correct error page,
but HEAD returns true. If you use GET with the same url, the error page
is returned back and so HEAD returns true.
Question is, how do I get around it? Can I use HTTP::Status and get the
correct response?
Remember, I'm a Perl newbie, so please be kind :)
--
Bella...
"Experience is what you get when you don't get what you want"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 19:28:02 GMT
From: jsunden@my-deja.com
Subject: Re: Very strange DBI:mysql-problem!
Message-Id: <8idv3c$69t$1@nnrp1.deja.com>
Thank you very much for the help! Of course it solved the problem. I
must have forgot to change the code when I transfered it from another
version of the program and then stared myself blind at other parts of
the program trying to find out what was wrong.
> See. You're supposed to be able to do this yourself, you know.
Sorry, I didn´t know there was an entrance test for this newsgroup. ;-)
Sometimes when you are stuck you just need someone else to take a look
at your code and you guys where the only ones around for me. Thank you
again for taking the time to help me!
Sincerely,
Joakim Sundén
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 19:43:47 GMT
From: Antonio Gonzalez <antonio_gonzalez@wap3.net>
Subject: Re: Where is a Perl/CGI site.
Message-Id: <+HrMNmJ3KqrAGbbJklHvzRHnLtE9@4ax.com>
On Thu, 15 Jun 2000 18:38:15 -0700, "Ferk Da Jerk"
<shawnball@uswest.net> wrote:
>In the present there are many great books that teach you Perl and CGI. The
>range from 200 to 800 pages. They teach you the easy, the hard, and the
>very advance code. I will easily buy a book to learn all of this, but first
>I would like to try the Internet. So does any one know where I can find a
>site that teaches you Perl and CGI as well as some of the books out at the
>moment? I would preciate it.
Go to hotscripts.com, download tons of Perl sample code,
try it, play with it, and then buy a good book.
------------------------------
Date: Fri, 16 Jun 2000 15:02:19 -0400
From: "Dave McIntyre" <dem@achilles.net>
Subject: Writing line of death to log
Message-Id: <8idtag$lg3$1@bcarh8ab.ca.nortel.com>
O Ye of Perl,
The user wants a log file entry everytime the script dies
for any reason.
I'm doing this:
open(FILE, "file.txt") or print LOG scalar(localtime) . " Line: Can't open
$file: $!\n" and die;
but would like to include the line number it died on. Possible?
Thanks,
Dave
------------------------------
Date: Fri, 16 Jun 2000 20:01:58 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Writing line of death to log
Message-Id: <8ie139$7sm$1@nnrp1.deja.com>
In article <8idtag$lg3$1@bcarh8ab.ca.nortel.com>,
"Dave McIntyre" <dem@achilles.net> wrote:
> O Ye of Perl,
>
> The user wants a log file entry everytime the script dies
> for any reason.
>
> I'm doing this:
>
> open(FILE, "file.txt") or print LOG scalar(localtime) . " Line: Can't
open
> $file: $!\n" and die;
>
> but would like to include the line number it died on. Possible?
>
IMHO, the better strategy could be to install
a $SIG{__DIE__} handler. In such case you may as usually
simply die("some error: $!") on errors without any special
processing, and the handler will log your message with
line numbers added automagically by die().
See 'perldoc -f die'
(http://www.cpan.org/doc/manual/html/pod/perlfunc/die.html)
and 'perldoc perlvar' for more details.
A sample script comes below:
#!/usr/bin/perl -w
use strict;
my $logfile = './log';
open LOG, ">>$logfile" or die "cannot open $logfile: $!";
# log a message (and print it also)
$SIG{__DIE__} = sub { print LOG $_[0]; die $_[0] };
# ... do something ... then an error arises:
open NO, 'no_such_file' or die "cannot open no_such_file: $!";
# that's all
The above script logs to file './log' lines like:
cannot open no_such_file: A file or directory in the path name does not
exist. at ./test line 17.
cannot open no_such_file: A file or directory in the path name does not
exist. at ./test line 17.
cannot open no_such_file: A file or directory in the path name does not
exist. at ./test line 17.
Hope this helps.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Jun 2000 16:21:32 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Writing line of death to log
Message-Id: <slrn8kl44j.mlf.abigail@alexandra.delanet.com>
Dave McIntyre (dem@achilles.net) wrote on MMCDLXXXI September MCMXCIII in
<URL:news:8idtag$lg3$1@bcarh8ab.ca.nortel.com>:
^^ O Ye of Perl,
^^
^^ The user wants a log file entry everytime the script dies
^^ for any reason.
^^
^^ I'm doing this:
^^
^^ open(FILE, "file.txt") or print LOG scalar(localtime) . " Line: Can't open
^^ $file: $!\n" and die;
Then you would have to do that everytime you use die, and that doesn't
catch the cases where the program dies for another reason than your die.
Much, much better to trap the dies:
$SIG {__DIE__} = sub {
print LOG scalar (localtime), @_;
# Includes the line number if the message
# died with didn't end in a newline.
die @_;
};
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: Fri, 16 Jun 2000 20:23:46 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Writing line of death to log
Message-Id: <8ie2bt$8td$1@nnrp1.deja.com>
In article <8ie139$7sm$1@nnrp1.deja.com>,
Ilja Tabachnik <billy@arnis-bsl.com> wrote:
> In article <8idtag$lg3$1@bcarh8ab.ca.nortel.com>,
> "Dave McIntyre" <dem@achilles.net> wrote:
> > O Ye of Perl,
> >
> > The user wants a log file entry everytime the script dies
> > for any reason.
> >
...skipped...
Just some more considerations:
1. If there is a chance for multiply instances of script to be running,
you shoul deal with log file locking.
2. There are some modules on CPAN under Log:: namespace.
Maybe some of them will do the job (I had no experience with them).
2. And, finally, consider using syslog facility, which is available
from Perl via Sys::Syslog module (AFAIK part of perl distribution).
Consult perldoc Sys::Syslog or
http://www.cpan.org/doc/manual/html/lib/Sys/Syslog.html)
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 16 Jun 2000 14:23:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Writing line of death to log
Message-Id: <MPG.13b43aad205eb73f98ab96@nntp.hpl.hp.com>
In article <8ie2bt$8td$1@nnrp1.deja.com> on Fri, 16 Jun 2000 20:23:46
GMT, Ilja Tabachnik <billy@arnis-bsl.com> says...
> In article <8ie139$7sm$1@nnrp1.deja.com>,
> Ilja Tabachnik <billy@arnis-bsl.com> wrote:
> > In article <8idtag$lg3$1@bcarh8ab.ca.nortel.com>,
> > "Dave McIntyre" <dem@achilles.net> wrote:
> > >
> > > The user wants a log file entry everytime the script dies
> > > for any reason.
...
> 1. If there is a chance for multiply instances of script to be running,
> you shoul deal with log file locking.
Not worth the trouble. As has been discussed here many times, the OS
will append to the log file with an atomic write, barring messages
larger than a file-system buffer.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
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 3396
**************************************