[18588] in Perl-Users-Digest
Perl-Users Digest, Issue: 756 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 24 18:11:26 2001
Date: Tue, 24 Apr 2001 15:10:17 -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: <988150216-v10-i756@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 24 Apr 2001 Volume: 10 Number: 756
Today's topics:
Re: Help Req - Disable button <mischief@velma.motion.net>
How capture PID's a la "ps" <bzelitc@attglobal.net>
Re: How capture PID's a la "ps" <gtoomey@usa.net>
Re: How secure is this.... <onasc@remove.me@home.com>
Re: How secure is this.... <simon@super-simon.com>
Re: Installing modules on my server <gtoomey@usa.net>
Re: MQSeries on HP-UX 11 + Oracle <nospam@newsranger.com>
Re: Multi-Line Text Editor <Lyle_Goldman@ibi.com>
Must send lots of emails <vivekvp@spliced.com>
Re: operators: != vs. ne, strange behaviour <ren@tivoli.com>
Re: operators: != vs. ne, strange behaviour <comdog@panix.com>
Pass variables from one script to another? <Nils.Lien@informatikk.hive.no>
Re: Perl Fehler bei =?iso-8859-1?Q?Scriptausf=FChrung?= (Steve Lamb)
Re: Perl Fehler bei =?iso-8859-1?Q?Scriptausf=FChrung?= (Anno Siegel)
Re: Perl Fehler bei Scriptausführung <Lyle_Goldman@ibi.com>
Re: Perl Fehler bei Scriptausführung (Anno Siegel)
Re: Perl Fehler bei Scriptausführung <gellyfish@gellyfish.com>
Re: Perl Fehler bei Scriptausführung <uri@sysarch.com>
Re: Perl Fehler bei Scriptausf*hrung <Lyle_Goldman@ibi.com>
Re: Perl Fehler bei Scriptausf*hrung <Lyle_Goldman@ibi.com>
Re: Perl Fehler bei Scriptausf*hrung <Lyle_Goldman@ibi.com>
Perl Threads saulmora@us.ibm.com
Re: pointer/reference question (Abigail)
Re: readdir command <mischief@velma.motion.net>
Re: Redirecting messages <mischief@velma.motion.net>
Re: Redirecting messages <webmaster@webdragon.unmunge.net>
Re: regexp matching with optional part <bart.lateur@skynet.be>
Re: regexp matching with optional part <elijah@workspot.net>
Re: regexp matching with optional part (Greg Bacon)
Sockets, Time-outs, and Alarms <Lyle_Goldman@ibi.com>
Test: Do not read. <notmyrealemail@fake.com>
Re: Test: Do not read. <mischief@velma.motion.net>
Re: Where is my script <martin@djernaes.net>
Re: Windows Perl for Windows 95 -- Internet Explorer 5 <stead367@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Apr 2001 19:30:51 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help Req - Disable button
Message-Id: <tebl3b3ff3i398@corp.supernews.com>
Jim <james.owen4@btinternet.com> wrote:
> Please help,
> Have Perl script form with submit button on,
Your perl script does not have a submit button. Your
HTML web page does.
[reformatted original post -- it was too wide ]
> Trying to disable submit button after user clicks once
> to submit form. Have looked at Javascript to accomplish
> this, but most java scripts require something in the head
> of the page. This presents problem because my form has no
> <head> </head> tags. Please help, at end of tether........
Perl is not on the user's browser. A Perl program can
write pages to a web server through CGI. A Perl program
can get data back from the web server via CGI. You can
disable a form element in HTML when you output a page.
You cannot change the page once it is in the browser.
If you've actually looked at JavaScript thoroughly, you
would know that JavaScript (now INScript) is not Java.
'JavaScript' and 'Java script' are two different things,
not that Java is really considered a scripting language.
If something requires a header, then write a header. It's
not that difficult. JavaScript, as far as I know, doesn't
require that its scripts be loaded from a page header.
> Reply to group or to James.Owen4@btinternet.com
Why reply to this group? This is a Perl group, not a
Java group, JavaScript group, CGI group, or general
programming group. You should ask CGI questions in a
CGI group, such as comp.infosystems.www.authoring.cgi
for one. You should ask Java questions in a Java forum,
and I believe Sun has a mailing ling for it among other
things, such as the whole comp.lang.java Usenet
branch with fifteen groups. There is
comp.lang.javascript for INScript questions.
Now, was your question whether or not you can dynamically
alter content of a web page in a user's browser using Perl?
This is topical, but the answer is no. If you've read about
PerlScript, rest assured that similarly to Java/JavaScript,
butter/butterfly, and alto/Altoids there is little relation.
Chris
--
Christopher E. Stith
You can never entirely stop being what you once were. That's
why it's important to be the right person today, and not put
it off till tomorrow. -- Larry Wall, 3rd State of the Onion
------------------------------
Date: Tue, 24 Apr 2001 13:51:36 -0400
From: <bzelitc@attglobal.net>
Subject: How capture PID's a la "ps"
Message-Id: <3ae5cf6c_2@news1.prserv.net>
I am looking for a perl way to poll the system (NT or Unix) for process id's
and their parents. Functionally, this would be somewhat like the command
line "ps" or Windows Task Manager. The difference is that it would not be a
snapshot, but a view over time. Any ideas?
------------------------------
Date: Wed, 25 Apr 2001 07:06:57 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: How capture PID's a la "ps"
Message-Id: <NIlF6.10811$482.50435@newsfeeds.bigpond.com>
Try system('ps -ef') and put it in a loop.
You'll have to decide what a 'view over time' means.
gtoomey
--------
<bzelitc@attglobal.net> wrote in message news:3ae5cf6c_2@news1.prserv.net...
> I am looking for a perl way to poll the system (NT or Unix) for process
id's
> and their parents. Functionally, this would be somewhat like the command
> line "ps" or Windows Task Manager. The difference is that it would not be
a
> snapshot, but a view over time. Any ideas?
>
>
------------------------------
Date: Tue, 24 Apr 2001 19:47:22 GMT
From: "Brett Foster" <onasc@remove.me@home.com>
Subject: Re: How secure is this....
Message-Id: <eLkF6.96228$61.20567500@news4.rdc1.on.home.com>
It is my information that once you crypt you can't go back. In other words,
you cannot determin what the value of $passwd was before calling crypt.
"Super-Simon" <simon@super-simon.com> wrote in message
news:9c2b12$sbn$1@news1.xs4all.nl...
> Hi,
>
> In most security-scripts the following code is used for encryption:
>
> print crypt($passwd,$salt);
>
> Is this safe, or at least difficult to crack, is there something better???
> Please help me.
>
>
> Grtz,
>
> Simon
>
>
------------------------------
Date: Tue, 24 Apr 2001 22:46:45 +0200
From: "Super-Simon" <simon@super-simon.com>
Subject: Re: How secure is this....
Message-Id: <9c4oiv$lmo$1@news1.xs4all.nl>
You mean it's a hashing-routine....
"Brett Foster" <onasc@remove.me@home.com> wrote in message
news:eLkF6.96228$61.20567500@news4.rdc1.on.home.com...
> It is my information that once you crypt you can't go back. In other
words,
> you cannot determin what the value of $passwd was before calling crypt.
>
> "Super-Simon" <simon@super-simon.com> wrote in message
> news:9c2b12$sbn$1@news1.xs4all.nl...
> > Hi,
> >
> > In most security-scripts the following code is used for encryption:
> >
> > print crypt($passwd,$salt);
> >
> > Is this safe, or at least difficult to crack, is there something
better???
> > Please help me.
> >
> >
> > Grtz,
> >
> > Simon
> >
> >
>
>
------------------------------
Date: Wed, 25 Apr 2001 07:11:58 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Installing modules on my server
Message-Id: <uNlF6.10812$482.50138@newsfeeds.bigpond.com>
You don't need to be root to run most of the packages in CPAN.
Just ftp the packages you want to a subdirectory.
gtoomey
------
"errol brown" <errolbrown@hotmail.com> wrote in message
news:YI2F6.131127$HR6.14760731@nnrp4.clara.net...
> Assuming you have root, you can use the CPAN.
>
> perldoc CPAN
>
> errol
------------------------------
Date: Tue, 24 Apr 2001 20:33:56 GMT
From: Drew <nospam@newsranger.com>
Subject: Re: MQSeries on HP-UX 11 + Oracle
Message-Id: <UqlF6.3880$QV4.328001@www.newsranger.com>
In article <mY%E6.11455$ff.80598@news-server.bigpond.net.au>, Steve Baldwin
says...
>
>I've currently got a Perl installation (5.6) where I've got DBI-1.14 and
>DBD-Oracle-1.06 installed and working. On HP-UX 11, this requires a bit of
>stuffing around (including rebuilding Perl), but it all now works fine. I
>now want to get MQ for perl working as well, but I'm not having much luck.
>Basically I fall over at the 'make test' step.
>
>Has anyone out there got this combination working ?
I've got that same system setup without the MQ piece, and yes, it does take a
bit of tweaking to get running.
What error(s) are you getting during the make test?
--Drew
------------------------------
Date: Tue, 24 Apr 2001 20:09:11 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Re: Multi-Line Text Editor
Message-Id: <H3lF6.3844$QV4.324506@www.newsranger.com>
Sorry about posting this question twice. I couldn't find the original posting,
but now I see it. I still would like an answer, though.
- Lyle Goldman
------------------------------
Date: Tue, 24 Apr 2001 21:24:32 GMT
From: "Victor Prasad" <vivekvp@spliced.com>
Subject: Must send lots of emails
Message-Id: <kamF6.634718$f36.18304371@news20.bellglobal.com>
Hello,
I have a user list of a about 20000. Hopefully on a spreadsheet.
I have to parse out the email addresses then make a program to attach the
email address to an email and send them off.
I plan to write it in PERL and use the unix sendmail program on my server.
It will be a generic message for everyone on the users list.
Does anyone know of a premade script that does this? Or suggestions on how
to do this efficiently?
I am concerned about how long it would take to send.
Could I get away with something like this:
use Mail::Sendmail;
%mail = ( To => 'you@there.com', <except loop this 20000?
From => 'me@here.com',
Message => "This is a very short message"
);
Thanks,
V
------------------------------
Date: 24 Apr 2001 13:28:07 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <m3d7a2ywy0.fsf@dhcp9-172.support.tivoli.com>
On Sun, 22 Apr 2001, bart.lateur@skynet.be wrote:
> Kristian wrote:
>
>> if ($qry_id != $query_id) {
>> print "$qry_id != $query_id !!!!\n";
>> die;
>> }
>>
>>and, when i run this on my data I get the following error:
>>
>>NANA_STRPN-381-392 != NANA_STRPN-381-392 !!!!
>
> I don't quite get it, because these two ought to be the same, as
> both sides evaluate to zero. Yes, zero! They both start with some
> letters, that's why.
I bet that "NAN" on the front (NotANumber) has something to do with
it.
Yup:
$ perl -e 'print "Gotcha!\n" if "X" != "X"'
$ perl -e 'print "Gotcha!\n" if "NAN" != "X"'
Gotcha!
$ perl -e 'print "Gotcha!\n" if "NAN" != "NAN"'
Gotcha!
I assume that having "NAN" on the front of a string is triggering some
sort of numeric value, but I am surprised that whatever that value is,
it isn't even equal to itself. I suppose that makes sense -- if it
isn't a number, how could it be numerically equivalent to anything?
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 24 Apr 2001 17:37:37 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <comdog-D5B689.17373724042001@news.panix.com>
In article <m3d7a2ywy0.fsf@dhcp9-172.support.tivoli.com>, Ren Maddox
<ren@tivoli.com> wrote:
> I bet that "NAN" on the front (NotANumber) has something to do with
> it.
>
> Yup:
>
> $ perl -e 'print "Gotcha!\n" if "X" != "X"'
> $ perl -e 'print "Gotcha!\n" if "NAN" != "X"'
> Gotcha!
> $ perl -e 'print "Gotcha!\n" if "NAN" != "NAN"'
> Gotcha!
which version of perl are you using?
vaio_brian[1789]$ perl5.00503 -e 'print "Gotcha!\n" if "NAN" != "NAN"'
vaio_brian[1790]$ perl5.6.0 -e 'print "Gotcha!\n" if "NAN" != "NAN"'
vaio_brian[1791]$
--
brian d foy <comdog@panix.com>
------------------------------
Date: Tue, 24 Apr 2001 23:44:57 +0200
From: "Nils Lien" <Nils.Lien@informatikk.hive.no>
Subject: Pass variables from one script to another?
Message-Id: <ltmF6.2288$gX3.106450@news3.oke.nextra.no>
Hi,
I'm wondering how to pass a variable form one script to another.
For example;
I'm gonna fetch the variable $foo from script1.cgi
into the script I'm currently in now, script2.cgi.
I've managed it using the variable in the URL, but isn't there another
way around it?
--
- /\/ILS LIE/\/ -
Nils.Lien@informatikk.hive.no
- My pleasure... -
------------------------------
Date: Tue, 24 Apr 2001 20:56:47 -0000
From: grey@despair.rpglink.com (Steve Lamb)
Subject: Re: Perl Fehler bei =?iso-8859-1?Q?Scriptausf=FChrung?=
Message-Id: <slrn9ebq4e.n0n.grey@teleute.dmiyu.org>
On 24 Apr 2001 20:50:14 GMT, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
wrote:
>According to Lyle Goldman <Lyle_Goldman@ibi.com>:
>> On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
>> <ludmilla.markowska@gmx.net> wrote:
>> >
>> > sorry, wrong newsgroup.
>> >
>> Wrong language, too!
>How so?
I'm betting it is either the fact that this appears to be a mostly English
newsgroup or the fact that the code given wasn't Perl in any form I am aware
of. Take your pick.
--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
ICQ: 5107343 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
------------------------------
Date: 24 Apr 2001 21:13:39 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl Fehler bei =?iso-8859-1?Q?Scriptausf=FChrung?=
Message-Id: <9c4qa3$ecj$4@mamenchi.zrz.TU-Berlin.DE>
According to Steve Lamb <morpheus@here.not.there>:
> On 24 Apr 2001 20:50:14 GMT, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
> wrote:
> >According to Lyle Goldman <Lyle_Goldman@ibi.com>:
> >> On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
> >> <ludmilla.markowska@gmx.net> wrote:
> >> >
> >> > sorry, wrong newsgroup.
> >> >
> >> Wrong language, too!
>
> >How so?
>
> I'm betting it is either the fact that this appears to be a mostly English
> newsgroup or the fact that the code given wasn't Perl in any form I am aware
> of. Take your pick.
I did, picking the former.
I also understand that Usenet is an international medium and other
languages than English are generally tolerated.
Anno
------------------------------
Date: Tue, 24 Apr 2001 20:20:56 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Re: Perl Fehler bei Scriptausführung
Message-Id: <IelF6.3860$QV4.325960@www.newsranger.com>
On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
<ludmilla.markowska@gmx.net> wrote:
>
> sorry, wrong newsgroup.
>
Wrong language, too!
- Lyle Goldman
------------------------------
Date: 24 Apr 2001 20:50:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl Fehler bei Scriptausführung
Message-Id: <9c4ou6$ecj$2@mamenchi.zrz.TU-Berlin.DE>
According to Lyle Goldman <Lyle_Goldman@ibi.com>:
> On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
> <ludmilla.markowska@gmx.net> wrote:
> >
> > sorry, wrong newsgroup.
> >
> Wrong language, too!
How so?
Anno
------------------------------
Date: 24 Apr 2001 20:52:14 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Fehler bei Scriptausführung
Message-Id: <9c4p1u$mhn$2@neptunium.btinternet.com>
Michael Döring <info@rpv.de> wrote:
> "Tony Curtis" <tony_curtis32@yahoo.com> schrieb:
> ^^^^^^^^^^^
>
> Würdest Du bitte Deinen korrekten Namen angeben!
I think he did. Bye Bye now!.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Tue, 24 Apr 2001 21:52:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl Fehler bei Scriptausführung
Message-Id: <x7eluihsnr.fsf@home.sysarch.com>
>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
AS> According to Steve Lamb <morpheus@here.not.there>:
>> On 24 Apr 2001 20:50:14 GMT, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
>> wrote:
>> >According to Lyle Goldman <Lyle_Goldman@ibi.com>:
>> >> On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
>> >> <ludmilla.markowska@gmx.net> wrote:
>> >> >
>> >> > sorry, wrong newsgroup.
>> >> >
>> >> Wrong language, too!
>>
>> >How so?
>>
>> I'm betting it is either the fact that this appears to be a mostly English
>> newsgroup or the fact that the code given wasn't Perl in any form I am aware
>> of. Take your pick.
AS> I did, picking the former.
AS> I also understand that Usenet is an international medium and other
AS> languages than English are generally tolerated.
true, but there are language specific hierarchies which are better
suited for this:
de.comp.lang.perl
usenet may be multilingual but c.l.p.misc is english-centric
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 24 Apr 2001 21:11:06 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Re: Perl Fehler bei Scriptausf*hrung
Message-Id: <KZlF6.3940$QV4.332267@www.newsranger.com>
On 24 Apr 2001 20:50:14 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
wrote:
>
> According to Lyle Goldman <Lyle_Goldman@ibi.com>:
> > On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska" <ludmilla.markowska@gmx.net> wrote:
> > >
> > > sorry, wrong newsgroup.
> > >
> > Wrong language, too!
>
> How so?
>
> Anno
She (or maybe he) posted in German in an English-language newsgroup. That's all
I meant. I hope I didn't offend anyone. I don't speak German, so I couldn't help
her here.
- Lyle Goldman
------------------------------
Date: Tue, 24 Apr 2001 21:57:38 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Re: Perl Fehler bei Scriptausf*hrung
Message-Id: <mFmF6.4006$QV4.339762@www.newsranger.com>
On Tue, 24 Apr 2001 20:56:47 -0000, Steve Lamb wrote:
>
> On 24 Apr 2001 20:50:14 GMT, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to Lyle Goldman <Lyle_Goldman@ibi.com>:
> > > On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
> > > <ludmilla.markowska@gmx.net> wrote:
> > > >
> > > > sorry, wrong newsgroup.
> > > >
> > > Wrong language, too!
>
> > How so?
>
> I'm betting it is either the fact that this appears to be a mostly English
> newsgroup or the fact that the code given wasn't Perl in any form I am aware
> of. Take your pick.
>
Actually, BOTH of those are true! I didn't understand any of it, and I'm
guessing many others here didn't either.
------------------------------
Date: Tue, 24 Apr 2001 22:04:25 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Re: Perl Fehler bei Scriptausf*hrung
Message-Id: <JLmF6.4015$QV4.340648@www.newsranger.com>
On Tue, 24 Apr 2001 21:52:34 GMT, Uri Guttman <uri@sysarch.com> wrote:
>
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
> AS> According to Steve Lamb:
> >> On 24 Apr 2001 20:50:14 GMT, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
> >> wrote:
> >> >According to Lyle Goldman <Lyle_Goldman@ibi.com>:
> >> >> On Sun, 22 Apr 2001 17:48:54 +0200, "Ludmilla Markowska"
> >> >> <ludmilla.markowska@gmx.net> wrote:
> >> >> >
> >> >> > sorry, wrong newsgroup.
> >> >> >
> >> >> Wrong language, too!
> >>
> >> >How so?
> >>
> >> I'm betting it is either the fact that this appears to be a mostly English
> >> newsgroup or the fact that the code given wasn't Perl in any form I am aware
> >> of. Take your pick.
>
> AS> I did, picking the former.
>
> AS> I also understand that Usenet is an international medium and other
> AS> languages than English are generally tolerated.
>
>true, but there are language specific hierarchies which are better
>suited for this:
>
> de.comp.lang.perl
>
>usenet may be multilingual but c.l.p.misc is english-centric
>
>uri
>
That's exactly what I'm saying.
- Lyle Goldman
------------------------------
Date: 24 Apr 2001 18:54:33 GMT
From: saulmora@us.ibm.com
Subject: Perl Threads
Message-Id: <9c4i59$u3e$1@ausnews.austin.ibm.com>
I am having trouble using the Thread module for ActivePerl 623 for Windows
NT.
I put 'use Threadl;' at the top of the code and construct a new Thread
object just as the thread docs say, but when I run my script I get a weird
error message:
No threads in this perl at <filename> <linenumber>
Is there something wrong with this distrobution or am I doing something
wrong with my use of the Thread module?
Thanks,
Saul
------------------------------
Date: Tue, 24 Apr 2001 22:04:25 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: pointer/reference question
Message-Id: <slrn9ebu39.3sc.abigail@tsathoggua.rlyeh.net>
xris (xris@dont.send.spam) wrote on MMDCCXCII September MCMXCIII in
<URL:news:xris-2BAAF9.23015022042001@news.evergo.net>:
==
== yeah, I think this is more what I'm after.. a world in which:
==
== \$x = \$y;
==
== works. :) oh well, just wanted to make sure that I really CAN'T do
== that, and that I wasn't just doing something wrong.
==
== and in answer to the aforementioned "$x=$y" thing, that copies the data,
== not the reference. I'm, I guess, looking for that C/C++ functionality
== where I can havevariables called $x and $y (not $$x or $$y or whatever -
== I know how to manage with those things) that both access the same data
== space, so that:
==
== $x = 1;
== ...somehow assign \$y=\$x...
== $y++;
== print $x;
==
== results in "2"...
*x = *y;
$x = 1;
$y ++;
print $x;
__END__
2
Abigail
------------------------------
Date: Tue, 24 Apr 2001 20:30:49 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: readdir command
Message-Id: <tebojpcs29usb4@corp.supernews.com>
Kerstin Rapp <rapp@kjunction.com> wrote:
> Hi there:
> I'm trying to use readdir. It goes into a foreach loop
> and is supposed to print and then copy the found files
> if they have a certain extension.
> Everything works - just it iterates through the
> directory 95 times and therefore tries to execute the
> command 95 times (what is very annoying).
My guess, which is all I can offer with the amount of
code you posted, if that your code looks something like
this:
You have somehow confused list and scalar context
use of readdir.
You can do this:
opendir ( Dir, '.' ) || die "Gag! -- $!\n";
my @file = readdir ( Dir );
closedir( Dir );
foreach ( @file ) {
copy_file( $_ , $destination ) if /extension$/;
}
sub copy_file {
# copy the file in here
}
Or you can do this:
opendir ( Dir ) || die "Barf! -- $!\n";
my $file;
while( defined( $file = readdir (Dir) ) ) {
copy_file ($file, destination) if /extension/;
}
sub copy_file {
# left as an exercise
}
If you mix up the contexts, you can end up working with
an array of the filenames in the directory for each filename
in the directory. Do you happen to have 95 files?
perldoc -f readdir
Chris
--
Christopher E. Stith
Parking for people we like only. All other vehicles will be vandalized.
------------------------------
Date: Tue, 24 Apr 2001 20:06:20 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Redirecting messages
Message-Id: <tebn5s3a2rovd0@corp.supernews.com>
Steve Roberts <jsr@agere.com> wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
Eeek! It's Attack of the Killer Anticonformist Document Types!
> <p>by the way, you need to put a space after the -- to get the rest to
> <br>register as a proper sig.
> <p> --
This doesn't work as a sig, either. You need /^-- $/.
Chris
--
Christopher E. Stith
You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty. -- Mohandas K. Gandhi
------------------------------
Date: 24 Apr 2001 21:13:57 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Redirecting messages
Message-Id: <9c4qal$3l$5@216.155.33.49>
In article <tebn5s3a2rovd0@corp.supernews.com>,
Chris Stith <mischief@velma.motion.net> wrote:
| Steve Roberts <jsr@agere.com> wrote:
| > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
| Eeek! It's Attack of the Killer Anticonformist Document Types!
ROFL :D
| > <p>by the way, you need to put a space after the -- to get the rest to
| > <br>register as a proper sig.
|
| > <p> --
|
| This doesn't work as a sig, either. You need /^-- $/.
OK, That's it, I'm gonna use a regex to explain what I mean to the user
next time, instead of trying to do it under
use English;
;D
(thanks for the chuckles, Chris :)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Tue, 24 Apr 2001 20:22:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regexp matching with optional part
Message-Id: <t4obetk3da738d4rknphfikgc4ugt317jj@4ax.com>
Uri Guttman wrote:
> s/^x-|-x$//g && $_
Are you sure the intention is to bring
x-x-x-x-x-boo!-x-x-x-x-x
down to just:
boo!
???
--
Bart.
------------------------------
Date: 24 Apr 2001 20:51:47 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: regexp matching with optional part
Message-Id: <eli$0104241647@qz.little-neck.ny.us>
In comp.lang.perl.misc, Bart Lateur <bart.lateur@skynet.be> wrote:
> Uri Guttman wrote:
> > s/^x-|-x$//g && $_
> Are you sure the intention is to bring
> x-x-x-x-x-boo!-x-x-x-x-x
> down to just:
> boo!
Uri's code won't do that. If you want that ^ or $ to match more than
once, you'll need a loop, not just a /g.
$ perl -wpe 's/^x-|-x$//g'
x-x-x-x-x-boo!-x-x-x-x-x
x-x-x-x-boo!-x-x-x-x
^D
$ perl -wpe '1 while s/^x-|-x$//g'
x-x-x-x-x-boo!-x-x-x-x-x
boo!
^D
$
Elijah
------
thinks the OP wants /^(?:x-)?(.*[^x]|.*[^-]x|x)(?:-x)?$/
------------------------------
Date: Tue, 24 Apr 2001 21:53:30 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: regexp matching with optional part
Message-Id: <tebteq1savjp86@corp.supernews.com>
In article <eli$0104241647@qz.little-neck.ny.us>,
Eli the Bearded <elijah@workspot.net> wrote:
: Elijah
: ------
: thinks the OP wants /^(?:x-)?(.*[^x]|.*[^-]x|x)(?:-x)?$/
Nope:
% cat try
#! /usr/local/bin/perl -w
use strict;
$_ = 'x--x';
if (/^(?:x-)?(.*[^x]|.*[^-]x|x)(?:-x)?$/) {
print "ACCEPT: '$1'\n";
}
else {
print "REJECT\n";
}
% ./try
ACCEPT: 'x-'
The engine is taking you up on your (?:x-)? to make the second
subexpression match. Damn little engine that can.
How about these apples?
% cat try
#! /usr/local/bin/perl -w
use strict;
for ('x--x', 'x-abc', 'abc-x', 'x-abc-x', 'abc') {
if (/ ^ x- (.+) -x $
| ^ x- (.+) (?<!-x$) $
| ^ (?!x-) (.+) -x $
| ^ (?!x-) (.+) (?<!-x$) $
/x)
{
print "ACCEPT '$_': '$+'\n";
}
else {
print "REJECT '$_'\n";
}
}
% ./try
REJECT 'x--x'
ACCEPT 'x-abc': 'abc'
ACCEPT 'abc-x': 'abc'
ACCEPT 'x-abc-x': 'abc'
ACCEPT 'abc': 'abc'
Greg
--
So far as I can remember, there is not one word in the Gospels in
praise of intelligence.
-- Bertrand Russell
------------------------------
Date: Tue, 24 Apr 2001 20:59:17 GMT
From: Lyle Goldman <Lyle_Goldman@ibi.com>
Subject: Sockets, Time-outs, and Alarms
Message-Id: <FOlF6.3921$QV4.330863@www.newsranger.com>
Hello. I am running a Perl client application that uses a socket to connect to
a server application. The code to open the socket and connect to the server
(which must already be running) is as follows:
socket SOCKET, PF_INET, SOCK_STREAM, getprotobyname 'tcp'
or die "socket: $!\n";
connect SOCKET, sockaddr_in($port, $iaddr) or die "connect: $!\n";
select SOCKET;
$| = 1;
select STDOUT;
Now, this application has to have a continuous conversation with the server,
and therefore needs to know when the server is finished sending without knowing
how much data it is sending or how many lines it is sending? What is the best
way to do this?
What I am doing now is using an alarm to specify a time-out value. Here is
the code I am using (a work in progress, which will probably be in a loop):
$SIG{ALRM} = "IGNORE";
my $resp;
alarm 5;
$resp = <SOCKET>;
alarm 0;
However, it doesn't work. The attempted read from the socket is not interrupted,
as many other system calls are when there is a signal. How can I interrupt the
socket read? Does buffering have anything to do with it, and if so, how can I
avoid it?
- Lyle Goldman
------------------------------
Date: Tue, 24 Apr 2001 20:44:42 GMT
From: "BarryK" <notmyrealemail@fake.com>
Subject: Test: Do not read.
Message-Id: <_AlF6.20449$U4.4773420@news1.rdc1.tn.home.com>
This is a test post. I told you not to read it!
------------------------------
Date: Tue, 24 Apr 2001 21:24:32 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Test: Do not read.
Message-Id: <tebrogcchcoc68@corp.supernews.com>
BarryK <notmyrealemail@fake.com> wrote:
> This is a test post. I told you not to read it!
This is not a test newsgroup. You don't have to worry
about me reading any more of your posts. **Plonk!**
Chris
--
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Tue, 24 Apr 2001 11:59:20 -0700
From: Martin Djernaes <martin@djernaes.net>
Subject: Re: Where is my script
Message-Id: <3AE5CD08.1158132E@djernaes.net>
Hi Craig,
Thanks for your time, but the workstation where I'm at now do not have a
decent installation of perl avalible!
I'll look at it - thanks for the tests.
Martin
Craig Berry wrote:
>
> Martin Djernaes (martin@djernaes.net) wrote:
> : Sorry if I didn't explain myself correctly.
> : I stand in ~/test
> : call /usr/local/bin/perl ../perlscript/test.pl
> : I want to get ~/perlscript/ (or /users/someone/perlscript) from inside
> : test.pl (without hardcoding).
>
> And FindBin doesn't work? (It does precisely that for me.)
>
> : Maybe FinBin can do it (I have not had time testing it),
>
> Wouldn't it have been faster to try it than to post to Usenet and wait for
> answers?
>
> : but I
> : understood from perldoc that there was a problem. If I would stand in
> : ~/perlscript/ and call /usr/local/bin/perl test.pl it would not get the
> : correct path - is that correct?
>
> /m/hermosa/usr3/home/cberry > cat fbtest
> #!/usr/bin/perl -w
>
> use strict;
> use FindBin qw($Bin);
>
> print "Bin is: $Bin\n";
> /m/hermosa/usr3/home/cberry > fbtest
> Bin is: /m/hermosa/usr3/home/cberry
> /m/hermosa/usr3/home/cberry > perl fbtest
> Bin is: /m/hermosa/usr3/home/cberry
> /m/hermosa/usr3/home/cberry > cd public-html
> /m/hermosa/usr3/home/cberry/public-html > ../fbtest
> Bin is: /m/hermosa/usr3/home/cberry
> /m/hermosa/usr3/home/cberry/public-html > perl ../fbtest
> Bin is: /m/hermosa/usr3/home/cberry
>
> --
> | Craig Berry - http://www.cinenet.net/~cberry/
> --*-- "When the going gets weird, the weird turn pro."
> | - Hunter S. Thompson
------------------------------
Date: Tue, 24 Apr 2001 19:59:28 GMT
From: "The Starman" <stead367@earthlink.net>
Subject: Re: Windows Perl for Windows 95 -- Internet Explorer 5 required?
Message-Id: <AWkF6.1714$G04.219453@newsread2.prod.itd.earthlink.net>
Charles,
I've been using ActivePerl just fine without IE5. The main thing
about using AP right now though is that you first have to get the
new M$-INSTALL program that will install .MSI files like Win2k
is using! If you have ONLY a straight Win95 (OSR2 -- who in their
right mind would ever have jumped right into the first Win95 to
come out, or if they had to, would ever still be trying to use it for
surfing the Net?!) install without any updates at all... it's about
time that you moved up to doing y2k, DUN1.3, etc. and maybe
DCOM, _but_ there's no real need to install WSH or any of those
scripting things to run your perl scripts! I'm using the latest AP
build # 623. In order to do CGI script testing, I use the XITAMI
server locally offline! IF you are used to working on or running
an Apache server, then you would, of course, probably be more
comfortable getting the Indigo package that has the perl program
set up somewhat differently... there are some changes that you
need to make at times in a perl script that runs on an Apache
server vs. UNIX vs. oh, no, an NT machine with .asp stuff! Using
Xitami on my Win95 box is pretty close to getting my scripts
ready for a UNIX cgi-bin, although there are occasions where the
differences will show up dramatically! There would be all sorts
of problems if your script was doing lots of "fork"ing, "flock"ing,
system calls, etc.!
I did a very detailed web page some time back here:
http://www.geocities.com/thestarman3/perl/perl.html to get
newbies with only Windows machines to try downloading and
using perl scripts as soon as there were Win32 binaries of the
perl code made available! Nothing like the power of perl for
doing things like creating (and editing) a whole slew of new
folders or filenames under Windows since M$ never made it
easy to do that. There have, of course, been a few Win progs.
that attempt to do this with fair to good results perhaps, but
nothing beats the SUBSTITUTION function with REGEXPs
and MEMORY, etc. to do almost anything you can dream of
with the folder or filenames or ANY line in a text file like your
HTML pages!!
Sincerely, The Starman.
Charles M. Kozierok wrote in message
<81YE6.358$Be3.32713@news.shore.net>...
>Hi Folks,
>
>Perl newbie here, trying to download a win32 binary so I can write
>code offline. I went to Active State but their system requirements
>seems to say I need IE5 and a bunch of other stuff to use the
distribution.
>Is this really the case for all of the contents, or is it needed for
>only portions of the package? All I really want is a Perl interpreter
>that will run a program that parses some files and spits out some
>new ones, I don't need CGI or Windows integration or anything fancy.
>I am not interested in installing IE5 on my machine.
>
>Is there any good Perl package that doesn't require a bunch of system
>updates to run on Win95? Thanks.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 756
**************************************