[9790] in Perl-Users-Digest
Perl-Users Digest, Issue: 3383 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 20:07:18 1998
Date: Thu, 6 Aug 98 17:00:18 -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 Thu, 6 Aug 1998 Volume: 8 Number: 3383
Today's topics:
<BASE HREF= ...> and "access disallowed from scripts .. <joe@halbrook.com>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in <che@debian.org>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Dustin Mollo)
Re: BIZARRE: killing window kills bg perl process <tchrist@mox.perl.com>
Re: c.l.p.moderated: not much traffic? <merlyn@stonehenge.com>
Re: c.l.p.moderated: not much traffic? (Brandon S. Allbery KF8NH)
Re: Can't Match Multi-Line Pattern (Craig Berry)
Re: code problem <dgris@rand.dimensional.com>
Re: comp.lang.perl.announce redux (Sitaram Chamarty)
Re: File Info (Mark-Jason Dominus)
Looking for cdk (curses library) source chanders@timing.com
Re: Perl Beautifier Home Page <tim.maher@atrieva.com>
Re: Perl Docs.. forget the original post <palincss@tidalwave.net>
Re: Perl+ftp <rootbeer@teleport.com>
Re: Problems with File::Find (Sitaram Chamarty)
Re: Putting \r\n at end of lines using format and write (Sitaram Chamarty)
Re: Retrieving the value of a matched pattern (Craig Berry)
Re: Setting $ENV{LD_LIBRARY_PATH} doesn't work (Todd Hivnor)
Re: Setting $ENV{LD_LIBRARY_PATH} doesn't work (Tye McQueen)
signals in Win32 Perl <jkiser@best.com>
Re: Teaching Perl <gtod@netscape.net.au>
Re: Teaching Perl <jkiser@best.com>
wildcards don't work with link function? (Brett Goldstock)
Re: wildcards don't work with link function? <rra@stanford.edu>
Re: wtf is the obsession with "foo" and "bar" (Brandon S. Allbery KF8NH)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 06 Aug 1998 17:27:06 -0500
From: Joe Halbrook <joe@halbrook.com>
Subject: <BASE HREF= ...> and "access disallowed from scripts ..."
Message-Id: <35CA2DBA.1111A9B0@halbrook.com>
HELP!
I have a script that generates a Javascript that opens a new window.
The new window contains a <FORM> that has an ACTION="another script on
my server" (the same server the script that originally created the new
window resides on).
When I click to submit the form on the new window I receive this
message, and then when I click OK to clear it off, the second script
processes successfully ...
"JavaScript Error: http://www.my-domain.com/cgi-bin/first-script.pl,
line
17:
access disallowed from scripts at
http://www.my-domain.com/cgi-bin/first-script.pl to documents at another
domain."
When I looked at the script-generated source for the new window this
line appears as the first line:
<BASE HREF="http://www.my-domain.com/cgi-bin/">
One last twist: This only occurs if the first script is located on a
domain (server) other than my own. When the first script is ran from my
server, NO ERROR!
Any ideas would be greatly appreciated!!!
Joe Halbrook
------------------------------
Date: 06 Aug 1998 16:34:53 -0700
From: Ben Gertzfield <che@debian.org>
To: tchrist@mox.perl.com
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <yttbtpxlm5e.fsf@gilgamesh.cse.ucsc.edu>
Joel> Tom, Brian's right. The server's sending it as text/plain.
Joel> That is wrong. The browser is free to assume it can change
Joel> line-endings, etc., since it was TOLD by the server that it
Joel> was text. Microsoft is plenty blameworthy in general. But
Joel> not in this case.
Tom> Hold on.
200 OK
Connection: close
Date: Thu, 06 Aug 1998 21:38:09 GMT
Accept-Ranges: bytes
Server: Apache/1.2.6 mod_perl/1.11
Content-Encoding: x-gzip
Content-Length: 963743
Content-Type: text/plain
ETag: "7107-eb49f-35c5fe60"
Last-Modified: Mon, 03 Aug 1998 18:16:00 GMT
Client-Date: Thu, 06 Aug 1998 21:38:09 GMT
Client-Peer: 208.201.239.48:80
Tom> The content-encoding is indeed x-gzip. Are you saying it
Tom> should be x-gtar instead?
Tom> I have never seen a problem with this once a Unix box.
The Content-Encoding is indeed x-gzip, but the Content-Type is
text/plain. This will utterly confuse many browsers, since
the content-type is *not* text/plain.
The problem is that your server thinks that .tar.gz is text/plain, for
some reason.
Ben
--
Brought to you by the letters K and D and the number 18.
"Hello! We are only joke. It is funny enough." -- Orz, SCII
Debian GNU/Linux -- where do you want to go tomorrow? http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.
------------------------------
Date: 6 Aug 1998 23:45:37 GMT
From: dustin@sonic.net (Dustin Mollo)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qdf71$h8d$1@ultra.sonic.net>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: [courtesy cc of this posting sent to cited author via email]
:
: In comp.lang.perl.misc,
: "Joel Noble" <jnoble@mediaone.com> writes:
: :Tom, Brian's right. The server's sending it as text/plain. That is wrong.
: :The browser is free to assume it can change line-endings, etc., since it was
: :TOLD by the server that it was text.
: :
: :Microsoft is plenty blameworthy in general. But not in this case.
:
: Hold on.
<SNIP>
: Content-Type: text/plain
<SNIP>
: The content-encoding is indeed x-gzip. Are you saying it should
: be x-gtar instead?
OK. I have changed the server config a little. Try it out and let me know
how it goes!
--
Dustin Mollo
www.perl.com Site Manager
dustin@songline.com
------------------------------
Date: 6 Aug 1998 21:51:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: BIZARRE: killing window kills bg perl process
Message-Id: <6qd8hm$i8p$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
k y n n <kj0@mailcity.com> writes:
:I have a perl script that runs fine in the background (e.g., "foo &")
:as long as its parent shell is up, but dies immediately if one kills
:the shell, just as if it were a foreground process. I've never seen
:this behavior before, nor have ben able to reproduce it with simpler
:test scripts.
:
:The OS is IRIX6.2 and the perl version is 5.004_4.
I bet you're using one of those lame shells that doesn't automatically
"no hup" backgrounded processes.
--tom
--
_doprnt(pat, args, &fakebuf); /* what a kludge */
--Larry Wall, from util.c in the v5.0 perl distribution
------------------------------
Date: Thu, 06 Aug 1998 22:29:34 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <8c4svpbv7f.fsf@gadget.cscaper.com>
>>>>> "Craig" == Craig Berry <cberry@cinenet.net> writes:
Craig> You've just illustrated one of my least favorite things about
Craig> clp.moderated -- it raised from 2 to 3 the clp*m* ambiguity count. Even
Craig> clp.mod now has 2 possible meanings. Hey, perhaps we should rename
Craig> clp.announce to clp.messages...
clp.mannouncements :)
--
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: 6 Aug 1998 19:44:26 -0400
From: allbery@kf8nh.apk.net (Brandon S. Allbery KF8NH)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qdf4q$jdi$1@rushlight.kf8nh.apk.net>
Also sprach lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen) (<lassehp-0608981718120001@ra.imv.aau.dk>):
+-----
| In article <6qcfig$3bm$1@aurwww.aur.alcatel.com>, klassa@aur.alcatel.com wrote:
| >Is it me, or is the traffic on c.l.p.moderated pretty much a
| >trickle?
|
| No, I have the same impression. Either people forget to register, or they
| just prefer to continue complaining about FAQs in c.l.p.misc.
+--->8
More likely, it's not propagating to you very well. Not exactly unusual for
new newsgroups.
--
brandon s. allbery [os/2][linux][solaris][japh] allbery@kf8nh.apk.net
system administrator [WAY too many hats] allbery@ece.cmu.edu
electrical and computer engineering
carnegie mellon university (bsa@kf8nh is still valid.)
------------------------------
Date: 6 Aug 1998 22:09:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Can't Match Multi-Line Pattern
Message-Id: <6qd9jm$545$1@marina.cinenet.net>
Steve Palincsar (palincss@tidalwave.net) wrote:
: Craig Berry wrote:
: > For some reason, the /m and /s modifiers cause far more confusion than
: > seems warranted. See Freidl's brilliant explanation of these in
:
: That's because in both perlre and the Camel they are essentially
: not explained.
I found this at the first match for '/m' in perlre (5.004_04):
By default, the "^" character is guaranteed to match at only
the beginning of the string, the "$" character at only the
end (or before the newline at the end) and Perl does certain
optimizations with the assumption that the string contains
only one line. Embedded newlines will not be matched by "^"
or "$". You may, however, wish to treat a string as a
multi-line buffer, such that the "^" will match after any
newline within the string, and "$" will match before any
newline. At the cost of a little more overhead, you can do
this by using the /m modifier on the pattern match operator.
(Older programs did this by setting $*, but this practice is
now deprecated.)
To facilitate multi-line substitutions, the "." character
never matches a newline unless you use the /s modifier,
which in effect tells Perl to pretend the string is a single
line--even if it isn't. The /s modifier also overrides the
setting of $*, in case you have some (badly behaved) older
code that sets it in another module.
Seems relatively straightforward to me, though perhaps the wording on the
second paragraph could be improved a bit.
: Your explanation certainly helped me. Before I had to stop and go
: to a meeting, I was researching this identical point at work,
: having forgotten which /[ms] did which. I didn't get as far as
: Friedl, but did check the two I mentioned above and found
: no help there.
Freidl explains them in glorious detail and emphasizes the "/m affects
*only* ^$, /s affects *only* ." tack which I took in my previous message.
However, all the same semantics are there in perlre.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Thu, 06 Aug 1998 23:08:53 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: code problem
Message-Id: <6qdc9i$fj$1@rand.dimensional.com>
Keywords: from just another new york perl hacker
[posted to comp.lang.perl.misc and mailed to the cited author]
In article <comdog-ya02408000R0608981619540001@news.panix.com>
comdog@computerdog.com (brian d foy) wrote:
>In article <35CA06E7.47DFA817@vt.edu>, jtoye@vt.edu posted:
>
>>while ($pattern = <PATTERNS>) {
>
>i'm not sure what you're input data are like, but you might
>want to check to make sure that $pattern is defined(). if
>$pattern eq '0' you'll end your while() loop. (but maybe you
>want that?)
This is only true if $pattern will evaluate to 0. Assuming
that $/ hasn't been changed this will not be the case unless
the line isn't newline terminated. Of course, if it doesn't
have a newline at the end it probably is the last line of the
file anyway.
dgris
- ignore for the moment the possibility that $pattern or PATTERNS
could be tied, in which case it is possible that the returned
value could evaluate to 0 but not be the final string in the file
(of course, if the person is using a tied filehandle this way,
they probably know what they are doing :-)
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: 6 Aug 1998 23:34:13 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <slrn6sjqoj.ekt.sitaram@diac.com>
On 5 Aug 1998 13:26:44 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
>Love,
That's one for the record books, Tom :-)
^^^ note smiley (the .uk guy
you responded to had a smiley
at the end of his original
comment, by the way!)
>Tom
>--
> ``The English have no respect for their language, and will not teach
> their children to speak it.'' --G. B. Shaw
Unrelated question: you always seem to come up with an appropriate
tagline. Is there perl magic here (perhaps a .signature
generating program that scans the text of your post and compares
non-trivial words to an index of some sort and selects a tagline
from the result)? or is this manual.
If it is automatic, can you give us an outline of how you go about
it? Thanks.
------------------------------
Date: 6 Aug 1998 18:24:49 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: File Info
Message-Id: <6qdafh$68s$1@monet.op.net>
In article <35c98e76.8078055@news.demon.co.uk>,
Darren Ferguson <Darren@introdesign.com> wrote:
>Does anyone have a couple of quick lines of Perl to demonstrate
>how to get info on a file size, permissions and creation date?
The key item is the `stat' function. On Unix systems it looks like
this:
use Stat::lsMode;
my $file = shift;
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($file);
my $perms = format_mode($mode);
my $omode = sprintf("0%o", $mode & 0777);
print <<EOM
File `$file';
Type and permissions: $perms ($omode)
Length: $size
Disk blocks consumed: $blocks
Creation date: Not available
EOM
Typical output:
File `/tmp/stat';
Type and permissions: -rw-r--r-- (0644)
Length: 380
Disk blocks consumed: 2
Creation date: Not available
On other systems this might also work, but I'm not sure.
------------------------------
Date: Thu, 06 Aug 1998 22:02:34 GMT
From: chanders@timing.com
Subject: Looking for cdk (curses library) source
Message-Id: <6qd95q$t1i$1@nnrp1.dejanews.com>
The URL listed for the cdk base library is not responding:
http://www.swi.com/~glover/cdk/cdk.html
Any idea where to find this?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 06 Aug 1998 16:37:52 -0700
From: Tim Moher <tim.maher@atrieva.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35CA3E4F.C15F6FB1@atrieva.com>
Todd Lehman wrote:
> > http://www.consultix.wa.com/yumpy/cgi-pvt/pbeaut.cgi.
>
> Ack! God help us if this isn't a late April Fools joke! :-)
>
> Here is the first code snippets I fed it...
>
> --Todd L.
>
> (stuff deleted,that just showed his input and output were nearly identical)
Thus far, my primary goal with the Perl Beautifier has been to impose a basic
orderly structure on Perl programs, rather than fooling around much with
code that is already in pretty good shape. However, the newest version (now
on the web page cited above) does give you the ability to set options that can
cause it to rework your code more drastically (ignore original newlines, put
opening curly brace with keyword or on next line, specify indentation levels,
etc.)
At a later date, I might try to work on the finer details that this guy desires,
but believe me, with a language that allows such diverse forms of expression as
Perl,
it's enough of a struggle to recognize most of the common variations and avoid
mutilating the program by mis-identifying the feature;
e.g., mistaking s;a;b;ogx for a line ending in s, followed by another that
consists
only of "a;", etc., rather than classifying it as a substitution operator.
The version that arrived on the web page today is significantly improved over the
earlier version, thanks in part to the 170 people who submitted code samples that
showed me some of the weaknesses with the earlier version!
Thanks! And please try the new version!
--
Tim Maher
JAPB (Just Another Perl Beautifier)
tim@consultix.wa.com
------------------------------
Date: Thu, 06 Aug 1998 19:05:18 -0700
From: Steve Palincsar <palincss@tidalwave.net>
Subject: Re: Perl Docs.. forget the original post
Message-Id: <35CA60DE.2014@tidalwave.net>
I'd feel a great deal better about this post if the
author bothered to use a real name. I find it hard
to respect anybody with a name like no.unsoliciteds -
although I have a strong suspicion that the anonymous
author is somebody for whom I already have no
respect whatsoever...
no.unsoliciteds@dead.end.com wrote:
>
> Jaime Metcher wrote:
>
> >Essentially, they are writing it for themselves and people like them, as a
> way to express and share >the depth and breadth of their knowledge. They
> don't have "useability" departments doing random
> >tests on Joe Average to see if he understands. They don't care about that
> and there's no reason why > they should.
>
> All I can say is this - if the gurus had had bad tempered, ecclectic, obtuse
> and sometimes downright abusive lecturers with bad communication skills
> perhaps they would have a different attitude now. They don't care, you're
> right, but if they don't then why are they writing documentation that is
> supposed to expalain something. If I keep speaking at you in Chinese you're
> going to learn something after a while (not)- Well the QURGE function is just
> like the C QURGE. Great, so do I have to learn C just so I can understand
> what the function does? Or UNIX, or AWK, or SED, or SHELL? Don't get me wrong
No, I have to disagree -- and I speak as a person who came to Perl from
awk on Windows, without any meaningful unix experience other than a
couple of horrible days trying to access a cranky slow unix system
using a first generation mac as a terminal, having to read the screen
through my bifocals, and with enough knowledge of C as to be able to
spell it correctly. A classic example of an "accidental programmer",
who came to awk via Basic and then Forth, plus a number of assorted
application scripting languages.
I came because awk was better than any tool I'd used previously
for the data munging and text wrangling I found myself doing;
I came to Perl because I hit awk's built-in limits and found
it wasn't up to my needs.
I have _often_ found the docs to be over my head. They are, after
all, written for an audience with skills very different than mine.
So I have turned to the Llama and the Camel and the Panther and
a few other 4-5 camel books you'll find mentioned on the perl.com
site, to the Aho, Weinberger & Kernigan awk book for my explanation
of how printf works (although I'm happy to say that's now included
in the perl docs). There I have found authors who have made it
their job to explain things for a less well qualified audience.
You might call that spoon-feeding; I don't.
> I dislike people who try to get me to think for them just as much as the next
> user, but these references are just as lazy, because they make me think for
> whoever wrote it, because they couldn't be bothered finding a better way of
> saying it.
If you don't like the free docs, there are many commercial alternatives.
Some of them are significantly better -- and for better, read "explained
in more detail, in a far less concise and terse manner, written for
an audience with less of a background". I suggest you try them,
rather than complaining that the immense amount of free documentation
doesn't suit you.
Alternatively, I suppose you could also find some alternative to
Perl -- especially if you find the embedded unixisms offensive.
On the other hand, you could take the approach I did, invest
some time and money in documentation you do like (and I
wholeheartedly endorse everything on the perl.com site
that got 4 or 5 camels), read this newsgroup, and who
knows -- you may find yourself developing an appreciation
for the unix way.
You may even wake up one day and discover you have turned
to the Dark Side (for surely regexp's are the very Heart
of Darkness at the core of the Dark Side of the Force),
seduced by the power of Perl. It happened to me.
Steve Palincsar
------------------------------
Date: Thu, 06 Aug 1998 22:30:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl+ftp
Message-Id: <Pine.GSO.4.02.9808061530060.6559-100000@user2.teleport.com>
On Thu, 6 Aug 1998, MIKE KY wrote:
> Does anyone know of a really good ftp program written in perl that can
> capture multiple files off the web and ftp them to the server?
I don't, but you could write one, with the help of a few modules, in a few
minutes. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 6 Aug 1998 23:34:11 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Problems with File::Find
Message-Id: <slrn6sjqbb.ekt.sitaram@diac.com>
On 5 Aug 1998 12:33:56 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, mark-lists@webstylists.com (Mark Thompson) writes:
>:Could anyone tell me where they got the version that I have? Is it from a
>:version of File::Find that no longer exists?
>
>The issue is that the Exporter does the wrong thing. You have to
>import those yourself, using this
>
> *name = *File::Find::name;
> *dir = *File::Find::dir;
>
>The *foo = \$P::v import won't work here. Why not is a long story.
Just FYI to Mark: this doesnt work because name and (I think) dir
are being localised inside File::Find.
The way I think of this is that a glob is a "pointer" to the other
5 (or is it 7 or 8?) slots for the different kinds of symbols
(each of which holds a "pointer" to the actual value).
When you assign a glob to a glob, you get this "master pointer".
After that point, if the "pointer" in the "$" slot of the glob for
"name" changes, your local copy sees the changes also.
If you merely assign a scalar reference to a glob (a partial
import), then you get the "pointer" value of that slot only. This
is like a snapshot at that point in time, and it can change if, in
the other package, there is a subsequent local()isation. Then you
won't see the new value - you'll still be looking at the old one.
That's how I think of it, anyway - although it is certainly not
pedantically correct.
Thanks to Tom (of course) for telling me this when I was having a
similar problem I forget the details of... (wasn't too long ago
is all I remember). But the explanation above is entirely mine -
I dont want people to think Tom is capable of such a simplistic
one :-)
------------------------------
Date: 6 Aug 1998 23:34:09 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Putting \r\n at end of lines using format and write
Message-Id: <slrn6sjmh8.ekt.sitaram@diac.com>
On Tue, 4 Aug 1998 09:01:53 -0200, stefan@consilia.aland.fi
<stefan@consilia.aland.fi> wrote:
>On 4 Aug 1998, Russ Allbery wrote:
>
>> stefan@consilia.aland.fi writes:
>>
>> > I have written a module that parses a textfile and format printfiles.
>> > The problem is that I'm running it under linux but the actual printing
>> > is done on a printer that needs \r\n (eg DOS-format) at end of each
>> > line, otherways the printouts are all messed up.
>>
>> > Now I tried using $\ without any luck. I write everything to STDOUT.
Sorry I have a bad newsfeed and someone might have already
replied.
What you really should be doing is fixing the /etc/printcap entry
in some way. For instance, your description of the problem sounds
like
ls|lpr
will have the same issue. If that's correct, please ask in some
Linux newsgroup or email me - I'd be glad to help any way I can.
Nothing to do with Perl - so dont fix it in Perl.
------------------------------
Date: 6 Aug 1998 22:20:56 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Retrieving the value of a matched pattern
Message-Id: <6qda88$545$2@marina.cinenet.net>
Jason Patton (jpatton@dazel.com) wrote:
: When matching a pattern, where you know the format of the pattern but not
: the actual values therin, what is the best way to retrieve that value??
:
: Example: You have a program that reads in text that contains a URL
: somewhere within. You want to determine the exact URL so that you can
: create a valid HREF tag around the text. Sure you can match the http://
: at the beginning of the string and the .html at the end, but how do you
: determine the value of the text in between?
This topic has been much discussed here; in brief, you can't for the
general case of URLs floating in other text. You can get the false
positive or false negative rates arbitrarily low with enough effort in
crafting the URL-finding code. Note that finding the end is the hard part
of this task -- it could be .html, or .htm, or a raw dir name with or
without /, or the server could be www.htmlstuff.com, or...
If you really just want to get a list of all substrings in a string which
start with 'http://' and end with '.html', this will do the trick:
@urls = m!(http://.*?\.html)!g;
: This seems to be a recurring problem for me. I always have to come up
: with some bizzarre hack to find the unknown value. There has got to be a
: sane way to do this - despite the lack of attention to the problem by the
: perl faq and all of the perl books that I own.
Capturing matched values is well covered by the Llama and the Camel, and
by perlre for that matter. What books do you own?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 6 Aug 1998 22:51:09 GMT
From: hivnor@shore.net (Todd Hivnor)
Subject: Re: Setting $ENV{LD_LIBRARY_PATH} doesn't work
Message-Id: <6qdc0t$a73@fridge.shore.net>
Cool! That crazy shebang line works. And it handles
GET and POST just fine. I don't understand *why* it
works, but it certainly does.
But I'm a little paranoid seeing an eval line in CGI script.
And it seems a bit wasteful to spawn both a /bin/sh and a perl
for each hit.
So I may play with LD_RUN_PATH a bit.
And I may try to get my ISP to add symlink.
But I'm off and running now, without that silly csh redirector ...
Thanks !
-- Todd
------------------------------
Date: 6 Aug 1998 18:50:24 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: Setting $ENV{LD_LIBRARY_PATH} doesn't work
Message-Id: <6qdfg0$frs@fumnix.metronet.com>
hivnor@shore.net (Todd Hivnor) writes:
)
) I get DynaLoader errors for the Oracle driver unless I set
) LD_LIBRARY_PATH. But the bizzare thing is that I have to set
) LD_LIBRARY_PATH in a csh script which spawns my Perl script.
[...]
) BEGIN {
) $ENV{LD_LIBRARY_PATH} = '/usr/oracle/lib';
) }
Try something like this:
BEGIN {
if( ! $ENV{LD_LIBRARY_PATH} ) {
$ENV{LD_LIBRARY_PATH}= '/usr/oracle/lib';
exec( "/usr/bin/perl", $0, @ARGV );
}
}
I think the "loader" reads in the value of LD_LIBRARY_PATH
when Perl is loaded and doesn't check for changes to the
environment variable each time it tries to load a shared
library.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Thu, 06 Aug 1998 16:16:31 +0100
From: jkiser <jkiser@best.com>
Subject: signals in Win32 Perl
Message-Id: <35C9C8CE.24E6DBDD@best.com>
Has anyone had consistent success with signals in Perl. I have some
scripts that work fine on UNIX that I use to close sockets cleanly when
a CTRL-C has occurred but when I run them on the PC, CTRL-C kills the
script without calling the interrupt routine. Is this a common problem
with Win32 Perl (I've tried both 5.00469 and 5.005) or do you have to
handle signals in a slightly different fashion for the PC version. Here
is a shortened example of the code:
############################################################
$SIG{'INT'} = sub { close(SOCKET); die "Closed socket\nexiting...\n" };
while(1)
{
do some stuff
...
...
}
############################################################
Any help would be appreciated. Thanks
Jeff Kiser
jeffk@synplicity.com
jkiser@best.com
------------------------------
Date: 6 Aug 1998 22:38:50 GMT
From: Gregory Tod <gtod@netscape.net.au>
Subject: Re: Teaching Perl
Message-Id: <6qdb9q$pn8$1@otis.netspace.net.au>
Peter Scott <psj@euclid.jpl.nasa.gov> wrote:
> Then I would spend as much time as necessary in the course teaching
> them *how to learn* Perl, since IMHO no-one who "[has] no knowledge of Perl
> at all" is going to learn enough in one day to decipher someone else's
> code if that code uses references.
Having recently spent 2+6+6 hours over three days with a group of experienced
programmers 'Introducing Perl' I'd heartily agree with this.
FWIW I'd advise having a well marked set of fall back positions because
if your experience matches mine you will cover the material a lot more
_slowly_ than you expect - especially if you let them ask questions (which
seems only sensible).
--
Gregory Tod gtod@netspace.net.au
------------------------------
Date: Thu, 06 Aug 1998 16:23:27 +0100
From: jkiser <jkiser@best.com>
Subject: Re: Teaching Perl
Message-Id: <35C9CA6F.6E66B749@best.com>
Daniel,
I had an very similar scenario where I was to teach a class in beginning
perl. From experience, I think your agenda looks fine. I tried to cram
too much information into my class and I think it just confused a lot of
people. Also, my course was just 4 hours. I only got halfway through
my course notes. I have posted the exact course in HTML format if you
want to take a look at it and get a vague idea of how my pacing was.
They are located at:
http://www.jeffee.com/perl.html
Like I say, in 4 hours, I got through about exactly half of this and
that was going at a somewhat uncomfortable pace for the students. Hope
this helps
Jeff Kiser
Daniel Grisinger wrote:
> I have been asked by my boss to teach a one day perl
> course to a group of C, C++, and Powerbuilder
> developers. I have never taught anyone Perl before,
> though, and would like some input about my classroom
> plan.
>
> Since I only have one day, and since none of the people
> I will be working with have any knowledge of perl
> at all, I am going to try to present a broad overview
> of the basics of programming in perl. I'm currently
> planning on presenting the following topics-
>
> 1. Data types
> This will cover scalars, arrays, and hashes (I don't
> think I'll try to explain typeglobs, though). I
> will also focus on the difference between a list and
> an array.
>
> 2. References
> Since I will be dealing with C and C++ guys I don't
> expect many difficulties explaining perl's equivalent
> of pointers.
>
> 3. Context
> The difference between scalar and list context. From
> everything I've read about Chip's and Tom's teaching
> experiences this is one of the most important things
> to impart.
>
> 4. Subroutine semantics
> The semantic and syntactic differences between calling
> C<some_sub()> and C<&some_sub()>. I will also cover
> @_ and the issues to be aware of when passing complex
> datatypes. I will not cover prototypes.
>
> 5. Where to find more
> I intend to spend some time familiarizing the class
> with where the perl documentation can be found, how
> to search it effectively, and what it contains. My
> thought is that if I can provide my students with
> the basic knowledge and understanding of the available
> resources I will be doing them a greater favor than
> if I just tried to explain everything about perl
> in 8 hours.
>
> I am wondering if I am setting myself up for problems with
> the above course-plan. I'd really like to get some input,
> especially from people who have taught perl classes before.
> In particular, I am afraid that the above topic group
> may miss something important.
>
> Regards,
> dgris
> --
> Daniel Grisinger dgris@perrin.dimensional.com
> "No kings, no presidents, just a rough consensus and
> running code."
> Dave Clark
>
------------------------------
Date: Thu, 06 Aug 1998 18:52:50 -0500
From: brett@tvdata.com.nospam.please (Brett Goldstock)
Subject: wildcards don't work with link function?
Message-Id: <brett-ya02408000R0608981852500001@news.tvdata.com>
It looks like the link function will accept neither wildcards nor
directories (without a file) as arguments. Is there a way around this?
Alternatively, is there some code lying around somewhere to take a wildcard
filename and return the real filenames?
thanks.
-Brett
--
|Brett M. Goldstock brett@tvdata.com|
|Senior Technical Analyst/Sys Admin http://www.tvdata.com|
|TVData 800/833-9581|
| "We tell the world what's on TV." |
------------------------------
Date: 06 Aug 1998 16:10:15 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: wildcards don't work with link function?
Message-Id: <m3n29hhfl4.fsf@windlord.Stanford.EDU>
Brett Goldstock <brett@tvdata.com.nospam.please> writes:
> It looks like the link function will accept neither wildcards nor
> directories (without a file) as arguments. Is there a way around this?
link? Why would you want this for link?
> Alternatively, is there some code lying around somewhere to take a
> wildcard filename and return the real filenames?
perldoc -f glob may be what you want.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 6 Aug 1998 19:01:01 -0400
From: allbery@kf8nh.apk.net (Brandon S. Allbery KF8NH)
Subject: Re: wtf is the obsession with "foo" and "bar"
Message-Id: <6qdcjd$j8f$1@rushlight.kf8nh.apk.net>
Also sprach MARTIN@RADIOGAGA.HARZ.DE (<35c9f286.524144494f47414741@radiogaga.harz.de>):
+-----
| Kim Saunders (kims@tip.net.au) wrote:
| : Why are "foo" and "bar" ALWAYS used as example names in anything unix
| : related, and partularly perl? What is the origin? What do they mean? (foo i
| : can handle). Why aren't people more imaginative when they do stuff, and use
| : their own things? It's rather irritating sometimes.
|
| The Jargon file has to say the following about "foo":
+--->8
(long exposition deleted)
Interesting.
I first encountered them in a book about MACLISP --- where the metasyntactic
variables were: foo, bar, baz, gunk.
--
brandon s. allbery [os/2][linux][solaris][japh] allbery@kf8nh.apk.net
system administrator [WAY too many hats] allbery@ece.cmu.edu
electrical and computer engineering
carnegie mellon university (bsa@kf8nh is still valid.)
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3383
**************************************