[15858] in Perl-Users-Digest
Perl-Users Digest, Issue: 3271 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 21:10:30 2000
Date: Tue, 6 Jun 2000 18:10:18 -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: <960340218-v9-i3271@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Jun 2000 Volume: 9 Number: 3271
Today's topics:
Re: Multiple Threads Running Perl via Shared Lib - Poss <gresh@earthlink.net>
Net::Ping keeps returning 0? <xxx@planet.nl>
Re: new Object() vs. Object->new() <abe@ztreet.demon.nl>
Re: Perl 5.6 stable?? <sergei_kucherov@3com.com>
Re: PLEASE HELP: Perl for WWW <jeniNOjeSPAM@hotbot.com.invalid>
Re: please?? <xxx@planet.nl>
Re: Simple regexp question - Bug in Perl? <angryflower99@hotSPAMmail.com>
Simple regexp question <angryflower99@hotSPAMmail.com>
Re: Simple regexp question <makarand_kulkarni@My-Deja.com>
Re: Simple regexp question <ryanc@nci1.net>
Re: Simple regexp question <lr@hpl.hp.com>
Re: Simple regexp question <lr@hpl.hp.com>
Re: Simple regexp question <makarand_kulkarni@My-Deja.com>
Re: Simple regexp question <angryflower99@hotSPAMmail.com>
Re: Tr vs. tr !@#@!#$@#% <tzadikv@my-deja.com>
Re: Tr vs. tr !@#@!#$@#% <tzadikv@my-deja.com>
Using PERL to login to Novell? (Terence McAndrew)
using POP3 & STMP through a proxy server... <epfeuffer@nyc.rr.com>
Using Unix SOURCE in PERL SYSTEM?? NEED HELP <Michael.Bukowski@usa.xerox.com>
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP (Abigail)
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP <lfriedl@genome.wi.mit.edu>
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP <makarand_kulkarni@My-Deja.com>
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP <phil@BuxTech.Com>
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP <tony_curtis32@yahoo.com>
Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP <you.will.always.find.him.in.the.kitchen@parties>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Jun 2000 01:04:38 GMT
From: Guy Resh <gresh@earthlink.net>
Subject: Re: Multiple Threads Running Perl via Shared Lib - Possible? Safe?
Message-Id: <794rjsccsuibc8psuioq561ot41q2c3b7r@4ax.com>
On Tue, 06 Jun 2000 15:32:58 GMT, Dan Sugalski <dan@tuatha.sidhe.org>
wrote:
>Guy Resh <gresh@earthlink.net> wrote:
>> Currently, Perl 5.6 (and 5.005_03 for that matter) can be MADE to
>> support multiple concurrent threads, by either running a single
>> interpreter instance with multiple threads sharing the single instance
>> (i.e. configure USE_THREADS), or by using MULTIPLICITY, where each
>> thread runs with it's own interpreter instance. There are SEVERAL
>> nasties here with both of the above, not the least of which:
>
>> With USE_THREADS:
>> 1) performance is less than "optimal" as there are several global
>> mutexes (sv_mutex comes to mind) that kill performance.
>
>You don't even need to get this far for performance to be bad--it's pretty
>slow as it is, even with a single thread.
My "coding day" is typically spent looking at ways to improve
performance by:
1) minimization (or elimination) of unnecessary or inefficient code
(including my own).
2) optimizing concurrency; i.e. find and replace code serialized
around one or more mutexes/locks.
3) repeat 1 & 2 all day long between meetings :)
Applications are often made "MT-safe" by simply mutexing around
variables, or worse, functions, which obviously kills performance.
Targetting mutexes is often easier to tune/replace than trying to
figure out a foreign (undocumented) piece of code, trying to minimize
the number of machine instructions being executed. With the cost of
hardware going down (and getting faster) and the cost of software
developers going up, throwing faster hardware at crappy software is
unfortunately what a lot of companies promote. :(
Simply removing the SV mutex and adding a per-thread PV pool more
than DOUBLED the thread concurrency rate since we were typically
running 300+ threads in the single (Solaris) Netscape process. I was
initially constrained to a single Netscape process since another part
of the application (C++) was only MT-aware and not MP (and MT-)-aware,
forcing me to try and get as much bang for the buck within a single
process. With a single process, I averaged 150-300 TPS (on a secure
HTTPS server, with hardware SSL). I've recently made the code
MP-aware (via shared memory/IPC, which basically tripled the
performance even further.
Perl blows away the Java JVMs that we're now using in production in
other applications. I can't say if the 1.2 or 2.0 Sun JVMs (or any
other for that matter) will outperform what we have now with Perl as I
haven't had the inclination to try and reimplement everything BACK to
Java (Perl was used to replace a Java server-based architecture).
While I like C++ & Java from a language standpoint, embedding Perl in
HTML has made time to market a LOT SHORTER, with Perl extensions in
C/C++ being written and added as needed.
>> 3) there are a few instances where MT-safe versions of certain
>> functions weren't implemented (localtime_r/gmtime_r come to mind).
>
>This is arguably a Configure/C library issue--the source either should use
>a macro-ized version that's #defined to the right thing, or your C libray
>should behave properly when running threaded.
Agreed - all I did basically was to add appropriate "#ifdef
USE_THREADS" to the Perl source, and use the "_r" versions if set.
Easy enough, and made localtime() usable :)
>> With MULTIPLICITY:
>> 1) as currently implemented, there is a global pointer that indicates
>> which interpreter instance is currently "active", so only one thread
>> can actually be running at a time, lest they stomp on one another
>> #2 & #3 from USE_THREADS apply above as well...
>
>This isn't exactly true anymore, at least not as of 5.6.0. There's a
>call--PERL_SET_CONTEXT(my_perl)--that'll do it. (my_perl is supposed to be
>the interpreter structure, I think. No docs for it that I can find yet)
Docs? Isn't the source enough? :P
I had thought the same thing myself, but the curinterp variable was
getting stomped on by the above via dTHX in memory routines (in
util.c/handy.h if I remember correctly). If you trace the macros, the
few remaining globals can be a veritable minefield, just waiting for
Purify to barf all over the place. I left curinterp there, but it's
basically not referenced anymore (or set, for that matter, if I
recall). If I had my druthers, I'd support ALL globals (for those
who want to only run single process/single thread, MULTIPLICITY with
and WITHOUT thread support, but BOTH using/passing contexts around;
i.e. 3 possible configurations to keep things "simple" (?!) :)
I may be wrong on this, of course...
>> I've spent the last year or so "fixing" the above (and a lot more!
>> :( ) with 5.005_03 & lately 5.6, for use at work & "play", including,
>
>> 1) eliminating the need for sv_mutex & strtab_mutexes (each thread has
>> it's own "root-pool". All SVs, HVs, etc. are now thread-centric,
>> which probably goes against the current "desired" model, but it's what
>> I needed for embedding Perl into an NSAPI module within Netscape
>> Enterprise Server on Solaris 2.6. I also maintain separate
>> thread-centric memory blocks, so that hits to the heap are basically
>> eliminated once the server is up and running a few seconds. I can
>> serve 800+ dynamic PHTML pages each second on a 4x400 SPARC 450
>> (non-optimized, i.e. everything compiled with -g).
>
>Do the threads share any data? If not, 5.6.0's MULTIPLICITY should do this
>for you without needing any workarounds now.
The threads under the covers share data in a shared memory segment
(now). MULTIPLICITY would have probably done a lot for me last year,
alas, I was initially trying to save on the memory, since the cost of
a single interpreter instance can get out of hand with 1000+ threads
each with their own interpreter instance. I'm still tweaking memory
usage, but decided to use MULTIPLICITY with 5.6 about a month ago.
>> 2) using MT-safe C functions where appropriate (localtime_r, etc.)
>
>> 3) moving a lot of the interpreter-centric (interpvar.h) variables
>> over to the thread-centric ones (thrdvar.h) and eliminating
>> PERL_OBJECT defines/code since it's being deprecated anyway.
>
>This probably wasn't necessary with a MULTIPLICITY build, and it's not
>needed for an ITHREAD build. (Which is probably the way threads are going
>to move, at least once I get some free time)
Being relatively new to the MULTIPLICITY camp, having been burnt by
the "true" globals, I basically did surgery until I felt I had
encapsulated everything into "well-behaved" compartments (contexts).
The real trick is getting BOTH MULTIPLITY _AND_ USE_THREADS working at
the same time (not that I need that). If I ever get the time, I may
revert back to the baseline source tree (with 5.6.1?), and see what
performance gains are had with each of the "tweaks" that I've
implemented thus far.
>> 4) with 5.6, passing a Perl context EVERYWHERE (including the memory
>> management routines), eliminating the dTHR/dTHX overhead (which also
>> solves the #1 problem above with MULTIPLICITY.
>
>Did you add it into places in 5.6.0 where it wasn't passed before?
Yep - that was an interesting test of "hair retention". :)
My hat still goes off to the Perl gurus who built what we have
today; even though the "road to enlightenment" has been a VERY long
one for myself trying to grasp all the internals, once pieces started
falling in place, it's been nothing short of F-U-N - which is what
it's all about, isn't it? (ducks...)
>Well, I'll be giving a threads tutorial on Monday at TPC. Care to drop by?
>:)
>
> Dan
I wish - I'll be lucky to get to the Monterey conference this year the
way things are going of late...
-Guy
------------------------------
Date: Wed, 7 Jun 2000 01:42:55 +0200
From: "Helza" <xxx@planet.nl>
Subject: Net::Ping keeps returning 0?
Message-Id: <8hk2pt$6vc99$1@reader3.wxs.nl>
Hi,
After reading some post for the problems i had (pinging a server to see if
its online) i got the suggestion to use the net::ping command.
The problem is that i tryed using it but for some unknown reason it always
returns 0 to me, even though i'm 100% sure the ip/server is online..
Nomatter what I try
Any suggestions? :)
I use the following code:
----
#!/usr/bin/perl
use Net::Ping;
$host = "216.147.115.199";
$p = Net::Ping->new();
$retval = $p->ping($host,5);
$p->close();
print "Content-type: text/html\n\n";
print "$retval";
----------
------------------------------
Date: Wed, 07 Jun 2000 00:39:27 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: new Object() vs. Object->new()
Message-Id: <i2vqjs0ton0ceeo9c0gtcpa0ovkvp8cajm@4ax.com>
On Tue, 06 Jun 2000 17:21:46 -0400, Lisa Friedland
<lfriedl@genome.wi.mit.edu> wrote:
>
> > : $tmp = new Parse::FastaQuality();
> > : This statement works in various places throughout my program, but when I
>
> > Have you loaded the Parse::FastaQuality package?
> > Does the Parse::FastaQuality class load its superclasses?
>
> yes, and yes.
> It does work elsewhere (a different method of the same package I'm
> writing), which shows it loaded itself & superclasses without errors (at
> the start of the program). And the other syntax of the call should have
> broken if that were the case, no?
You might want to read
perldoc perlobj
the Method Invocation section
and the WARNING section
>
> For what it's worth, 2 people I've asked about this say "yeah, I've seen
> that sort of thing before but didn't know why, so just switched to using
> the Object->new() form".
Which is adviced by perlobj, read it and _you_ might know why :-)
--
Good luck,
Abe
------------------------------
Date: Tue, 06 Jun 2000 23:52:22 GMT
From: sergei_kucherov <sergei_kucherov@3com.com>
Subject: Re: Perl 5.6 stable??
Message-Id: <8hk2rf$s8i$1@nnrp1.deja.com>
In article <8fan0d$s22$2@news.bnhof.de>,
kraehe@copyleft.de wrote:
...
> I've tested Perl 5.6 as /opt/perl-5.6 on a Debian/Woody, and imho
Perl 5.6
> is not so stable as it should be.
...
I've been extremely disappointed with the quality of Perl5.6.
It is simply not usable (no workaround exists for a core dump bug), and
I am reverting to perl5.00503.
1) My first day of using perl5.6, I found (and reported to
bugs.activestate.com and this newsgroup) a serious regression in perl5.6
regexp handling.
2) My second day of using it (today), I found (and reported to
bugs.activestate.com) a simple use of the LWP module that causes an
internal perl core dump, which _appears_ from the debugger trace to be
in the Carp module! I have not found any workaround for this easily
reproducible problem (on Solaris), and no patch exists yet.
Am I just lucky, or is perl5.6 a shoddy release?
Even though a source patch exists for problem 1 above, it is not easily
available. Why aren't all patches available bundled in with the source
distribution (eg. under a "develop.tar.gz" name)? Then folks like me
could download and build the latest release plus all known good patches.
Instead, it took me several hours to find and build the patch just for
problem 1 above. And I didn't get any of the dozens of other important
patches available through this convoluted method. I guess perl users are
used to this unfriendliness. Contrast this to the Expect language world,
where a new source tar file is put out every time an important patch
occurs (averaging once a month -- and only a small handful of developers
work on it, not an army like with perl). So when I report a bug, I know
for certain whether any patches have the fix (I reported half a dozen
regressions in Expect5.31.*, and all but one (which I have a workaround
for) have been fixed -- I have all the patches just by downloading and
building one tar source tree which is on the web site).
Since the Perl community is so large, what is the problem with making
easily available all extant patches on a web site as they occur? Answer:
laziness and no concern about the serious regressions that make perl5.6
unusable without the patches. Lucky for the perl community that
perl5.00503 is such a bug-free release. perl5.6 is not, and should only
have been released if a mechanism existed to make all known patches
_easily_ available to build from a source tree (CVS doesn't cut it as
easy for the average user -- one tar file does).
I'm sure that _someday_ the dozens of currently "available" patches will
be made usefully available. But I can't wait several months for that.
Back to good old reliable perl5.00503.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 16:18:21 -0700
From: JenX <jeniNOjeSPAM@hotbot.com.invalid>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <024c9b34.1364f8d7@usw-ex0101-005.remarq.com>
Hello all,
I just wanted to send out a big THANK YOU for all your help! I
think I am going to go out to the library and check out those
books...I really appreciate it! Thanks for taking out the time!
If there are any questions I can help with (design questions,
etc) let me know =)
Thanks again,
Jeni
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 7 Jun 2000 01:06:18 +0200
From: "Helza" <xxx@planet.nl>
Subject: Re: please??
Message-Id: <8hk0aa$86ai9$1@reader3.wxs.nl>
Well the problem is that the information i did get wasn't working for some
reason..and im really desperate because this hole project i'm working on is
on a halt until i fix this problem :(
and because i don't know very much about perl and especially not about using
module's i'm really stuck :(
<nobull@mail.com> wrote in message news:u9u2f6pxh0.fsf@wcl-l.bham.ac.uk...
> "Helza" <helza@planet.nl> writes:
>
> > Subject: please??
>
> You posted a question with a sensible subject line.
>
> You didn't like the answers you got so you tried again with a stupid
> one.
>
> Why?
>
> BTW: When you appear claim that your process is thrashing is this
> actually true or was something lost in the translation?
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Tue, 6 Jun 2000 17:44:40 -0700
From: "Some guy" <angryflower99@hotSPAMmail.com>
Subject: Re: Simple regexp question - Bug in Perl?
Message-Id: <sjr6dg1g2t5104@news.supernews.com>
I know, not bloody likely there is a bug in perl. But I can't make sense of
why this working code won;t work in this case.
First off, if anyone is familiar with Snort, I am attempting to write
something to look at vision.conf and search/replace the $INTERNAL and
$EXTERNAL variables with real network numbers.
Each line of the attack sig file (vision.conf) looks like this.
alert tcp $INTERNAL any -> $EXTERNAL 80 (msg: xxx yyy)
OK, here is the code
$vbl="\$INTERNAL"; # From previous advice, added the \
$newval="192.168.1.0/24";
while (<>) {
s/$vbl/$newval/;
print;
}
No, when I use ANYTHING in the vision.conf file as my $vbl, i.e. the word
alert, tcp, 80, msg:, I can successfully substitute $newval. Works great!!
BUT as soon as I try and use $INTERNAL or $EXTERNAL, no dice!! Even with
the \ character suggested by the previous poster.
Why shouldn't it work?
------------------------------
Date: Tue, 6 Jun 2000 16:59:44 -0700
From: "Some guy" <angryflower99@hotSPAMmail.com>
Subject: Simple regexp question
Message-Id: <sjr3p8pt2t515@news.supernews.com>
Hi
I want to replace all occurences of a text string "$INTERNAL" with another
variable defined by a user.
Notice the string starts with a dollar sign. Not sure the implications of
that and/or if it is why I can't get this running right.
Anyways the script itself reads every line from a file and replaces the word
$internal which may or may not be on every line with the user defined
variable which I got from STDIN
The meat of it is as so
$vbl="$INTERNAL";
$newval=<STDIN>;
while (<>) {
$newline=~s/$vbl/$newval/;
print $newline;
}
The output of this is the user defined string "$newval" being printed,
followed by the original line from the file.
i.e. abcdeORIGINALFILEfghij$INTERNALklmnop
My output is as so, provided I entered 666 as the $newval...
666abcde....etc exactly as original above
Anyone have a clue as to what I'm doing wrong???
------------------------------
Date: Tue, 06 Jun 2000 17:05:50 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Simple regexp question
Message-Id: <393D91DE.57B57BAE@My-Deja.com>
> $vbl="$INTERNAL";
replace with $vbl="\$INTERNAL"; or else $vbl just gets the value of $INTERNAL.
------------------------------
Date: Tue, 6 Jun 2000 20:29:34 -0400
From: "Ryan & Treena Carrier" <ryanc@nci1.net>
Subject: Re: Simple regexp question
Message-Id: <393d96ef_1@news.cybertours.com>
As far as I know, if you want to include the dollar sign, you must put a
backslash \ before it:
$vbl = "\$INTERNAL";
Please correct me if I'm wrong.
Some guy <angryflower99@hotSPAMmail.com> wrote in message
news:sjr3p8pt2t515@news.supernews.com...
> Hi
>
> I want to replace all occurences of a text string "$INTERNAL" with another
> variable defined by a user.
>
> Notice the string starts with a dollar sign. Not sure the implications of
> that and/or if it is why I can't get this running right.
>
> Anyways the script itself reads every line from a file and replaces the
word
> $internal which may or may not be on every line with the user defined
> variable which I got from STDIN
>
> The meat of it is as so
>
> $vbl="$INTERNAL";
> $newval=<STDIN>;
> while (<>) {
>
> $newline=~s/$vbl/$newval/;
> print $newline;
> }
>
> The output of this is the user defined string "$newval" being printed,
> followed by the original line from the file.
>
> i.e. abcdeORIGINALFILEfghij$INTERNALklmnop
>
> My output is as so, provided I entered 666 as the $newval...
>
> 666abcde....etc exactly as original above
>
> Anyone have a clue as to what I'm doing wrong???
>
>
>
>
>
>
------------------------------
Date: Tue, 6 Jun 2000 17:23:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Simple regexp question
Message-Id: <MPG.13a735cafe68c92a98ab31@nntp.hpl.hp.com>
In article <393D91DE.57B57BAE@My-Deja.com> on Tue, 06 Jun 2000 17:05:50
-0700, Makarand Kulkarni <makarand_kulkarni@My-Deja.com> says...
> > $vbl="$INTERNAL";
As written, that is exactly equivalent to
$vbl = $INTERNAL;
where $INTERNAL is a scalar variable. Therefore, that's not what the
original poster *really* wrote.
> replace with $vbl="\$INTERNAL"; or else $vbl just gets the value of $INTERNAL.
Nope. Did you test it before posting? Now the attempted interpolation
of $INTERNAL takes place in the regex.
$vbl = '\$INTERNAL';
Or:
$vbl = "\Q\$INTERNAL";
Or use single-quotes:
$vbl = '$INTERNAL';
And put the \Q in the regex.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 6 Jun 2000 17:29:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Simple regexp question
Message-Id: <MPG.13a73740bf0ce9d698ab32@nntp.hpl.hp.com>
In article <sjr3p8pt2t515@news.supernews.com> on Tue, 6 Jun 2000
16:59:44 -0700, Some guy <angryflower99@hotSPAMmail.com> says...
> I want to replace all occurences of a text string "$INTERNAL" with another
> variable defined by a user.
>
> Notice the string starts with a dollar sign.
Not the way you wrote it, it doesn't!
> Not sure the implications of
> that and/or if it is why I can't get this running right.
>
> Anyways the script itself reads every line from a file and replaces the word
> $internal which may or may not be on every line with the user defined
> variable which I got from STDIN
How did '$INTERNAL' get to be '$internal'?
> The meat of it is as so
>
> $vbl="$INTERNAL";
Bogus.
> $newval=<STDIN>;
> while (<>) {
>
> $newline=~s/$vbl/$newval/;
Where did $newline get its value? You should be using $_ here.
> print $newline;
> }
>
> The output of this is the user defined string "$newval" being printed,
> followed by the original line from the file.
>
> i.e. abcdeORIGINALFILEfghij$INTERNALklmnop
>
> My output is as so, provided I entered 666 as the $newval...
>
> 666abcde....etc exactly as original above
>
> Anyone have a clue as to what I'm doing wrong???
I don't think you're doing anything *right*! And I don't think the
behavior you describe above is possible with the code you show.
This might be better:
my $vbl = '$INTERNAL';
chomp(my $newval = <STDIN>);
while (<>) {
s/\Q$vbl/$newval/;
print;
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 06 Jun 2000 17:41:41 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Simple regexp question
Message-Id: <393D9A45.6B0CC7CA@My-Deja.com>
Larry Rosler wrote:
> In article <393D91DE.57B57BAE@My-Deja.com> on Tue, 06 Jun 2000 17:05:50
> -0700, Makarand Kulkarni <makarand_kulkarni@My-Deja.com> says...
> > > $vbl="$INTERNAL";
>
> As written, that is exactly equivalent to
>
> $vbl = $INTERNAL;
>
> where $INTERNAL is a scalar variable. Therefore, that's not what the
> original poster *really* wrote.
>
> > replace with $vbl="\$INTERNAL"; or else $vbl just gets the value of $INTERNAL.
>
> Nope. Did you test it before posting? Now the attempted interpolation
> of $INTERNAL takes place in the regex.
why does the interpolation wait ?
I tried this
$INTERNAL = 'xxx';
$vb1="$INTERNAL";
$vb2="\$INTERNAL";
print $vb1, "\n";
print $vb2, "\n";
prints
xxx
$INTERNAL
------------------------------
Date: Tue, 6 Jun 2000 17:48:46 -0700
From: "Some guy" <angryflower99@hotSPAMmail.com>
Subject: Re: Simple regexp question
Message-Id: <sjr6l5f12t545@news.supernews.com>
Yay, the /Q was the answer!
"I don't think you're doing anything *right*! And I don't think the
behavior you describe above is possible with the code you show"
I'm a very new newbie so I believe you are correct!
However I re-arranged it before I saw any of your replies to something
perhaps a bit better.
It works, which is the main goal.
Thanks for your help and ignore my second post...
Larry Rosler wrote in message ...
>In article <393D91DE.57B57BAE@My-Deja.com> on Tue, 06 Jun 2000 17:05:50
>-0700, Makarand Kulkarni <makarand_kulkarni@My-Deja.com> says...
>> > $vbl="$INTERNAL";
>
>As written, that is exactly equivalent to
>
> $vbl = $INTERNAL;
>
>where $INTERNAL is a scalar variable. Therefore, that's not what the
>original poster *really* wrote.
>
>> replace with $vbl="\$INTERNAL"; or else $vbl just gets the value of
$INTERNAL.
>
>Nope. Did you test it before posting? Now the attempted interpolation
>of $INTERNAL takes place in the regex.
>
> $vbl = '\$INTERNAL';
>
>Or:
>
> $vbl = "\Q\$INTERNAL";
>
>Or use single-quotes:
>
> $vbl = '$INTERNAL';
>
>And put the \Q in the regex.
>
>--
>(Just Another Larry) Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com
------------------------------
Date: Tue, 06 Jun 2000 22:19:07 GMT
From: Tzadik Vanderhoof <tzadikv@my-deja.com>
Subject: Re: Tr vs. tr !@#@!#$@#%
Message-Id: <8hjtca$o69$1@nnrp1.deja.com>
> Did you 'use strict;' ? The error is straight forward if you did.
>
> Bareword "Tr" not allowed while "strict subs" in use at ./kk line 7.
>
> Also, since when did any builtin functions begin with a uppercase
> letter? At least I can't think of any.
>
> Brandon
>
Yes I 'used strict'. And the error was not straightforward. It sounds
like you have the problem reversed in your head. It's not that I'm
using Tr when I meant tr. I'm using tr and I meant Tr. There's
nothing syntactically wrong with tr. That's precisely the problem.
--
Tzadik
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 22:20:21 GMT
From: Tzadik Vanderhoof <tzadikv@my-deja.com>
Subject: Re: Tr vs. tr !@#@!#$@#%
Message-Id: <8hjtek$o82$1@nnrp1.deja.com>
> do you mean CGI.pm? it's already been done - just read the docs.
>
> if you don't read the docs, then who is to blame?
>
> --
> brian d foy
--
I've read the docs. I'd appreciate if you'd clue me in on where in the
docs it points out a way to solve this problem.
Tzadik
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 6 Jun 2000 23:40:22 +0100 (BST)
From: t.j.mcandrew@leeds.ac.uk (Terence McAndrew)
Subject: Using PERL to login to Novell?
Message-Id: <393D7BB0.D61C0AB8@leeds.ac.uk>
How can I use PERL to execute a login to Novell (both 5 and 3.12) ?
------------------------------
Date: Wed, 07 Jun 2000 00:02:46 GMT
From: Evan Pfeuffer <epfeuffer@nyc.rr.com>
Subject: using POP3 & STMP through a proxy server...
Message-Id: <393D92AF.7CC3D28B@nyc.rr.com>
i'm trying to use the POP3 & STMP client classes from behind a
firewall. Do they support and interface for this? If so, could someone
direct me to where i might find a peice of sample code?
Many thanks,
evan.
------------------------------
Date: Tue, 06 Jun 2000 22:30:24 GMT
From: Mike <Michael.Bukowski@usa.xerox.com>
Subject: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <sjqus0bo2t5146@corp.supernews.com>
I am writing a Perl script that must run a shell script in the middle of
the process. The command that is used to run the script from the
commandprompt is:
source systembuild
The command that I have been using is Perl is:
system("source systembuild");
The command does not seem to do anything at all. I have also tried to
execute this using back ticks and exec. Nothing seems to work. Does anyone
know if there is something special that needs to be done in order to use
the Unix SOURCE command inside the system() funcion???
Thanks,
Mike
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: 6 Jun 2000 22:42:03 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <8hjunr$4br$1@news.panix.com>
On Tue, 06 Jun 2000 22:30:24 GMT, Mike <Michael.Bukowski@usa.xerox.com> wrote:
++ I am writing a Perl script that must run a shell script in the middle of
++ the process. The command that is used to run the script from the
++ commandprompt is:
++
++ source systembuild
++
++ The command that I have been using is Perl is:
++
++ system("source systembuild");
++
++ The command does not seem to do anything at all. I have also tried to
++ execute this using back ticks and exec. Nothing seems to work. Does anyone
++ know if there is something special that needs to be done in order to use
++ the Unix SOURCE command inside the system() funcion???
*IF* there was a "unix" source command, system() would work.
However, there isn't.
Did you try to do "man source" or "which source"? The results might be
enlightning. BTW, this question was asked and discussed only a few
days ago as well.
Abigail
------------------------------
Date: Tue, 06 Jun 2000 18:42:11 -0400
From: Lisa Friedland <lfriedl@genome.wi.mit.edu>
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <393D7E43.81EC3BF@genome.wi.mit.edu>
> system("source systembuild");
>
> The command does not seem to do anything at all. I have also tried to
> execute this using back ticks and exec. Nothing seems to work.
You might need to provide the full path both to source (/usr/bin/source
or something) and to systembuild.
-Lisa
------------------------------
Date: Tue, 06 Jun 2000 15:54:28 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <393D8124.7D10AF2F@My-Deja.com>
Mike wrote:
> I am writing a Perl script that must run a shell script in the middle of
> the process. The command that is used to run the script from the
> commandprompt is:
>
> source systembuild
>
> The command that I have been using is Perl is:
>
> system("source systembuild");
>
> The command does not seem to do anything at all. I have also tried to
> execute this using back ticks and exec. Nothing seems to work.
source is something provided by the shell (csh ?) only ( internal command ).
--
------------------------------
Date: 06 Jun 2000 18:59:26 -0400
From: Phil Eschallier <phil@BuxTech.Com>
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <86g0qq8lgx.fsf@BuxTech.Com>
>>>>> "Mike" == Mike <Michael.Bukowski@usa.xerox.com> writes:
> I am writing a Perl script that must run a shell script in the
> middle of the process. The command that is used to run the
> script from the commandprompt is:
> source systembuild
> The command that I have been using is Perl is:
> system("source systembuild");
> The command does not seem to do anything at all. I have also
> tried to execute this using back ticks and exec. Nothing seems
> to work. Does anyone know if there is something special that
> needs to be done in order to use the Unix SOURCE command inside
> the system() funcion???
> Thanks, Mike
> -- Posted via CNET Help.com http://www.help.com/
Mike;
I believe that you'll find that 'source' is /bin/csh builtin, not a
UNIX binary. I think you'll also find that the perl5 system command
is spawning a /bin/sh session (vs. your expected /bin/csh).
Assuming that I've assessed your post properly, this would explain why
you are experiencing the errors you've reported. However, this
explain does not address semantics ... specifically, from my
experience, the common use for 'source' under /bin/csh to to affect
the current environment. Are you trying to set environment variables
for use within your perl5 program? If so, you don't want to use
system() as that spawns a sub-shell ...
Please post more on your actual goals if this discuss needs to go
further.
Best of luck ...
--
Phil Eschallier | Bux Technical Services | Systems, software,
inet phil@BuxTech.Com | 131 Wells Road | security and Inter-
tel 215 348 9721 | Doylestown, PA 18901 | networking for your
fax 215 230 8265 | http://www.BuxTech.Com | business!
KeyID D6E9B193
------------------------------
Date: 06 Jun 2000 18:55:56 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <87ln0icqk3.fsf@limey.hpcc.uh.edu>
>> On Tue, 06 Jun 2000 18:42:11 -0400,
>> Lisa Friedland <lfriedl@genome.wi.mit.edu> said:
>> system("source systembuild");
>>
>> The command does not seem to do anything at all. I have
>> also tried to execute this using back ticks and
>> exec. Nothing seems to work.
> You might need to provide the full path both to source
> (/usr/bin/source or something) and to systembuild.
Sorry, but that's nonsense. I refer you to Abigails's
reply.
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Wed, 7 Jun 2000 12:27:15 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: Using Unix SOURCE in PERL SYSTEM?? NEED HELP
Message-Id: <960337530.254765@shelley.paradise.net.nz>
"Mike" <Michael.Bukowski@usa.xerox.com> wrote in message
news:sjqus0bo2t5146@corp.supernews.com...
> I am writing a Perl script that must run a shell script in the middle of
> the process. The command that is used to run the script from the
> commandprompt is:
>
> source systembuild
>
> The command that I have been using is Perl is:
>
> system("source systembuild");
>
> The command does not seem to do anything at all. I have also tried to
> execute this using back ticks and exec. Nothing seems to work. Does anyone
> know if there is something special that needs to be done in order to use
> the Unix SOURCE command inside the system() funcion???
Typing source <file> in the csh will just read the file into the current
process. source is a csh builtin function, so you can not invoke it via a
system call as it doesn't exist as a command.
I suspect your question really is "How do I read in this environment into my
perl script?"
------------------------------
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 3271
**************************************