[17344] in Perl-Users-Digest
Perl-Users Digest, Issue: 4766 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 30 18:05:45 2000
Date: Mon, 30 Oct 2000 15:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972947121-v9-i4766@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 30 Oct 2000 Volume: 9 Number: 4766
Today's topics:
[xchat] scripting <antonio@estesia.com>
ASP help, my eyes hurt...why doesn't this work <rsmallwood@mindspring.com>
Beginner: "exec" within an "exec" problem newdebugger@my-deja.com
Re: Beginner: "exec" within an "exec" problem <ren.maddox@tivoli.com>
class instance variables dsevans@my-deja.com
Re: class instance variables <ren.maddox@tivoli.com>
Re: Comparing two files <uri@sysarch.com>
Re: Comparing two files (Tom Christiansen)
Re: Comparing two files (Tom Christiansen)
Re: Comparing two files <camerond@mail.uca.edu>
Converting long integers to hex and vice versa <EUSWMCL@am1.ericsson.se>
CTRL+Z problem wapache@my-deja.com
Re: CTRL+Z problem <latsharj@my-deja.com>
Re: Detecting socket closure <fulko@wecan.com>
fork() for NT platforms nir_y@my-deja.com
Re: fork() for NT platforms <amonotod@netscape.net>
FormMail.pl with file attachment support? <jesusx@who.net>
Re: FormMail.pl with file attachment support? <isterin@hotmail.com>
Re: global variables and use strict <ren.maddox@tivoli.com>
Re: global variables and use strict (Tad McClellan)
Re: global variables and use strict (Tom Christiansen)
Re: hairy regex - embedded parentheses <stephenk@cc.gatech.edu>
help - $ENV{"QUERY_STRING"} <jtk@_nospam_jtkconsulting.com>
Re: help - $ENV{"QUERY_STRING"} <newsposter@cthulhu.demon.nl>
Re: HELP FILE I/O <krahnj@acm.org>
Help! Read File <mhchen@stanford.edu>
Re: Help! Read File (Jerome O'Neil)
Re: Help! Read File rathmore@tierceron.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 30 Oct 2000 22:02:53 GMT
From: "`Niimai`" <antonio@estesia.com>
Subject: [xchat] scripting
Message-Id: <hemL5.58373$3K3.1789612@news.infostrada.it>
Hi, I am looking for a well-done, complete xchat scriipting tutorial. The
one that is possible to find on www.xchat.org is really really bad: mostly,
I need to know what modules do!
Thanks,
Antonio
------------------------------
Date: Mon, 30 Oct 2000 19:28:35 GMT
From: Russell Smallwood <rsmallwood@mindspring.com>
Subject: ASP help, my eyes hurt...why doesn't this work
Message-Id: <MPG.146798c250d9916198968d@news.giganews.com>
I'm now in my 2nd hour staring at the screen trying to figure out why
this doesn't work:
--somewhere deep in the bowels of my ASP page: (the sub seems to work)
<SCRIPT LANGUAGE=Perlscript RUNAT=Server>
sub goldtime{
#get time and date stamp for GoldMine
@time=localtime(time);
$year=(@time[5]+1900);
$month=(@time[4]+1);
$day=@time[3];
if (length ($month)<2) {
$month=("0".$month);
}
if (length ($day)<2) {
$day=("0".$day);
}
$date=($year.$month.$day);
$master=("MASTER"." ");
$hour=@time[2];
if (length ($hour)<2) {
$hour=(" ".$hour);
}
$min=@time[1];
if (length ($min)<2) {
$min=("0".$min);
}
if ($hour>11) {
$ampm="pm";
}else{
$ampm="am";
}
$time=($hour.":".$min.$ampm);
$goldtime=($master.$date.$time);
$Response->write($goldtime);
}
</SCRIPT>
but when I try this (further down the page...)
<INPUT type="hidden" name="goldtime" value="<% goldtime %>">
she croaks!
Anybody have it in their heart to help a newbie? I am basing this sub
call on the example vbs-pl-param.aap that lives in the perl/eg
directory. I have stared and stared....
Russell
------------------------------
Date: Mon, 30 Oct 2000 20:26:24 GMT
From: newdebugger@my-deja.com
Subject: Beginner: "exec" within an "exec" problem
Message-Id: <8tklh4$4qq$1@nnrp1.deja.com>
I tried to post this to the moderated perl but it never made it.
I have a find command that I was to use generically, accepting an
argument for the "string".
I'm using perl 4.x on hp-ux 10.20
It doesn't work when I type this:
#!/usr/bin/perl -w
#name myfind
exec 'find /home ! -perm -200 -exec grep -il "$ARGV[0]" {} \;';
-------------------
then run it with:
/>myfind Monica
it lists ALL the files in the directory, including the ones that don't
have string "Monica" in it.
But, when I plug in the string directly:
#!/usr/bin/perl -w
#name myfind
exec 'find /home ! -perm -200 -exec grep -il "Monica" {} \;';
-------------------
then run it with:
/>myfind
it works as expected (returns ONLY the files with the string "Monica")
What BASIC rule of perl did I miss?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Oct 2000 14:55:44 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Beginner: "exec" within an "exec" problem
Message-Id: <m31ywyjbfz.fsf@dhcp11-177.support.tivoli.com>
newdebugger@my-deja.com writes:
> #!/usr/bin/perl -w
> #name myfind
>
> exec 'find /home ! -perm -200 -exec grep -il "$ARGV[0]" {} \;';
Your use of single quotes here is preventing variable interpolation.
Use something like:
exec qq(find /home ! -perm -200 -exec grep -il "$ARGV[0]" {} \\;);
Note how the backslash needs to be escaped in a non-single-quote
context.
You might also consider using xargs instead of -exec:
exec qq(find /home ! -perm -200 -print | xargs grep -il "$ARGV[0]");
This can be *significantly* faster.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 30 Oct 2000 21:02:53 GMT
From: dsevans@my-deja.com
Subject: class instance variables
Message-Id: <8tknln$703$1@nnrp1.deja.com>
hello,
i am having troubles with variables in modules.
i have 2 class modules.
Agent.pm and System_Probes.pm
Agent.pm is derived from System_Probes.pm
in the System_Probes package/module/file
are a collection of subs. one is called
read_config and it does this at one point:
push @{ $self->{'trap_dest'} }, 123.23.23.123";
theres another sub send_trap that does this:
foreach ( @{$self->{'trap_dest'}} ) {
# whatever
}
it doesn't work.
if i call this hash key 'trapdest',
it works.
any ideas?
thanks
dave
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Oct 2000 15:11:47 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: class instance variables
Message-Id: <m3wveqhw4s.fsf@dhcp11-177.support.tivoli.com>
dsevans@my-deja.com writes:
> in the System_Probes package/module/file
> are a collection of subs. one is called
> read_config and it does this at one point:
>
> push @{ $self->{'trap_dest'} }, 123.23.23.123";
^
|
I assume the missing " goes here --/ ?
> theres another sub send_trap that does this:
> foreach ( @{$self->{'trap_dest'}} ) {
> # whatever
> }
>
> it doesn't work.
> if i call this hash key 'trapdest',
> it works.
Something else must be wrong. It's pretty futile for us to try and
guess what that might be.
The best thing for you to do would be to reproduce the problem in as
little code as possible and post that code here. Of course, chances
are that you will find the problem while you are trying to reduce the
code -- that works too.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 30 Oct 2000 19:17:57 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Comparing two files
Message-Id: <x7y9z6i1ej.fsf@home.sysarch.com>
>>>>> "MD" == Mark-Jason Dominus <mjd@plover.com> writes:
MD> Isn't that amazing?
MD> There was a time when calling
MD> system ("<friendly neighborhood shutdown.exe with
MD> args here>");
MD> would have been the 'relatively straightforward Perl/Perlist way
MD> of rebooting'.
MD> Now I guess it is not considered 'Perlish' to use Perl to call an
MD> external program. So much for 'glue language'!
i think it depends on the complexity and power of the external
program. certainly many silly uses of system and backticks can be
avoided. we have all seen system( 'chdir foo' ) and chortled. perl has
subsumed many common unix command programs and we have come to rely on
them and many others in module form. most of us would readily use
File::Find over calling the find program. and we will never use `ls`
over a file glob or readdir. now deciding when comparing files whether
to use cmp vs some perl code or module is more problematical. each has
its supporters and so it comes down to style. both work well but have
different negatives. the external program version won't be portable
without that utility working the same everywhere. but if it exists it
can be much faster than the perl code version. weigh that against the
fork overhead (negligible in most cases. only heavy uses of this would
matter) and code simplicity.
so pick your favorite way and just make sure you properly justify your
decisions.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 30 Oct 2000 13:12:20 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fdd624@cs.colorado.edu>
In article <x7y9z6i1ej.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>we have all seen system( 'chdir foo' ) and chortled.
That's because one is dismayed and amazed by how shallow the
understanding people have of the process model. These are likely
the same folks who think you can without its cooperation make another
process (that's already running) spontaneously change its umask,
current directory, or random environment variable. It's scary.
>perl has
>subsumed many common unix command programs and we have come to rely on
>them and many others in module form.
That depends. Generally, I avoid the modules when a program works.
Remember: a program is also a unit of software reuse, one with a
much more universal interface. However, this is still admittedly
in the minority of the cases, as the modules almost always offer
properties the programs do not.
>most of us would readily use
>File::Find over calling the find program.
Right--such as in that case. File::Find does so much more.
It's really more like fts(3) in many senses.
>and we will never use `ls`
>over a file glob or readdir. now deciding when comparing files whether
>to use cmp vs some perl code or module is more problematical. each has
>its supporters and so it comes down to style.
I mistrust lines of "reasoning" that dispute there being a correct
solution due to "style"--they tend to want to hide from technical
issues. There *are* right and wrong, good and bad, when it comes
to programming.
>can be much faster than the perl code version. weigh that against the
>fork overhead (negligible in most cases. only heavy uses of this would
>matter)
fork overhead is virtually always completely inconsequential.
It's the exec that gets you.
--tom
------------------------------
Date: 30 Oct 2000 15:26:46 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fdf5a6$1@cs.colorado.edu>
In article <39FDC4BD.FB905EFC@mail.uca.edu>,
Cameron Dorey <camerond@mail.uca.edu> wrote:
>Okay, Tom, this last sentence and the rest of your note imply (to me,
>anyway) that you have rewritten (or at least have had a hand in
>rewriting) perldoc in 5.6 to be, if not good, at least better. Since the
>"supercited posting" you refer to later has not made it to the
>newsserver I use, I can't be sure. If that _is_ the case, would you
>please answer two questions:
No such article. I was referring to the posting I had cited above.
(As in "superscript").
>1. Can one use this *new* perldoc with 5.005? and, if, so,
Probably not, since I religiously employ the use warnings pragma
and our() declarations.
However, that's not the important issue. The version in 5.6 is
*not* the rewrite, which is still somewhat experimental and needs
some adjustment for systems that I couldn't test it on. It will be
out in a later release of Perl.
The version I'm talking about regarding security fixes, however,
*is* out in 5.6. Hm... I see use warnings there, too.
>2. Where can I get it from, without having to grab all of 5.6 in the
>process? (actually, this second part is optional)
Get someone to mail it to you?
-tom
------------------------------
Date: Mon, 30 Oct 2000 16:34:20 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Comparing two files
Message-Id: <39FDF76C.FB8792C2@mail.uca.edu>
Well, thanks, anyway. I'll just yank 5.6 off of the net and pull perldoc
from it, then futz around to take care of the use warnings stuff to see
if it will work for me.
I thought if it were available at a URL, others might want to download
it without all of 5.6, too.
Looking forward to the *New, Improved* version.
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Mon, 30 Oct 2000 16:38:45 -0500
From: William Cardwell <EUSWMCL@am1.ericsson.se>
Subject: Converting long integers to hex and vice versa
Message-Id: <39FDEA65.6AB712C5@am1.ericsson.se>
I have 20 digit integers like this: $n="06625632382998574462" and need
to convert to 16 digit hex code similar to:
$h="5D574FA1C71D357E" (this isn't the equiv. to above integer)
... and vice versa.
I have spent a while studying Math::BigInt, but because of my
inexperience with object oriented programming I am having trouble. Or
perhaps there's another way. I just have to convert, not do any
computation.
Would anyone be so kind as to show me the code?
Thanks so much.
Will Cardwell
------------------------------
Date: Mon, 30 Oct 2000 20:55:46 GMT
From: wapache@my-deja.com
Subject: CTRL+Z problem
Message-Id: <8tkn8d$6i2$1@nnrp1.deja.com>
Hi,
I am testing my cgi scripts from the DOS command line. But it
always returns "^Z" when I entered "CTRL+Z" following (offline
mode: enter ...). Could someone please tell me how to fix this.
Thanks!
By the way, "CTRL+C" stops my perl OK.
Zen
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 30 Oct 2000 21:26:53 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: CTRL+Z problem
Message-Id: <8tkp2h$886$1@nnrp1.deja.com>
In article <8tkn8d$6i2$1@nnrp1.deja.com>,
wapache@my-deja.com wrote:
> I am testing my cgi scripts from the DOS command line. But it
> always returns "^Z" when I entered "CTRL+Z" following (offline
> mode: enter ...). Could someone please tell me how to fix this.
Press 'Enter' after 'CTRL+Z'?
> By the way, "CTRL+C" stops my perl OK.
Good!
--
Regards,
Dick
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 30 Oct 2000 15:09:20 -0500
From: Fulko Hew <fulko@wecan.com>
Subject: Re: Detecting socket closure
Message-Id: <39FDD56F.446B@wecan.com>
Another followup to my own post, this time the answer...
You need to add a signal handler for SIGPIPE!
Just by adding the handler, it tells the system to inform you of a PIPE
failure. Receiving any signal causes the OS to interrupt any system
call currently in progress. (This will cause send() to return undef.)
(God only knows what would happen if I tried running this on a Windows
machine that doesn't support signals.)
Although this has solved the problem, it begs the question:
" Why does send() return undef under some conditions, and still blocks
(if you don't have the signal handler) under other situations?"
-----------------------------------------------------------------------
Fulko Hew, Voice: 905-333-6000 x 6010
Senior Engineering Designer, Direct: 905-333-6010
Northrop Grumman-Canada, Ltd. Fax: 905-333-6050
777 Walkers Line, Home: fulko%fkhew@wecan.com
Burlington, Ontario, Canada, L7N 2G1 Work: fulko@wecan.com
------------------------------
Date: Mon, 30 Oct 2000 20:32:32 GMT
From: nir_y@my-deja.com
Subject: fork() for NT platforms
Message-Id: <8tklsv$591$1@nnrp1.deja.com>
The fork() function is not supported on Perl 5.005_02 build for win32.
Is there a way to invoke a child process from current process, where
child process execution point is the same the parent process ?
Help appriciated
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 30 Oct 2000 21:03:55 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: fork() for NT platforms
Message-Id: <8tknnl$70v$1@nnrp1.deja.com>
In article <8tklsv$591$1@nnrp1.deja.com>,
nir_y@my-deja.com wrote:
> The fork() function is not supported on Perl 5.005_02 build for win32.
> Is there a way to invoke a child process from current process, where
> child process execution point is the same the parent process ?
> Help appriciated
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Deja has much more than just post ability for newsgroups. Try searching
sometime:
http://www.deja.com/dnquery.xp?ST=QS&DBS=2&groups=comp.lang.perl.misc&QR
Y=fork&svcclass=dncurrent
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 30 Oct 2000 14:26:26 -0500
From: jesus X <jesusx@who.net>
Subject: FormMail.pl with file attachment support?
Message-Id: <39FDCB62.4F3CF7A8@who.net>
Does anyone know of a Perl script like "Matt's" FormMail.pl program that
supports file attachments? A single attachment is all that's needed...
--
jesus X [ Booze-fueled paragon of pointless cruelty and wanton sadism. ]
email [ jesusx @ who.net ]
web [ http://www.burntelectrons.com/ ]
tag [ The Universe: It's everywhere you want to be. ]
warning [ If at first you don't succeed, reload. ]
------------------------------
Date: Mon, 30 Oct 2000 21:40:55 GMT
From: ISTERIN <isterin@hotmail.com>
Subject: Re: FormMail.pl with file attachment support?
Message-Id: <8tkpt6$95j$1@nnrp1.deja.com>
Just use MIME::Lite to send attachments. Read about different and
supported encodings in the docs.
Ilya Sterin
In article <39FDCB62.4F3CF7A8@who.net>,
jesus X <jesusx@who.net> wrote:
> Does anyone know of a Perl script like "Matt's" FormMail.pl program
that
> supports file attachments? A single attachment is all that's needed...
>
> --
> jesus X [ Booze-fueled paragon of pointless cruelty and wanton
sadism. ]
> email [ jesusx @ who.net ]
> web [ http://www.burntelectrons.com/ ]
> tag [ The Universe: It's everywhere you want to be. ]
> warning [ If at first you don't succeed, reload. ]
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Oct 2000 13:27:51 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: global variables and use strict
Message-Id: <m3d7gijfig.fsf@dhcp11-177.support.tivoli.com>
tadmc@metronet.com (Tad McClellan) writes:
> 3) let them all be in package "main", the default (using dynamic,
> rather than the normally-preferred lexical, variables).
>
> To satisfy "use strict" either
>
> a) use vars qw/$global @global/;
>
[snip]
>
> I vote for 3a)
>
>
> >(and why)?
>
>
> 1) will work across files ( our() won't )
What do you mean "our() won't"? It should work across files just as
well as "use vars" does. Which basically means that you have to put
the declaration in both (all) of the files. Of course, if multiple
files are involved, you're probably better off using Exporter to share
variables.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 30 Oct 2000 15:51:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: global variables and use strict
Message-Id: <slrn8vrnqi.55h.tadmc@magna.metronet.com>
On 30 Oct 2000 10:05:26 -0700, Tom Christiansen <tchrist@perl.com> wrote:
>In article <39FD9A08.42955DA9@home.com>,
>Michael Carman <mjcarman@home.com> wrote:
>>> - what would be the preferred method of the gurus in this newsgroup
>>> (and why)?
>>
>>Make global (via 'use vars') those things which need to be. Use 'my' on
>>everything else.
>
>The Camel states that use vars is "in the process of being replaced
>by our() declarations. We're not in a terrible hurry to break the
>old ways of doing things, but we do think the new ways are prettier."
>Aesthetic concerns aside, our() also offers serious technical
>advantages as well. I can think of scant reason at best ever to
>"use vars" over our(). I suggest that one treat "use vars" as
>vaguely deprecated and not encourage it.
So, when you want to break up your program into separate files
(yet still all in package "main") what is the "new way" to do that?
Or are you saying that folks should not do that?
Or that they _can_ do that, but they must always use fully-qualified
names?
Or, are you just supposed to repeat the our() declaration in
each component program file? (ie. in each lexical scope
where you want to use them unqualified).
I think I have a beef somewhere with the 5.6 docs:
perldoc vars
vars - Perl pragma to predeclare global variable names
(obsolete)
...
NOTE: The functionality provided by this pragma has been
superseded by `our' declarations, available in Perl v5.6.0
or later. See the our entry in the perlfunc manpage.
That implies that whatever I could get with "use vars" I
can instead get from our().
But there _is_ something that I can get with "use vars" that
I cannot get with our():
perldoc -f our
our EXPR
An `our' declares the listed variables to be valid
globals within the enclosing block, file, or
`eval'. That is, it has the same scoping rules as
a "my" declaration, but does not create a local
variable. If more than one value is listed, the
list must be placed in parentheses. The `our'
declaration has no semantic effect unless "use
strict vars" is in effect, in which case it lets
you use the declared global variable without
qualifying it with a package name. (But only
within the lexical scope of the `our' declaration.
In this it differs from "use vars", which is
^^^^^^^^^^^^^^^^^^^^^^^
package scoped.)
Sounds to me like the NOTE should be something like:
NOTE: Some of the functionality provided by this pragma has been
superseded by `our' declarations, available in Perl v5.6.0
or later. See the our entry in the perlfunc manpage.
Other functionality (package scoped) is to be
no-longer-available to Perl programmers.
or something.
Is that right?
It is sounding to me like always using fully qualified names is
moving towards being _required_ in Perl.
And that sounds like bondage. I gotta be missing _something_ here...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 30 Oct 2000 15:31:44 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: global variables and use strict
Message-Id: <39fdf6d0@cs.colorado.edu>
In article <slrn8vrnqi.55h.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>So, when you want to break up your program into separate files
>(yet still all in package "main")
As I've never done that, I doubt it would be something I would
want to do. :-)
>Or are you saying that folks should not do that?
No, I wouldn't quite say that. It just isn't something that I do.
I'd suggest separate packages, probably.
>Or that they _can_ do that, but they must always use fully-qualified
>names?
No.
>Or, are you just supposed to repeat the our() declaration in
>each component program file? (ie. in each lexical scope
>where you want to use them unqualified).
Sure, why not?
>
>
>
>
>
>I think I have a beef somewhere with the 5.6 docs:
>
>perldoc vars
If you're going to use that kind of language around me,
it cannot help but color my response. :-(
>
> vars - Perl pragma to predeclare global variable names
> (obsolete)
>...
> NOTE: The functionality provided by this pragma has been
> superseded by `our' declarations, available in Perl v5.6.0
> or later. See the our entry in the perlfunc manpage.
>
>
>That implies that whatever I could get with "use vars" I
>can instead get from our().
Perhaps it does.
>But there _is_ something that I can get with "use vars" that
>I cannot get with our():
>perldoc -f our
And now that's even nastier, close to fighting words.
> In this it differs from "use vars", which is
> ^^^^^^^^^^^^^^^^^^^^^^^
> package scoped.)
Certainly.
>Sounds to me like the NOTE should be something like:
>
> NOTE: Some of the functionality provided by this pragma has been
> superseded by `our' declarations, available in Perl v5.6.0
> or later. See the our entry in the perlfunc manpage.
>
> Other functionality (package scoped) is to be
> no-longer-available to Perl programmers.
>
>
>or something.
>
>Is that right?
I do not think strange-magic-at-a-distance is "functionality"
that one ought to be strongly advocating. This seems very rare.
>It is sounding to me like always using fully qualified names is
>moving towards being _required_ in Perl.
Absolutely not. You import. Or you our().
>And that sounds like bondage. I gotta be missing _something_ here...
You import. Or you our().
--tom
------------------------------
Date: Mon, 30 Oct 2000 15:06:06 -0500
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: hairy regex - embedded parentheses
Message-Id: <39FDD4AE.40640441@cc.gatech.edu>
fantomette@my-deja.com wrote:
> hello,
>
> could someone help me decipher the following regex:
>
> s/(<[^>]*?\bhref\s*=)(?:\s*(["'])([^\2]*?)\2|\s*([^\s]*?(?=[\s>])))
> /($2?($1 . $2 . &some_function($3) . $2):($1 . &some_function($4)))
> /ie;
>
> precisely, i'm not sure what's in $2, $3 and $4 because i get confused
> with the embedded parentheses.
>
> thanks for your help,
> isabelle
>
This looks like a regex to modify URL's in <a href> tags. The <a href=
portion is captured into $1, and then the regex looks for quotes. If it
finds " or ' , it stores the quote character into $2, and all the
characters inside the quotes are stored into $3. If there are no quotes,
the next set of nonspace characters inside the tag are stored into $4.
The output of some_func then replaces the URL.
HTH
perldoc perlre
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Mon, 30 Oct 2000 17:12:14 -0500
From: "Jtk" <jtk@_nospam_jtkconsulting.com>
Subject: help - $ENV{"QUERY_STRING"}
Message-Id: <svrsf3jqvbojea@corp.supernews.com>
Okay, so I have this script that is working pretty much
the way I want it to. The major problem I am having is
that it works just right from a HTML form but I want to
call it like - script.cgi?variable and cannot figure it out.
I figure it has something to do with $ENV{"QUERY_STRING"}
but when I change the variable that holds the STDIN to
the QUERY_STRING it won't work.
Can anyone point me in the right direction.
Jtk
------------------------------
Date: 30 Oct 2000 22:33:22 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: help - $ENV{"QUERY_STRING"}
Message-Id: <8tksvi$oj$1@internal-news.uu.net>
Jtk <jtk@_nospam_jtkconsulting.com> wrote:
> Okay, so I have this script that is working pretty much
> the way I want it to. The major problem I am having is
> that it works just right from a HTML form but I want to
> call it like - script.cgi?variable and cannot figure it out.
> I figure it has something to do with $ENV{"QUERY_STRING"}
> but when I change the variable that holds the STDIN to
> the QUERY_STRING it won't work.
> Can anyone point me in the right direction.
use the CGI module.
Erik
------------------------------
Date: Mon, 30 Oct 2000 13:38:10 -0800
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: HELP FILE I/O
Message-Id: <39FDEA42.7E4C2E5E@acm.org>
Fraser wrote:
>
> Hi just new at Perl;
> wanting to write a string in a perl script to a file on my system:-
> so far I've got this:
>
> open (FILE,">maina.c") || die "can't open file: $!";
open (FILE,"<maina.c") || die "can't open file: $!";
# Open the file for _input_ if you want to read from it
> $code = <FILE>; #string to write to file
This gets the first line only from maina.c
> close (FILE);
> open (FILE);
open (FILE,">maina.c") || die "can't open file: $!";
# Open the file for _output_ if you want to print to it
> print FILE $code; #write to file????
> close (FILE);
>
> The above isn't working, PLEASE HELP!!
> Fraser
Love your show :-)
John
------------------------------
Date: Mon, 30 Oct 2000 13:31:13 -0400
From: "Howard Chen" <mhchen@stanford.edu>
Subject: Help! Read File
Message-Id: <8tkpb2$apn$1@nntp.Stanford.EDU>
I am trying to do a simple open within a program, and it fails. I checked my
path and cgi file access rights, everything seems to check out right. Is
there anything I am missing here??
------------------------------
Date: Mon, 30 Oct 2000 21:43:20 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Help! Read File
Message-Id: <YXlL5.1907$8m5.290994@news.uswest.net>
"Howard Chen" <mhchen@stanford.edu> elucidates:
> I am trying to do a simple open within a program, and it fails. I checked my
> path and cgi file access rights, everything seems to check out right. Is
> there anything I am missing here??
You are missing the syntax error on line 17.
--
"Civilization rests on two things: the discovery that fermentation
produces alcohol, and the voluntary ability to inhibit defecation.
And I put it to you, where would this splendid civilization be without
both?" --Robertson Davies "The Rebel Angels"
------------------------------
Date: Mon, 30 Oct 2000 22:01:35 GMT
From: rathmore@tierceron.com
Subject: Re: Help! Read File
Message-Id: <8tkr3q$a90$1@nnrp1.deja.com>
In article <8tkpb2$apn$1@nntp.Stanford.EDU>,
"Howard Chen" <mhchen@stanford.edu> wrote:
> I am trying to do a simple open within a program, and it fails. I
checked my
> path and cgi file access rights, everything seems to check out right.
Is
> there anything I am missing here??
How about some code we can look at? Then we can better tell you if you
are doing something wrong. Maybe one of the guru's could tell without
seeing the code, but I can't!
Rathmore
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4766
**************************************