[7233] in Perl-Users-Digest
Perl-Users Digest, Issue: 858 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 13 12:17:20 1997
Date: Wed, 13 Aug 97 09:00:29 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 13 Aug 1997 Volume: 8 Number: 858
Today's topics:
A Perl compiler for Win95? (Thomas Larsson)
Re: arrays <bsugars@sunpub.com>
Re: Can You Title Case A String ?. (Honza Pazdziora)
Re: Can't match '3\\\3' (meta-characters) <rootbeer@teleport.com>
Create "Pause Page" during big CGI program dadamson@newtonline.com
Creating a mega-multi-dimensional hash?? <Janne.Blomqvist@lmf.ericsson.se>
Extracting a string between two tags <stefano.bonacina@st.com>
Re: Extracting a string between two tags <petri.backstrom@icl.fi>
Re: Frustration and -T (Tina Marie Holmboe)
Re: Help, this script is killing me... (Tad McClellan)
Re: How to execute remote Perl script from Perl? <lth@dannet.dk>
Re: How to open a file to a variable instead of an arra <mortensi@idt.ntnu.no>
Interaction between \Q and variable interpolation - ple <rovf@earthling.net>
Re: Is there a perl IDE? (Jeremy D. Zawodny)
Re: map problem (Bart Lateur)
Re: map problem (Tony Bass)
New perl game (Gavin Skinner)
New vocabulary (was: Re: Seeking object enlightenment) <rootbeer@teleport.com>
Re: NT Perl Sources and problem (Kitty Smith)
Re: Numbers to strings with preceeding 000's (Bart Lateur)
Re: Password Protection on a directory (Jeremy D. Zawodny)
Re: Pattern matching problem (Honza Pazdziora)
Re: Perl <petri.backstrom@icl.fi>
Re: Post Problem <petri.backstrom@icl.fi>
Re: Problems with split (Bart Lateur)
Re: Saving/restoring HASHes <prentice@patriot.net>
Re: Script testing (Jeremy D. Zawodny)
Re: Seeking object enlightenment (Bart Lateur)
Re: syslog or syslogd (Anthony J. Breeds-Taurima)
Re: textarea - Script not producing line feeds?? (Burt Lewis)
Re: Time problem. (Tad McClellan)
Traverse ~~ Heres a question for you! <jamesr@webpromote.com>
version of Perl5 for NT4 <scrivenaj@cv.port.ac.uk>
Re: Walking the tree (Bart Lateur)
Why warning of uninitialized value even if it is initia <rovf@earthling.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Aug 1997 19:45:16 GMT
From: thomas.larsson@vpress.se (Thomas Larsson)
Subject: A Perl compiler for Win95?
Message-Id: <33f0bce5.5969983@news.multi.se>
Can anyone supply me with an adress to a site where I can download a
Perl compilator?
/Thomas Larsson
------------------------------
Date: Wed, 13 Aug 1997 10:44:08 -0400
From: Benjamin Sugars <bsugars@sunpub.com>
Subject: Re: arrays
Message-Id: <33F1C838.C65@sunpub.com>
David Siebert wrote:
>
> is there an esy function to find the length of an array?
Evaluate the array in a scalar context, as in:
$length = @array;
See the perldata man page.
-Ben
--
Ben Sugars <bsugars@canoe.ca>
Senior Webmaster,
CANOE Canadian Online Explorer,
http://www.canoe.ca/
------------------------------
Date: Wed, 13 Aug 1997 09:02:45 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Can You Title Case A String ?.
Message-Id: <adelton.871462965@aisa.fi.muni.cz>
Andy Marr <andy@pindar.com> writes:
> Just a quick one.
>
> I have a string "THIS IS A STRING" and I want to
> format it to "This Is A String". (Cap at the start of each word).
>
> Is there a command in Perl to do this ? , or do I have to split the
> string again and change to lower case and upper case the first letter ?
> .
>
> I know the following would work for each word in the string.
>
> @word = split ( / / ,$string);
> print ("\L\u@word[x]\E\n");
>
> It just seems the long way round , any suggestions ?.
Perl FAQ in section perlfaq4/How_do_I_capitalize_al_the_word.html says
To force each word to be lower case, with the first letter
upper case:
$line =~ s/(\w+)/\u\L$1/g;
and has other interesting examples -- you might want to check it.
Hope this helps!
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
European RC5 56 bit cracking effort -> http://www.cyberian.org/
------------------------------
Date: Tue, 12 Aug 1997 22:37:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: Re: Can't match '3\\\3' (meta-characters)
Message-Id: <Pine.GSO.3.96.970812222103.29850M-100000@julie.teleport.com>
On Tue, 12 Aug 1997, Benarson Behajaina wrote:
> Is it possible to match a string wich includes meta-characters ?
Yes.
> push(@fool, 'http://1\1','2\\2','3\\\3','4\\\\4','5\\\\\\5');
That's misleading; between the 1's you have one backslash, but between the
2's you also have just one. You have three between the 5's, even though
you probably intended to type one fewer (which would have the same result,
paradoxically enough).
> 2. Now I run this script from command line: %foo.pl 3\\\3
The shell is interpreting those backslashes. (You can't blame Perl for
everything! :-) The first two turn into one backslash, and the backslash
in front of the second three disappears. So you have just one backslash
there, really. (Try the command 'echo 3\\\3' and you should see that same
result.)
It may seem that Perl (and the shell) are odd for not obeying the rule of
What You See Is What You Get. But in this case, we put up with this small
inconvenience because the backslash is so useful for the magic it
provides. Without some kind of trickiness, there would be some strings you
simply couldn't enter in your program as literals.
Here's the general rule I use: If you want a real backslash in Perl, type
two.
That rule works because a backslash in you program's text is _always_
magical to Perl, so if you type two you always get one. With that in
mind, do you see how to get your script to do what you want? Hope this
helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 13 Aug 1997 07:21:43 -0600
From: dadamson@newtonline.com
Subject: Create "Pause Page" during big CGI program
Message-Id: <871474723.32459@dejanews.com>
Hello-
I was looking for recommendations for how I would throw up a page
that said "please wait while running script/program..."
while the cgi executed a long program followed by a page that
confirms completion - like "Program complete"?
THanks
Dag
PLease Post and Email
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 13 Aug 1997 14:16:53 +0300
From: Janne Blomqvist <Janne.Blomqvist@lmf.ericsson.se>
Subject: Creating a mega-multi-dimensional hash??
Message-Id: <33F197A5.CA429127@lmf.ericsson.se>
Hi!
I would like to create some sort of multi-dimensional hash (or array)
which would be [insert your lucky number here] levels deep.
I've looked at the examples of "hashes of hashes" etc. in the Camel
Book, 2nd edition, but I haven't figured out how to adapt those
examples for my problem...Actually, what I'm trying to do is a script
that scans C++ code and generates a class hierarchy (in HTML).
So far I've succeeded in spitting out a list (an array actually) which
contains the first line of the class definitions, i.e looks like this:
class classname : public base_class
class anotherclassname : public another_base_class
class base_class
etc.
each element of the array is one line. The final output should be
a html list looking a bit like this:
base_class
class_name
child_class
another_base_class
anotherclassname
etc.
Note that this is not supposed to be a CGI script (not that it
matters...). So now I've been banging my head against the wall for
a while trying to figure out how to generate this hierarchial list...
Any suggestions? The main problem, as I see it, is that I don't know
how to generate a hash of hashes which is n (n=1,2,3....) levels deep,
let alone print it. I've thought of generating one hash containing all
the base classes, and then other hashes which are named after the base
classes, i.e. %base_class, %another_base_class etc.
Is there an elegant way of achieving this? Could I use arrays instead
of hashes (but the basic problem would remain the same, though)? Or
can I get by without making a data structure to represent the hierarchy?
Thanks in advance!
--
Janne Blomqvist
# standard disclaimers etc...
------------------------------
Date: Tue, 12 Aug 1997 17:34:55 +0200
From: stefano bonacina <stefano.bonacina@st.com>
Subject: Extracting a string between two tags
Message-Id: <33F0829F.167EB0E7@st.com>
Hello all
can anyone suggest me how to extract the string between the two tags?
Here comes the string:
<AUTHORS>Johnstone, W.; Fawcett, G.; Yim, L.W.K.</AUTHORS>
/\ /\
|| ||
TAG TAG
Thanks in advance for your help
--
Stefano Bonacina E-mail: stefano.bonacina@st.com
SGS-Thomson Microelectronics
------------------------------
Date: Wed, 13 Aug 1997 13:44:32 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Extracting a string between two tags
Message-Id: <33F19010.1D4C@icl.fi>
stefano bonacina wrote:
>
> can anyone suggest me how to extract the string between the two tags?
> Here comes the string:
>
> <AUTHORS>Johnstone, W.; Fawcett, G.; Yim, L.W.K.</AUTHORS>
> /\ /\
> || ||
> TAG TAG
Assuming that the data between the tags doesn't contain
other tags (of the same kind):
$data = '<AUTHORS>Johnstone, W.; Fawcett, G.; Yim,
L.W.K.</AUTHORS>';
if ( $data =~ /<AUTHORS>(.*?.*)<\/AUTHORS>/s ) {
$authors = $1;
}
Consider also reading the perlre part of the Perl documentation
("Perl Regular Expressions") and/or consult a book such as
"Mastering Regular Expressions" (published by O'Reilly,
http://www.ora.com).
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: 13 Aug 1997 09:00:40 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Frustration and -T
Message-Id: <5srt3o$obf$6@news1.sol.no>
[Posted and mailed]
> Are you saying that $PerlCode in the above example was tainted? I can't
> duplicate this in my tests. If you can, could you file a bug report?
What I am saying is the following:
a.pl -> use Library ; -> $Code = eval($PerlCode) ;
a.pl is invoked with -T; it uses 'Library', which in turn create a piece of
Perl code - an anonymous subroutine - in $PerlCode, and attempt to create a
reference to that code with eval().
That didn't work very well. I attempted a:
print "[$@]\n" ;
just after the eval(), but it never came that far. When I then *removed*
the -T in a.pl - it *worked*. That is all I know.
> Are you saying that eval on a tainted string doesn't give any error
> message upon dying? I can't duplicate that either. If you can, you know
> what to do. :-)
Ohyes, I know *what* to do - I just can't :) What I hoped was that someone
*knew* what was wrong, as I can't show the code. (Don't ask. They claim that
working for $$ doesn't hurt. Much. )
But yes, I *can* replicate it *here*. I just tried.
I won't have any hair left when this is over... I'll try to get permission
to show some of the source, or create a dummy thingie.
> Thanks!
You are *more* than welcome >:)
PS: New development. To be blunt: forget it. (Yes, read behind these lines:)
--
Tina Marie Holmboe tina@mail.scandinaviaonline.se
The opinions expressed above are mine, and should in no way or under any
circumstances be associated with Scandinavia Online AB unless this disclaimer
is explicitly revoked.
------------------------------
Date: Tue, 12 Aug 1997 22:16:28 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help, this script is killing me...
Message-Id: <cu8rs5.3gr.ln@localhost>
Stephon (stephon@hempseed.com) wrote:
: To whom reads,
: Below is a script that seems to work although when I try to have the script
: read the log file so that it may read and write it screws up... Please see
: what's the matter with it... Oh, I don't care if you use it as long as you
: keep the top banner:
[snip]
: #! /usr/local/bin/perl
Where is every Perl programmer's best friend?
You should have asked perl itself to help you find your mistakes
before posting.
#! /usr/local/bin/perl -w
[snip]
: # Getting Propare Command #######################################
: if ($ENV{'QUERY_STRING'} ne '') {
: $command = "$ENV{'QUERY_STRING'}";
You don't need to copy this to an intermediate variable.
Just use '$ENV{QUERY_STRING}' wherever you would have used '$command'
: open (PIC, "$graphics");
You should ALWAYS check the return value from open():
open (PIC, "$graphics") or die "could not open '$graphics' $!";
: open (LOG, "$logfile");
You should ALWAYS check the return value from open():
open (PIC, "$logfile") or die "could not open '$logfile' $!";
: # Searching Log for Current File Access Count ####################
: open(LOG,">$logfile");
You should ALWAYS check the return value from open():
open (PIC, ">$logfile") or die "could not open '$logfile' $!";
(this will wipe out the current contents of $logfile, BTW...)
: if ($command eq 'stats') {
if ($ENV{QUERY_STRING} eq 'stats') { # works fine, wastes no memory...
: # Show File Image Access Count ###################################
: open (LOG, "$logfile");
You should ALWAYS check the return value from open():
open (PIC, "$logfile") or die "could not open '$logfile' $!";
You are now going to read the same stuff that you just already
read and then already wrote?
How come?
------------------------------------------
Now, to what I think is your question.
Do you want to open a file for both read and write?
The entry for open() in the perlfunc man pages tells how to do this.
I'm sure you already looked it up, or you wouldn't be posting.
But you neglected to tell use what part of the description given
there is unclear to you.
I'm sure someone here would be willing to explain that part, if
you would mention what part that is.
I'm less sure that someone will read the man page *for* you.
------------------------------------------
: Well, there it is; HELP HELP HELP
Well, there it is; DOCS DOCS DOCS ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Aug 1997 10:30:52 +0200
From: Lars Thegler <lth@dannet.dk>
To: destornell@ProbityITC.com
Subject: Re: How to execute remote Perl script from Perl?
Message-Id: <33F170BC.A112F848@dannet.dk>
David Estornell wrote:
>
> Is it possible to execute a remote Perl script from Perl? I would like
> to 'capture' the output from the remote Perl script and have it appear
> in-line with the output of the parent script.
>
> For example, say the URL for remote.pl is
> http://abcdefg.net/cgi-bin/remote.pl. This script executes the
> following
> command:
>
> print 'World';
>
> Now, say I am running my script parent.pl:
>
> print 'Hello ';
> # What is the real Perl code to do this?
> execute 'http://abcdefg.net/cgi-bin/remote.pl';
> exit;
You should use the LWP::UserAgent module. This will allow you to 'fetch'
the result of your URL into a perl string:
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$url = 'http://abcdefg.net/cgi-bin/remote.pl';
$req = new HTTP::Request('GET', $url);
$response = $ua->request($req);
if ($response->is_success) {
print $response->content;
}
Of course, you'd have to parse the response contents to get rid of any
tags you dont want (like <html></html> etc).
>
> Is there a perl command (or group of commands) that I could use in
> parent.pl to replace the line beginning with 'execute' so that the
> final
> output of parent.pl will be 'Hello World'?
>
> If you got the answer would you mind emailing it to me?
>
> Thanx
>
> David Estornell
> Probity Information Technologies Corporation
> 731 Street Road, Suite 1
> Cochranville, PA 19330
--
Lars Thegler mailto:lth@dannet.dk
Internet Development http://www.dannet.dk
Dan Net A/S phone: +45 45 82 16 00
Blokken 9 - DK-3460 Birkeroed - Denmark fax: +45 45 82 16 44
------------------------------
Date: 13 Aug 1997 07:44:46 GMT
From: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: How to open a file to a variable instead of an array?
Message-Id: <5srole$8hg$1@due.unit.no>
Tom Phoenix <rootbeer@teleport.com> wrote:
: On 12 Aug 1997, Morten Simonsen wrote:
: > I would say it's only to make trouble.
: I would say that you would be wrong. :-) (What motive would someone have
: to wish "only to make trouble"? Wouldn't they be able to make more trouble
: more easily than by taking the trouble to write out an answer to a
: question in a newsgroup?)
I am not so sure and of course I could be wrong. But it seems to me
that some people do take the trouble by write down an answer, just so
they can tell the guy who was stupid enough to ask, that he really was
stupid and he would have known that if he were as much into perl as
we are. But that's the whole point. That guy ain't as much into perl
as you are.
: > but I don't know wether it's especially efficient, it's just a solution:
: >
: > open(FILE,$filename);
: > read(FILE,$filevar,stat(FILE)[7]);
: >
: > Now the $filevar contains the whole FILE.
: Maybe it does, but it's likely that it doesn't. The open may have failed,
: the read may have been interrupted, other problems may have happened.
I should of course have added theese things, but this works perfectly all-
right for me. My philosophy is that nothing wrong happens if my design is
good. Hardware failure may of course occur, but in my case I won't clutter
the code with hundreds of statement '|| die "..."' just to make sure I know
what happend. But still I agree that those statement should be there.
: I hope that this won't be seen by you as only an attempt to make trouble;
: I'm sincerely trying to be helpful!
Yes, and so do I.
Morten Simonsen
------------------------------
Date: 13 Aug 1997 09:25:54 +0200
From: Ronald Fischer <rovf@earthling.net>
Subject: Interaction between \Q and variable interpolation - please explain!
Message-Id: <xz2afimh7ct.fsf@uebemc.siemens.de>
I am faced with the following problem: Given that
$s='var = $abc';
, how to write a statement that substitutes in $s the first occurence
of $abc by REPL?
My first try was to write
$s =~ s(\Q$abc)(REPL); print "$s\n";
but this prints
REPLvar = $abc
. Interestingly, substituting the $ alone, as in
$s =~ s(\Q$)(REPL); print "$s\n";
results in
var = REPLabc
as expected. From this, I conclude that variable interpolation takes
place before interpretation of \Q.
Of course, there is an easy work around in this case: I could write
the substitution as
s(\$abc)(REPL)
and this would work fine. But the reason I use \Q is that the "real"
example is more complicated, and \Q would come handy, so I am
surprised that \Q does not work as expected.
I could accept this (after all, \Q promises to meta-quote only regular
expression characters, and a '$' is - at least if used that way - not
a special re-character), were not an entry in the camel book that
describes the quotemeta function which says that "this is the internal
function implementing the \Q escape". Now it happens that
quotemeta '$abc'
returns
'\$abc'
which is exactly what I wanted, so I would like to know why
s(\Q$abc)(...)
does NOT work like
s(\$abc)(...)
Probably it has to do with the way expressions are parsed?
--
Ronald Fischer (rovf@Earthling.net) (PGP public key available)
http://ourworld.compuserve.com/homepages/ronald_fischer/
[When posting a followup, mailing a courtesy copy is fine, provided it is
clearly marked as such.]
------------------------------
Date: Tue, 12 Aug 1997 12:40:38 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Is there a perl IDE?
Message-Id: <33f05964.338299398@igate.hst.moc.com>
[cc'd to original author]
On 11 Aug 1997 21:03:27 -0700, danny@lennon.postino.com (Danny Aldham)
wrote:
>John Dallman (jgd@cix.compulink.co.uk) wrote:
>
>: Read the license agreement. You can't sell perl for money.
>
>I hope this is wrong. Certainly not my take on the license agreement.
But what else would you sell it for, if not money? :-)
Seriously, though, what in the license prevents someone from selling
Perl for money? I've read it, and there are conditions under which
it's perfectly legal.
MKS has a verion of Perl that they sell in the MKS Toolkit. Larry has
never sued them (that I know of).
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 13 Aug 1997 12:03:21 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: map problem
Message-Id: <33f68fc4.8139994@news.tornado.be>
Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal) wrote:
>I want to use map() to cut off some string (conditionally) from array elements.
>Please consider:
>
>@a = qw( aaabb cccbb ddd eee );
>
>@b = map { s/bb$//; } @a;
>
>The result: @bbb is equal to ('1','1','',''). Obviously the @b array is filled
>with "true" or "false", depending on whether or not the substitution succeeded,
>but I'd rather like to have the result of the substitution.
Try this instead:
@b = map { s/bb$//; $_ } @a;
Now @b will contain the values you want, but, so will @a (in place
substitution).
HTH,
Bart.
------------------------------
Date: 13 Aug 1997 09:15:38 +0100
From: aeb@brains.cartoon.bt.co.uk (Tony Bass)
Subject: Re: map problem
Message-Id: <5srqfa$la7$1@brains.cartoon.bt.co.uk>
>From article <5sprvb$gjf@buffalo.HL.Siemens.DE>, by Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal):
> I want to use map() to cut off some string (conditionally) from array elements.
> Please consider:
> @a = qw( aaabb cccbb ddd eee );
> @b = map { s/bb$//; } @a;
> The result: @bbb is equal to ('1','1','',''). Obviously the @b array is filled
> with "true" or "false", depending on whether or not the substitution succeeded,
> but I'd rather like to have the result of the substitution, i.e.
> ('aaa','ccc','ddd','eee'). Can You please give me a hint what's wrong here?
> Can I use map() at all for this task?
my @b = map { /^(.*?)(?:bb)?$/ } qw( aaabb cccbb ddd eee );
The list result of the match is the string matched (non-greedily) by
.*?. (?:bb) matches trailing bb without output.
Tony Bass
--
# A E Bass Tel: (01473) 645305
# MLB 3/19, BT Laboratories e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE DO NOT e-mail to From: line
# Opinions are my own
------------------------------
Date: Wed, 13 Aug 1997 09:50:59 +0100
From: gavin@cursor.com (Gavin Skinner)
Subject: New perl game
Message-Id: <gavin-1308970951300001@158.152.170.191>
Hi,
I've just written a simple version of Consequences, using Perl. You can
write new stories filling in the blanks for 'He said, she said', and so
on, and then read randomly generated consequences stories, using bits from
stories already typed in.
Just a bit of fun!
See it work at
http://www.cursor.com/diversions
Also - Perl Pangolins, which has been there for a while. Soon, it will
know about all the animals in the world!
Let me know what you think!
Gavin.
------------------------------
Date: Wed, 13 Aug 1997 08:09:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bart Lateur <bart.mediamind@tornado.be>
Subject: New vocabulary (was: Re: Seeking object enlightenment)
Message-Id: <Pine.GSO.3.96.970813075453.10950K-100000@julie.teleport.com>
On Tue, 12 Aug 1997, Bart Lateur wrote:
> I think OOP in Perl is daunting to a lot of people like me, because of
> this rather strange naming convention.
Every field has some special words and meanings which you have to learn to
get into the field. In equine matters, the word "hand" is special. An
attorney's briefs are not the same as a haberdasher means by that word. A
dog breeder has a different idea than a sports promoter about what
"boxers" are, and they both disagree with that haberdasher. When you pay a
ship's seams, you're doing something far different than when you pay a
ship's captain.
In the world of computers, you've learned new usages for words like fork,
shell, tar, core, and float. You probably didn't even balk at learning
that it's normal for a program to kill its children. :-)
Sure, the names are odd. They may even be different than what other
programming languages use for the same concepts. But don't let new words
stop you from learning what you want to learn!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 12 Aug 1997 16:04:42 -0500
From: smith@twsuvm.uc.twsu.edu (Kitty Smith)
Subject: Re: NT Perl Sources and problem
Message-Id: <19970812.160444.793242.NETNEWS@TWSUVM.UC.TWSU.EDU>
I am looking for NT Perl sources on the Web. In particular, I am
looking for some way to determine the username of the person accessing
the page, as opposed to their IP address. Is this possible? There
are all kinds of ENV variables for the server, but I didn't see
anything for the client apart from their IP.
Thanks for any help you can provide.
Kitty Smith
------------------------------
Date: Wed, 13 Aug 1997 12:03:06 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Numbers to strings with preceeding 000's
Message-Id: <33f489a3.6575950@news.tornado.be>
Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:
>Oh come on, it's perl. There's More Than One Way To Do It. Here's ten.
>
> $i=243;
> $zero=sprintf("%04d",$i);
You forgot this really simple one (that makes eleven):
$ten=substr("0000".$i,-4);
I hate obfuscation.
HTH,
Bart.
------------------------------
Date: Wed, 13 Aug 1997 12:34:58 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Password Protection on a directory
Message-Id: <33f1a9c2.424409658@igate.hst.moc.com>
[cc'd automagically to original author]
On 12 Aug 1997 22:40:11 GMT, "Greg Meechan" <gregmee@vianet.net.au>
wrote:
>Jeremy D. Zawodny <zawodny@hou.moc.com> wrote in article
><33f05b1d.338740422@igate.hst.moc.com>...
>> [cc'd to original author]
>>
>> >I've tried to FTP a .htaccess file across, I've tried to FTP a htacess
>file
>> >across and then rename it .htaccess. However, none of these work!
>> >
>> >Does anyone have any suggestions
>>
>> Yeah, contact the ISP and ask them to fix the problem, or at least ask
>> them what the proper procedure is.
>
>Thanks for the suggestion.
>
> I've mailed their support five times and have never had a reply to ANY of
>them. I recently sent a snail mail letter to their General Manager
>complaining about the situation. In the meantime my client is anxious to
>get the site up and running. Thus I thought someone else may have an
>solution.
That's too bad.
Sounds like it may be time to switch providers, because it certainly
sounds like a problem on their end.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 13 Aug 1997 08:53:22 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Pattern matching problem
Message-Id: <adelton.871462402@aisa.fi.muni.cz>
"CPT" <cpt@cvd.com.tw> writes:
[...]
> My Program:
> open (DEPT,"dept");
> open (LOG,"maillog");
>
> while (<DEPT>) {
> $send_total_letter=0;
> $send_total_bytes=0;
> chomp $_;
> $dept=$_;
>
> while (<LOG>) {
> if ($_ =~ /$dept/) {
> print "OK","\n";
> }
>
> Result:
> It won't print any OK.But I change $dept to mis .It works fine.
> Could you tell me what's wrong with my code.
You should do a chop (or chomp) on the value you want to match,
because the mis in log file is not at the end of line.
Hope this helps!
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
European RC5 56 bit cracking effort -> http://www.cyberian.org/
------------------------------
Date: Wed, 13 Aug 1997 14:10:22 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Perl
Message-Id: <33F1961E.5050@icl.fi>
Jester T Great wrote:
>
> Do you know where I can find a place to have perl... I can't find it.
Where did you look?
Did you try services such as
http://www.dejanews.com
or
http://altavista.digital.com
?
If not, do try to learn how to use them, so that
next time you don't have to post in a newsgroup
and wait for an answer thay may never appear.
As an excercise try to use DejaNews to search
this newsgroup for a posting that describes
what a good, descriptive subject line should
contain (you already seem to know how to write
a non-descriptive one ;-)
Nevertheless, see also
http://www.perl.com/perl/
http://www.perl.com/FAQ/
http://www.perl.com/CPAN/
http://www.activeware.com
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: Wed, 13 Aug 1997 13:56:55 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Post Problem
Message-Id: <33F192F7.7D17@icl.fi>
Rico Hawes wrote:
>
> I have a problem with a recursive chat script I am writing in perl. The
> first few time I call it, in the location bar it will just have the url to
> the script. That's what I want, but after that, each time I call the
> script it puts all of the form arguments
It isn't because of Perl, that's for sure. Nevertheless, use method POST
instead of GET.
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: Wed, 13 Aug 1997 12:07:10 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Problems with split
Message-Id: <33fba2df.12649392@news.tornado.be>
crr026@email.mot.com wrote:
>I want to store the pattern part of split into a variable. However, the
>following try
>
>#!perl
>$Line = "one|two|three";
>print "$Line\n";
>$sep = "\|";
>@Atoms = split (/$sep/, $Line);
>foreach (@Atoms) {
> print "$_\n";
>}
>
>gives me this output
>
>one|two|three
>o
>n
>e
etc.
>Can someone explain what's wrong with my program?
Yes. $sep is set to '|'. This has a special meaning in regular
expressions: alternatives. /|/ is the same as //, so split behaves that
way, by splitting into characters.
Do this:
$sep = '\|';
Lo and behold! It works.
HTH,
Bart.
------------------------------
Date: Mon, 11 Aug 1997 21:56:25 -0400
From: Ann & Matthew Prentice <prentice@patriot.net>
Subject: Re: Saving/restoring HASHes
Message-Id: <33EFC2C8.BA74993B@patriot.net>
Daniel J. Wandeler wrote:
> I am creating a fairly large hash, and I would like to save the state
> of to a file, so that I can open it at a later time. Ideally I would
> like to create the hash on disk rather than in memory. Are there any
> perl5 modules which handle this?
>
> -- Dan
>
> ------
> ----------------------------------------------------------------
> Daniel J. Wandeler email: Daniel.Wandeler@amd.com
> Advanced Micro Devices wando@miro.amd.com
> CAD Technology & Systems voice: 512/602-2838 or 1-800-538-8450
> x52838
> Austin, TX fax: 512/602-9649 or
> x59649
> ------
> ----------------------------------------------------------------
How about the dbmopen and dbmclose commands? Page 154, 2nd Edition
Programming Perl from O'Reilly.
dbmopen %hash, "/directory/filename", 0666
... manipulate hash as normal
dbmclose %hash;
No need to pull in extra modules.
Matthew
prentice@patriot.net
------------------------------
Date: Wed, 13 Aug 1997 12:49:11 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Script testing
Message-Id: <33f1ad04.425243357@igate.hst.moc.com>
[cc'd automagically to original author]
On Wed, 13 Aug 1997 02:47:25 -0400, "Shane P. Miles"
<yngwie@erols.com> wrote:
> Where can I get a hold of a personal web server so I can try out my
>scripts? I've searched with very little luck.
Uhm, that really depends what Operating System you're running. Both
Microsoft and Netscape have products for Win32 based systems.
Linux & other Unix users could use Apache.
Check in the comp.infosystems.www.servers* groups and see what's out
there...
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 13 Aug 1997 12:03:11 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Seeking object enlightenment
Message-Id: <33f58ba0.7079942@news.tornado.be>
gbacon@cs.uah.edu (Greg Bacon) wrote:
>Well, an object has been blessed with the ability to do method searches
>(which is the bit about "remembering" that Randal alluded to), i.e. it
>"remembers" a starting point to look for methods called against it.
Ah, I see. So the object is "blessed with extra gifts from the gods (=
Larry et al :-)". Not the kind of blessing I was thinking about...
>The best way to learn Perl's flavor of OO programming is to write a
>(perhaps simple) class of your own. You'll immediately get a feel for
>it, and it will no longer be as daunting. As for English... :-)
Which brings me to... modules, "use" etc.
I just cannot get a feel for it. Packages and "require" are easy. Can
somebody please (pretty please) demistify pragma's, and explain exactly
what's happening when a program encounters either "use" or "no"?
A simple explanation (like Randal's explanation about "bless") might do
wonders for people still clingling on to Perl4-isms... :-)
HTH,
Bart.
------------------------------
Date: 13 Aug 1997 10:05:38 GMT
From: tony@poseidon.canningcollege.wa.edu.au (Anthony J. Breeds-Taurima)
Subject: Re: syslog or syslogd
Message-Id: <871509641.687273@proteus.cantech.net.au>
Mark Kogon (mark@usaor.net) wrote:
: Does anyone know how to utilize syslog or syslogd using PERL
: I have been unable to generate a working program that effectively uses this
: utility.
: Any help would be greatly appreciated.
if you have 5.003+ you can use something like:
#!/usr/bin/perl
use Sys::Syslog;
print "(0)\n";
openlog('TEST', 'cons,pid', 'user');
print "(1)$res\n";
syslog('info', 'this is another test');
print "(2)\n";
syslog('mail|warning', 'this is a better test: %d', time);
print "(3)\n";
closelog();
print "(4)\n";
BUT be sure that your syslogd has been started with the -r (accept remote
socket connections) flag, or what ever the equivilent is on your OS
Yours Tony.
------------------------------
Date: 13 Aug 1997 12:28:57 GMT
From: burt@ici.net (Burt Lewis)
Subject: Re: textarea - Script not producing line feeds??
Message-Id: <5ss9a9$j2p$1@bashir.ici.net>
Jason,
That's what I'm doing now - wrap=hard
Just what I was looking for.
The help and feedback in this group is awesome - thanks everyone.
Burt Lewis
burt@ici.net
www.eastonmass.com
In article <5so8ca$p26$1@News.Dal.Ca>, ap958@chebucto.ns.ca says...
>
>: On 4 Aug 1997 14:52:23 GMT, Burt lewis@ici.net (Burt Lewis) wrote:
>
>: ()In my Perl scripts I have:
>: ()
>: ()print "<TR><TD><textarea Rows=8 Cols=65 name=\"body\"
>: ()wrap=\"physical\"></textarea></TD></TR>\n";
>: ()
>: ()Problem is that I need line feeds after each line that is wrapping
>: and
>: ()I'm not getting any. The input is coming out as one long string
>: with
>: ()no breaks.
>: ()
>: ()Any ideas or suggestions is appreciated.
>
> If your problem is that you are getting your info from the form in
>one long line, you might want to try changing your textarea tag to
>wrap=hard. I find that this works for me, and all the data I get from my
>textarea fields comes through in multiple lines.
>
> Hope this helps, Jason
>
>---------------------
>Jason Nugent, BSc(Hons)
>ap958@chebucto.ns.ca "My strength is in numbers, and my soul
>Webmaster lies in every one. The releasing of anger
>Member, HTML Writer's Guild can better any medicine under the sun."
>
>Live to ride, - Pantera, Mouth for War
> Ride to Live.
>********************************************************************
>The Best Place for Sport on the net! - Sportscience www.sportsci.org
>********************************************************************
------------------------------
Date: Tue, 12 Aug 1997 22:19:35 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Time problem.
Message-Id: <749rs5.3gr.ln@localhost>
Charles Boone (ccboone@amber.indstate.edu) wrote:
: I am using perl to gather some info from wtmp. I just happened to
: notice that when I convert the login time it gives me the wrong month
: ex. 7 for Aug instead of 8. I was wandering if there is a bug in
: 5.003 or what.
perlfunc man page (my underlining):
-------------------------------
=item localtime EXPR
Converts a time as returned by the time function to a 9-element array
with the time analyzed for the local time zone. Typically used as
follows:
# 0 1 2 3 4 5 6 7 8
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
All array elements are numeric, and come straight out of a struct tm.
In particular this means that $mon has the range 0..11 and $wday has
^^^^^^^^^^^^^^^^^^^^^^^^
the range 0..6 with sunday as day 0. Also, $year is the number of
years since 1900, that is, $year is 123 in year 2023.
...
-------------------------------
Does that help?
: Please email me ccboone@amber.indstate.edu
Please read the newsgroup where you asked the question.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Aug 1997 10:04:32 -0500
From: James Rudny <jamesr@webpromote.com>
Subject: Traverse ~~ Heres a question for you!
Message-Id: <33F1CD00.A158EE0C@webpromote.com>
Hola! :)
I was wondering if there is someone out there who wrote a Traverse
program that will go though a web site grab all the URLs off the page
and keep following thoes URLs until it is so deep. If someone out there
wrote a program like that ~~ could you please send it to me! I have been
trying to make this program with the LWP Libs. and they -DONT- work.
<laughs> So if you already did such program please email me:
chaotic@rli-net.net
I would really aprricate it. Thanks for taking the time to read this,
hopefully there is someone smart out there.
(BTW -- if you know where I could find such program .. ie: on one of
thoes SCRIPT 4 FREE pages thoes will work too)
Thanks!
Matt Spaid
------------------------------
Date: Wed, 13 Aug 1997 14:14:40 +0100
From: John Scriven <scrivenaj@cv.port.ac.uk>
Subject: version of Perl5 for NT4
Message-Id: <33F1B316.3845@cv.port.ac.uk>
Hi!
I am looking for a vesion of Perl working under NT4.
I haven't found anything on the homepage of Perl.
Can you help with this please?
by the way any explanations, tips or links about how to install
Perl on NT4 for is welcome.
Thanks
Please reply at this e-mail address :
michauts@adc.port.ac.uk
--
------------------------------
Date: Wed, 13 Aug 1997 12:03:24 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Walking the tree
Message-Id: <33f89a96.10744208@news.tornado.be>
Jeff Masiello <jmasiello@presstar.com> wrote:
>We have a Unix server which needs massive cleaning. I just learned perl
>but I would like to write a program which walks the directory structure
>and catalogs files by directory giving their locations. it would be
>easy if the foreach loops read directories first but they don't. I'm
>using the -d test but how do I get it so it lists all the files first
>and then moves on to the next subdir?
Let me guess. You want them in alphabetical order too?
Then you may try this. PC users should skip files "." and "..".
sub scanDir {
my($dir)=@_;
my(@file,@dir);
my($sep)="/"; # platform dependent
opendir(DIR,$dir);
@file=readdir(DIR);
closedir(DIR);
@dir = sort grep { -d "$dir$sep$_" } @file;
@file = sort grep { -f "$dir$sep$_" } @file;
foreach (@dir) {
# next if /^\.+$/; # PC only
&scanDir("$dir$sep$_");
}
local($\) = "\n";
foreach (@file) {
print "$dir$sep$_";
#You may print more specific info here, too.
}
}
HTH,
Bart.
------------------------------
Date: 13 Aug 1997 13:29:44 +0200
From: Ronald Fischer <rovf@earthling.net>
Subject: Why warning of uninitialized value even if it is initialized?
Message-Id: <xz27mdqgw2f.fsf@uebemc.siemens.de>
The command
perl -w -e 'local($a)="abc"; open($a)'
produces the warning
Use of uninitialized value at -e line 1.
In Perl 5.002.
Could someone please confirm if this still appears in 5.004, or if the
warning is correct in this case?
--
Ronald Fischer (rovf@Earthling.net) (PGP public key available)
http://ourworld.compuserve.com/homepages/ronald_fischer/
[When posting a followup, mailing a courtesy copy is fine, provided it is
clearly marked as such.]
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 858
*************************************