[11180] in Perl-Users-Digest
Perl-Users Digest, Issue: 4780 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 29 16:07:21 1999
Date: Fri, 29 Jan 99 13:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 29 Jan 1999 Volume: 8 Number: 4780
Today's topics:
Re: CGI, Xitami and other modules mgrimes@my-dejanews.com
Re: Floating point math errors <james.b.crigler@lmco.com>
Re: Help with simple Perl problem. (Mike Stok)
Re: Help with simple Perl problem. (David Salvador Flores)
Re: Help with simple Perl problem. mike@mjm.co.uk
Re: How long would the Unixes last without Perl? <kperrier@blkbox.com>
Re: ok please don't shoot me for this question <jeff_kerrigan@hotmail.com>
Re: ok please don't shoot me for this question (Clinton Pierce)
Re: ok please don't shoot me for this question <jeff_kerrigan@hotmail.com>
Re: Perl Criticism [summary] <staffan@ngb.se>
Problem: IIS 4 doesn't pass URL path suffix to scripts <gforman@bigfoot.com>
Re: Problem: IIS 4 doesn't pass URL path suffix to scri (Ethan H. Poole)
Problems with finding autosplit.ix ragoff@sandia.gov
Re: Regex for splitting this... <staffan@ngb.se>
Re: Regexp matching ptimmins@netserv.unmc.edu
Re: Stopping a foreach loop (Clinton Pierce)
Re: strange behaviour with tr/// (M.J.T. Guy)
Re: substitution question <spike_YYwhiteYY@YYdellYY.com>
Re: substitution question <jeffhorton@graphatl.com>
Re: substitution question <staffan@ngb.se>
Re: Taint problem with FindBin (Bill Moseley)
The "tr" command <trenic@nortelnetworks.ca>
Re: The "tr" command <staffan@ngb.se>
Re: The behaviour of split() <jdf@pobox.com>
Trouble with greedy string matching (Win32) <kimntodd@dontspamus.execpc.com>
User-Manage 1.53 Installation Problems <not@giving.it.out>
Using Perl to interrogate Hotmail <perlquestions@yahoo.com>
Visitor email! How? dragnovich@my-dejanews.com
Re: Win32: passing values into functions <paullyb8@fnol.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Jan 1999 19:03:11 GMT
From: mgrimes@my-dejanews.com
Subject: Re: CGI, Xitami and other modules
Message-Id: <78t0l8$mm$1@nnrp1.dejanews.com>
I am actually doing almost exactly the same thing. Same version of
Perl, Xitami and Win95+98. It sounds like your doing it right, but
here is my code which _is_ working:
#! c:\progra~1\perl\5~1\bin\mswin3~1\perl
use lib 'C:\My Documents\Development\WebPages\htdocs\cgi-bin';
use FlatDB; # In C:\My Documents\Development\WebPages\htdocs\cgi-bin
Make sure to use the single quotes, or your "\" will get interpretted
and since "use" is delt with at compile time, directory must be static.
I actually want to make the directory dynamic, as I am developing on
once platform to run on another. To do so I am converting from "use"
to "require" like this:
#! c:\progra~1\perl\5~1\bin\mswin3~1\perl
if ( $0=~m#^(.*)\\# ){ $cgi_dir = "c:$1"; } # Dos
elsif( $0=~m#^(.*)/# ){ $cgi_dir = $1; } # Unix
$libDir = "$cgi_dir";
require "$cgi_dir\\FlatDB.pm";
Which also appears to work. Unfortunately, I'm not positive what the
difference is between "use" and "require". According to the doc's
require does not "imports symbols and semantics from that package to
the current one". Anyone know what this will actually do?
Thanks.
In article <78s168$6j4@harrier.le.ac.uk>,
nja@le.ac.uk (A.J. Norman) wrote:
> In article <78lf6c$k917@atbhp.corpmel.bhp.com.au>, Ron Savage
> <Savage.Ron.RS@bhp.com.au> wrote:
> > A guess:
> > 1. You put your modules in a non-standard place
>
> Yes.
>
> > 2. From the command line they are found via PERL5LIB
>
> No, I was either pushing the directory onto @INC from within the
> script, or using the -I option from the command line (two of the
> three methods Srinivasan suggests, which leads on to...)
>
> > 3. Xitami does not honour PERL5LIB
>
> Yes it does - typically the third method (the one I didn't try before
> posting to this group) was the one that worked. The two others
> mentioned above don't seem to work with Xitami, but did from the
> command line. Xitami uses the Unix-style first line of the script to
> invoke Perl, but doesn't seem to pick up the options.
> --
> Andrew Norman, Leicester, England
> nja@le.ac.uk || andrew.norman@le.ac.uk
> http://www.le.ac.uk/engineering/nja/
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 12:53:38 -0500
From: James B Crigler <james.b.crigler@lmco.com>
Subject: Re: Floating point math errors
Message-Id: <36B1F5A2.C29EBAA3@lmco.com>
[Courtesy copy to Larry]
Larry Rosler wrote:
> Why not? If I need resolution in mils, I can divide by 1000 and use
> printf '%.2f' to display rounded cents. The only limitation is that the
> maximum number of whatever unit is chosen is 2**32 - 1, or 2**31 - 1 if
> differences have to be calculated simply.
[Though Perl is only mentioned as a side item below, I still think this
is Perl related, since it discusses the limits and behavior of Perl's
math handling, especially given the automatic transparency of integer /
double conversion.]
This brings up a question that's not an FAQ AFAIK. Perl defaults most
math to floating point (machine's C double), but will, I guess, use
integers
where appropriate (array indexes, etc.). Now if you're doing monetary
computations as you suggest above, the integers could easily grow out of
the range of integers (2,147,483,647 for a 32-bit box). Unless you're
using *my* checkbook. :-)
Here's the question:
If your integers grow bigger than that, is the floating point arithmetic
still exact *for integers* (assuming no division or other nastiness that
would introduce inexactness)?
If so, you have an integer range that runs up to
+/- 18,014,398,509,481,983 (give or take a couple of powers of two -
I've forgotten the number of mantissa bits, so this number is based
on 52 bits of a 64-bit double without an implicit leading "1" bit
and with the sign bit elsewhere in the number).
Even if you're measuring in microns, you could still get over
60 light years from earth.
--
Jim Crigler | james.b.crigler@lmco.com
Lockheed Martin Corporation | Voice: (770)494-4528
D/73-64 Z/0100 | "We'll use him as a footstool or a table to play
86 S. Cobb Dr. | Scrabble on, then tie him up and beat him up and
Marietta GA 30063 | throw him out of Babylon!" -- Veggie Tales
------------------------------
Date: Fri, 29 Jan 1999 10:13:56 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help with simple Perl problem.
Message-Id: <uisQgJ6S#GA.225@news1.texas.rr.com>
In article <78skjn$444$1@murdoch.acc.Virginia.EDU>,
David Salvador Flores <dsf3g@node1.unix.Virginia.EDU> wrote:
>open (INFILE, $thefile) or die "Sorry that file seems not to exist.\n";
>
>-----
>
>In DOS it runs fine, but my UNIX system (an RS6000 running perl5)
>reports the following error:
>
>syntax error in file printfile.pl at line 12, next 2 tokens ") or"
>Execution of printfile.pl aborted due to compilation errors.
This may be a dumb question, but are you *sure* you're running a perl 5
interpreter on the RS6000? Check to see if there's an old perl 4.xxx
interpreter on the RS6000 which might be being used.
perl -v
is a way of displaying the version of a perl inerpreter. On most
unix-like systems it's possible to select a aprticular interpreter using
a #! line at the beginning of the script.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
| 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 29 Jan 1999 18:22:22 GMT
From: dsf3g@node9.unix.Virginia.EDU (David Salvador Flores)
Subject: Re: Help with simple Perl problem.
Message-Id: <78su8u$a4h$1@murdoch.acc.Virginia.EDU>
In article <uisQgJ6S#GA.225@news1.texas.rr.com>,
Mike Stok <mike@stok.co.uk> wrote:
>In article <78skjn$444$1@murdoch.acc.Virginia.EDU>,
>David Salvador Flores <dsf3g@node1.unix.Virginia.EDU> wrote:
>
>>open (INFILE, $thefile) or die "Sorry that file seems not to exist.\n";
>>
>>-----
>>
>>In DOS it runs fine, but my UNIX system (an RS6000 running perl5)
>>reports the following error:
>>
>>syntax error in file printfile.pl at line 12, next 2 tokens ") or"
>>Execution of printfile.pl aborted due to compilation errors.
>
>This may be a dumb question, but are you *sure* you're running a perl 5
>interpreter on the RS6000? Check to see if there's an old perl 4.xxx
>interpreter on the RS6000 which might be being used.
>
> perl -v
>
>is a way of displaying the version of a perl inerpreter. On most
>unix-like systems it's possible to select a aprticular interpreter using
>a #! line at the beginning of the script.
Not a dumb question at all. In fact, I *was* inadvertently using perl4,
even though my #! line seems to be pointing to the perl5 directory. I'm
trynig to has this out with my syadmin as we speak.
Cheers, Dave
------------------------------
Date: Fri, 29 Jan 1999 18:37:06 GMT
From: mike@mjm.co.uk
Subject: Re: Help with simple Perl problem.
Message-Id: <36b1ff77.12314493@nntp.netcom.net.uk>
>
>open (INFILE, $thefile) or die "Sorry that file seems not to exist.\n";
Try replacing the above line with;
open (INFILE, $thefile) || die "Sorry that file seems not to
exist.\n";
The || is the pel equivalent of or
Some systems appear not accept or in this context.
Hope this works
Mike
Mike
MjM Computer Publishing
http://www.mjm.co.uk
------------------------------
Date: 29 Jan 1999 14:47:32 -0600
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <ysi679pvmaj.fsf@blkbox.com>
abigail@fnx.com (Abigail) writes:
>
> Last time I looked, a RH CD with Linux would cost me $79.95 or $65.95,
> pretty impressive prices for just the cost of the media. Solaris for
> for non-commercial use is available for $10.
>
>From cheapbytes (I think) you can get it for about $2.00.
>From www.lsl.com you can get RedHat 5.2 for about $3.00.
NOTE: these versions do not include the MetroX Xserver.
Kent
------------------------------
Date: Fri, 29 Jan 1999 09:26:28 -0800
From: Jeff Kerrigan <jeff_kerrigan@hotmail.com>
Subject: Re: ok please don't shoot me for this question
Message-Id: <36B1EF44.C6542D9A@hotmail.com>
It seems like people on this channel waste more time delivering sarcastic
answers than the 2 seconds it takes to help out a newbie. Try Matt's Scripts
Archive at:
http://www.worldwidemart.com/scripts/
It seems to be a popular place to get a lot of prewritten CGI scripts.
Familie Elst wrote:
> Ok, is there anybody who can write me a guestbook script without banners in
> perl
> or tell me where I can find it ?
> I was trying to write one but my brain has burned out and I really have a
> deathline.
> Can please someone help me out.
>
> Thanks a lot,
>
> Peter
------------------------------
Date: Fri, 29 Jan 1999 18:25:10 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: ok please don't shoot me for this question
Message-Id: <36b2fb5d.787671298@news.ford.com>
On Fri, 29 Jan 1999 09:26:28 -0800, Jeff Kerrigan
<jeff_kerrigan@hotmail.com> wrote:
>It seems like people on this channel waste more time delivering sarcastic
>answers than the 2 seconds it takes to help out a newbie. Try Matt's Scripts
>Archive at:
>
>http://www.worldwidemart.com/scripts/
>
>It seems to be a popular place to get a lot of prewritten CGI scripts.
Stop Sending People There. These scripts are not considered
well-written, current, secure and a good source for getting
production-quality code. It should be pointed out that at one time,
these scripts were one of the few sources for perl examples on How To Do
Things. This is no longer true, and these scripts have a LOT of
problems.
In addition to the (needless) sarcasm: a lot of time is wasted
correcting people giving wrong answers.
------------------------------
Date: Fri, 29 Jan 1999 11:45:51 -0800
From: Jeff Kerrigan <jeff_kerrigan@hotmail.com>
Subject: Re: ok please don't shoot me for this question
Message-Id: <36B20FEF.57B1B581@hotmail.com>
Clinton Pierce wrote:
> On Fri, 29 Jan 1999 09:26:28 -0800, Jeff Kerrigan
> <jeff_kerrigan@hotmail.com> wrote:
>
> >It seems like people on this channel waste more time delivering sarcastic
> >answers than the 2 seconds it takes to help out a newbie. Try Matt's Scripts
> >Archive at:
> >
> >http://www.worldwidemart.com/scripts/
> >
> >It seems to be a popular place to get a lot of prewritten CGI scripts.
>
> Stop Sending People There. These scripts are not considered
> well-written, current, secure and a good source for getting
> production-quality code. It should be pointed out that at one time,
> these scripts were one of the few sources for perl examples on How To Do
> Things. This is no longer true, and these scripts have a LOT of
> problems.
Merely a suggestion to the original poster. I wouldn't know if they're good or
bad since I write all of my own stuff. I have spoken with several people on chat
lines who have successfully implemented scripts using these as a starting point.
>
>
> In addition to the (needless) sarcasm: a lot of time is wasted
> correcting people giving wrong answers.
Again, this was a suggestion not an answer.
------------------------------
Date: Fri, 29 Jan 1999 19:58:44 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Perl Criticism [summary]
Message-Id: <36B204E4.FCEC128@ngb.se>
topmind@technologist.com wrote:
> So spelling and grammar are related to one's programming experiece.
No, but they are together with the use of correct words important to
sending your message to another human being, which is commonly thought
of as being the reason for communication.
> Exactly who is doing the flaming you flaming hypocrite!
> Is this message of yours an example of unemotional
> professional meritous thinking?
Definition:
flame 1. /vi./ To post an email message intended to insult and provoke.
2. /vi./ To speak incessantly and/or rabidly on
some relatively uninteresting subject or with a patently ridiculous
attitude. 3. /vt./ Either of senses 1 or 2, directed with
hostility at a particular person or people. 4. /n./ An instance of
flaming. When a discussion degenerates into useless
controversy, one might tell the participants "Now you're just flaming"
or "Stop all that flamage!" to try to get them to cool
down (so to speak).
Now, aren't your messages intended to provoke? Aren't you speaking
incessantly on some relatively uninteresting subject with a ridiculous
attitude?
You're harassing a lot of intelligent people. You're also speaking about
things with which you are not familiar enough to have a well grounded
opinion of. Please, we respect your right to have an opinion, but we
don't like the fact that you keep coming back without good arguments,
meeting ours with nothing but "I don't understand the words your using,
nor the mechanisms you are describing".
Discussing things isn't only about spelling, grammar and correct use of
words. It's about true knowledge about the issues too, and you seem to
fail in all respects. With some humility, you'd be more than welcome to
learn from others, but your attitude seems to be that you think you know
it all already, and that learning is unimportant. That's not a good way
to become intelligent, knowledgeable or wise.
> To test my Perl knowledge, or to see why Perl is flawed?
It's not that strange. You seem to know nothing about what you're
talking about. I don't mean to offend you, and you can easily prove us
all wrong by posting some good code. Please.
If you're vocabulary is stopping us from seing that you're really very
intelligent and have something interesting to say, you could post some
code, we couldn't refute your claims of intelligence, since programming
language doesn't allow use of bad grammar and ambiguity in the same way
that natural language does.
As interpreters of natural language, we are all much more forgiving (and
therefore more accepting (and encouraging?)) to bad and obfuscated use
of the language than any interpreter or compiler is of any programming
language.
Our acceptance of your strange grammar and spelling (in the sense that
we reply at all) should be very wrong in the way of reasoning that you
use. At the slightest sign of any possibilities of misuse, an
interpreter should stop interpreting and output a fatal error, wasn't
this your point?
So if we criticise your grammar and spelling, see this only as an
interest in knowing what you really mean, since it's hidden by the way
you abuse the english language.
Staffan
------------------------------
Date: Fri, 29 Jan 1999 10:38:40 -0800
From: "George Forman" <gforman@bigfoot.com>
Subject: Problem: IIS 4 doesn't pass URL path suffix to scripts
Message-Id: <78sv9n$eoe$1@hplms2.hpl.hp.com>
Does anyone have a solution to the following problem? IIS 4 chokes on
running CGI scripts with URL path suffixes, that is, if you follow your
script URL with any additional path, it's supposed to get passed to the
script in the PATH_INFO environment variable, as in the following example
(not served by IIS 4):
http://www.ualberta.ca/htbin/dumpenv.pl/pathstring
If instead you use IIS 4, it fails:
http://www.tidalwave.net/cgi-bin/asaa/perltest.pl/pathsuffix
http://www.tidalwave.net/cgi-bin/asaa/perltest.pl
IIS 4 tries to access the file pathsuffix in the directory perltest.pl and
can't find it.
Thanks,
George
== Hewlett-Packard Labs
== Telephone: (650) 857-7835
------------------------------
Date: Fri, 29 Jan 1999 20:22:00 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Problem: IIS 4 doesn't pass URL path suffix to scripts
Message-Id: <ILos2.56$J72.529@news3.ispnews.com>
[Posted and Emailed] In article <78sv9n$eoe$1@hplms2.hpl.hp.com>,
gforman@bigfoot.com says...
>
>Does anyone have a solution to the following problem? IIS 4 chokes on
>running CGI scripts with URL path suffixes, that is, if you follow your
>script URL with any additional path, it's supposed to get passed to the
>script in the PATH_INFO environment variable, as in the following example
>(not served by IIS 4):
>
>http://www.ualberta.ca/htbin/dumpenv.pl/pathstring
>
>If instead you use IIS 4, it fails:
>http://www.tidalwave.net/cgi-bin/asaa/perltest.pl/pathsuffix
>http://www.tidalwave.net/cgi-bin/asaa/perltest.pl
>
>IIS 4 tries to access the file pathsuffix in the directory perltest.pl and
>can't find it.
Sounds like you may not have execute permissions enabled for the /cgi-bin
alias (or the asaa subdir). Alternatively, you may not have Perl properly
configured (I tried your URLs and got a "Document Contains No Data" message
when a PATH_INFO value was present, this suggests that Perl probably did
start, but behaved unexpectedly in some other manner).
IIS 4.0 *will* work properly with a PATH_INFO value, just be aware that in
IIS w/ Perl you will need to strip SCRIPT_NAME from the beginning of
PATH_INFO to get to the true PATH_INFO value.
Example:
http://myserver/cgi-bin/perltest.pl/this_is_my_path/here?hello=nope
Perl Version: 5.00307
The Perl Executable: C:\Perl5\bin\Perl.exe
PATH_INFO = /cgi-bin/perltest.pl/this_is_my_path/here
PATH_TRANSLATED = F:\wwwroot\cgi-bin\perltest.pl\this_is_my_path\here
QUERY_STRING = hello=nope
SCRIPT_NAME = /cgi-bin/perltest.pl
SERVER_PROTOCOL = HTTP/1.0
SERVER_SOFTWARE = Microsoft-IIS/4.0
Now remove SCRIPT_NAME from the beginning of PATH_INFO and you'll have the
true PATH_INFO value.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day, Inc.--
| http://www.interact2day.com/
------------------------------
Date: Fri, 29 Jan 1999 19:33:54 GMT
From: ragoff@sandia.gov
Subject: Problems with finding autosplit.ix
Message-Id: <78t2f2$2ci$1@nnrp1.dejanews.com>
I created a module, called NDS::Template, that uses another module from CPAN,
called App::Config. When I ran the program, perl complained "Can't locate
auto/NDS/Template/autosplit.ix in @INC (@INC contains:
/usr/local/lib/perl5/PA-RISC2.0/5.00404 /usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/ PA-RISC2.0 /usr/local/lib/perl5/site_perl .)
at /usr/local/lib/perl5/AutoLoader. pm line 85."
The problem is that auto/NDS/Template/autosplit.ix doesn't exist because
NDS::Template isn't autosplit -- App::Config is, and there is an
auto/App/Config/autosplit.ix.
I changed the 'use App::Config' to 'require App::Config' in the code, and the
error went away, but I don't understand the consequences well enough to know
if that's the right solution. Can anyone advise me? Thanks. E-mail copies
would be appreciated.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 19:32:05 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Regex for splitting this...
Message-Id: <36B1FEA5.E783FB0C@ngb.se>
@l@ wrote:
> Ok ... I would modify $/ to read a "line of code" instead of an
> actual line:
OK, that's really elegant... But: How does it handle a ; in a quoted
string?
MainDlg->LogMessagef("ERRCODE", "Something went wrong; are you
stupid?", blah, ...);
Staffan
------------------------------
Date: Fri, 29 Jan 1999 18:57:45 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: Regexp matching
Message-Id: <78t0b3$h1$1@nnrp1.dejanews.com>
In article <36b1ae8c.689076639@news.rsv.rsv.se>,
staham@algonet.se (Staffan Hdmdld) wrote:
>
> Hi,
>
> I have a curious regexp question.. I've made a script that
> converts a textfile into a database that I'm using for a
> CGI script written in C.
> What I'm trying to do is to match a name in a string with numbers
> and other things. The name can contain a space or a colon sometimes.
> The only thing that is certain about the name is that it starts and
> ends with a letter, A-Z or a-z. I would like it to match everything
> inbetween the first and the last letter.
> The problem is when $ln contains a name that's just one character
> long.
> I've worked around this by checking the string with if to see if
> it's only one character. Is it possible to match this with just
> one regexp search?
>
> Here is an example.
>
> $ln = "123 3409 2 4293 239 48234 FOOBAR 014 2930 42348 23 90234"
>
> $name = $ln;
>
> # This matches the name as long as it's more than one character long
> $name =~ s/^.*?([a-zA-Z].*[a-zA-Z]).*/\1/;
>
> # fix for short names..
> if(($name =~ /[a-zA-Z].*[a-zA-Z]/) == 0)
> {
> $name =~ s/^.*([a-zA-Z]).*/\1/;
> }
> print "$name\n";
>
if ($ln =~/([a-zA-Z]+(?:.*[a-zA-Z])*)/) {
$name = $1;
}
print "$name\n";
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 18:27:33 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Stopping a foreach loop
Message-Id: <36b3fd53.788174093@news.ford.com>
On Thu, 28 Jan 1999 17:55:55 -0600, James Ludlow <ludlow@us.ibm.com>
wrote:
>Larry Rosler wrote:
>>
>> [Posted and a courtesy copy mailed.]
>>
>> In article <78qkep$uqm$1@nnrp1.dejanews.com> on Thu, 28 Jan 1999
>> 21:22:44 GMT, Ryan.Haman@mci.com <Ryan.Haman@mci.com> says...
>> > Is there anyway to break (stop) a foreach loop?
>>
>> perldoc -f last
>> perldoc -f return
>> perldoc -f exit
>> perldoc -f die
>> perldoc -f exec
>>
>> even (ugh!)
>>
>> perldoc -f goto
>>
>> That's off the top of my head. Did I miss any?
>
>system("/sbin/shutdown -r now");
exec('true')
------------------------------
Date: 29 Jan 1999 18:39:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: strange behaviour with tr///
Message-Id: <78sv9a$45p$1@pegasus.csx.cam.ac.uk>
Uri Guttman <uri@home.sysarch.com> wrote:
>>>>>> "t" == tommy927 <tommy927@my-dejanews.com> writes:
>
> t> while (<>) {
> t> tr/a-mA-Mn-zN-Z/n-zN-Za-mA-M/;
> t> print;
> t> }
>
> t> It works with everything i throw at it but when i try an underscore
> t> (_), it returns M, which is kinda unexpected. I am using Perl
> t> 5.004
>
>what would you want it to return?
>
>from perlop on tr///:
>
>Otherwise, if the REPLACEMENTLIST is shorter than the SEARCHLIST, the
>final character is replicated till it is long enough.
But those two lists are the same length. So that doesn't apply.
And when I try the given code, it works OK, both under perl5.004 and
under a modern Perl.
So something else is going on.
Mike Guy
------------------------------
Date: Fri, 29 Jan 1999 12:49:12 -0600
From: "Spike White" <spike_YYwhiteYY@YYdellYY.com>
Subject: Re: substitution question
Message-Id: <78sv7h$6o6$1@obsidian.us.dell.com>
Jeff Horton wrote in message <78sb7o$3ar$1@camel0.mindspring.com>...
>I have a line of text that I want to substitute all of the "*" in it.
>Such as: "* some text * some more text * more text"
>I want to replace it with a return instead. I have been unsucessful in even
>replacing it with a space. What I have is this:
>&theText = "* some text * some more text * more text";
>&space = "";
>s/'*'/&space/;
>print &theText;
You're doing several things wrong.
$theText = "* some text * some more text * more text";
$theText =~ s/\*/\n/g;
print $theText;
works fine. Replaces every instance of "*" w/ a carriage return.
------------------------------
Date: Fri, 29 Jan 1999 14:30:53 -0500
From: "Jeff Horton" <jeffhorton@graphatl.com>
Subject: Re: substitution question
Message-Id: <78t26t$a09$1@camel0.mindspring.com>
Ok ok ok....I had it typed in correctly on the cpu that i was performing the
task on, so when i went to type it here i mistook the & for the $.
won't ever happen again.
Jeff Horton wrote in message <78sb7o$3ar$1@camel0.mindspring.com>...
>I have a line of text that I want to substitute all of the "*" in it.
>Such as: "* some text * some more text * more text"
>I want to replace it with a return instead. I have been unsucessful in even
>replacing it with a space. What I have is this:
>&theText = "* some text * some more text * more text";
>&space = "";
>s/'*'/&space/;
>print &theText;
>
>what am I inputting incorrectly?
>
>--
>
>Thanks - Jeff Horton
>---------------------------------------------------------------------------
-
>--
>A Dummy Learns From You Who Becomes Clever
>
>
------------------------------
Date: Fri, 29 Jan 1999 21:05:42 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: substitution question
Message-Id: <36B21496.F8342802@ngb.se>
Jeff Horton wrote:
>
> Ok ok ok....I had it typed in correctly on the cpu that i was performing the
> task on, so when i went to type it here i mistook the & for the $.
> won't ever happen again.
Let's hope so. If you REALLY want answers to your questions:
1) Check manuals and FAQs
2) Post a wellstated question
3) Post a part of the REAL CODE your using
Anything else only leads to misuse of everybodys time, and a lot of
sarcastic replies. OK?
Staffan
------------------------------
Date: Fri, 29 Jan 1999 08:10:12 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Taint problem with FindBin
Message-Id: <MPG.111b7d41b8e04b3398968e@nntp1.ba.best.com>
In article <slrn7b2id8.56b.sholden@pgrad.cs.usyd.edu.au>,
> Of course modifying the standard modules that come with perl is probably
> not the best solution to a problem...
>
> My copy of perl doesn't exhibit the any problems with FindBin (I missed the
> original post, so I'm going by the subject...). The following doesn't
> give any complaints :
>
> #!/usr/local/bin/perl -T
> use FindBin qw($Script);
> print $Script;
When I run this I get:
Too late for "-T" option at test line 1.
But when I remove the -T from the shebang and run it as "perl -T test"
then I get:
Insecure dependency in chdir while running with -T switch
at D:\PERL5\lib/Cwd.pm line 262.
BEGIN failed--compilation aborted at D:\PERL5\lib/FindBin.pm line 185.
BEGIN failed--compilation aborted at test line 2.
Now this is running Active State:
This is perl, version 5.005_02 built for MSWin32-x86-object
But now that I check, it doesn't happen on:
This is perl, version 5.005 built for sun4-solaris
Kind of a pain as I'm developing on my local PC.
I guess I'll just have to write only untainted code. ;)
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Fri, 29 Jan 1999 14:39:20 -0500
From: Tom Renic <trenic@nortelnetworks.ca>
Subject: The "tr" command
Message-Id: <36B20E68.ED9AFCA@nortelnetworks.ca>
I posted an earlier message asking how to parse a blank line.
I received the following advice:
>Do this the same way you'd replace _any_ character with another. Look
out for
>the 'tr' operator (see perlop). You have a lot of docs on disk ;
>
>perldoc perlop
>
>e.g.
>
>#!/usr/bin/perl -w
>
>while (<DATA>) {
> tr/\n/,/;
> print;
>}
>
>__DATA__
>hello
>out
>there
>
>
>I assume your 'carriage returns' are unix like here '\n'.
The perl book I'm using isn't very clear. If I have a textarea named
OfficeAddress, and I want the cgi code to print that in the following
format, what do I do:
123 Street Avenue, Detroit Michigan, 12345
rather than
123 Street Avenue
Detroit Michigan
12345
How can I do this?? Help me Please!!
------------------------------
Date: Fri, 29 Jan 1999 21:12:06 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: The "tr" command
Message-Id: <36B21616.A566CAAC@ngb.se>
Tom Renic wrote:
> The perl book I'm using isn't very clear. If I have a textarea named
> OfficeAddress, and I want the cgi code to print that in the following
> format, what do I do:
Get Another One. Or just read the manuals. And search the FAQs.
> 123 Street Avenue, Detroit Michigan, 12345
>
> rather than
>
> 123 Street Avenue
> Detroit Michigan
> 12345
$address =~ s/\n/, /g;
or
$address = join(', ', split(/\n/, $address) );
But chances are that you _might_ have a carriage return too, so try
$address =~ s/\r?\n/, /g;
or
$address = join(', ', split(/\r?\n/, $address) );
Staffan
------------------------------
Date: 29 Jan 1999 17:19:44 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Michael <michael.preminger@jbi.hioslo.no>
Subject: Re: The behaviour of split()
Message-Id: <m3lnim1273.fsf@joshua.panix.com>
Michael <michael.preminger@jbi.hioslo.no> writes:
> Those I split into an array using split(/\s+/, $string )
^^^^^
I'm willing to bet real zorkmids that's not what you mean. You really
mean
split ' ', $string
perldoc -f split
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 29 Jan 1999 14:15:46 -0600
From: "End User" <kimntodd@dontspamus.execpc.com>
Subject: Trouble with greedy string matching (Win32)
Message-Id: <78t4r9$3ga$1@news1-alterdial.uu.net>
I am having trouble. Here is a representation of the input of a process
handle:
| [Running]<tab> SNMP
| [Stopped]<tab> SNMP Trap Service
0 13
The pipe repersents the beginning of the line.
The numbers represent the index numbers of the line, and the tab means that
there is a tab char in the line.
$winsrv = snmp <= this is for reference in this message. It has been chomped
and there are 4 character spaces ($count = 4)
Here is what I am trying to use to parse this :
$ser = substr($line,13,$count);
if ($ser =~ /$winsrv/i){
@svcinfo = service_info("$line");}
I want the this to grab only the first entry for snmp. I want to see that it
is installed, and I dont care about the trap service because I know it is
going to be there if the base service is there. What I really need here is
to know A:) that snmp is intalled, and B:) whether or not is it running.
(ie., stopped or running)
The outcome is always that the service has been found, but that it is not
running. This tells me that it is reading the first instance, and the sub
that is being called it populating the array, but when the next $line is
evaluated, it sees that snmp is there, and overwrites the data in the array
put there by the first match.
I cannot seem to figure out how to tell the matching logic to match only the
first occurrance of snmp.
Help. Please....I am begging here.
Thanks in advance.
--
Todd Hayward
Global Analyst, Systems Engineer
MCSE, Compaq ACT
noc at bakernet dot com
------------------------------
Date: Fri, 29 Jan 1999 20:13:36 +0000
From: Etienne Pollard <not@giving.it.out>
Subject: User-Manage 1.53 Installation Problems
Message-Id: <36B2166F.1BC0D10D@giving.it.out>
I have attempted to install the User-Manage 1.53 package, having
previously successfully installed Perl and CGI.pm on my system, but
following the instructions gave me the following errors. Is this a Win32
problem?
The OS is Win95 OSR2; Perl is 5.004; compiler is Borland C++ 5.02. I
have previously installed the Perl and CGI.pm packages without any
problems.
C:\Apache\Cgi-bin\HTTPD-User-Manage-1.53>perl makefile.pl
Checking if your kit is complete...
Looks good
Writing Makefile for HTTPD-User-Manage
C:\Apache\Cgi-bin\HTTPD-User-Manage-1.53>make
MAKE Version 5.0 Copyright (c) 1987, 1997 Borland International
Error makefile 114: Colon expected
Error makefile 127: Colon expected
*** 2 errors during make ***
C:\Apache\Cgi-bin\HTTPD-User-Manage-1.53>make test
MAKE Version 5.0 Copyright (c) 1987, 1997 Borland International
Error makefile 114: Colon expected
Error makefile 127: Colon expected
*** 2 errors during make ***
C:\Apache\Cgi-bin\HTTPD-User-Manage-1.53>make install
MAKE Version 5.0 Copyright (c) 1987, 1997 Borland International
Error makefile 114: Colon expected
Error makefile 127: Colon expected
*** 2 errors during make ***
Etienne Pollard
------------------------------
Date: Fri, 29 Jan 1999 19:45:46 GMT
From: Barb - perlgirl <perlquestions@yahoo.com>
Subject: Using Perl to interrogate Hotmail
Message-Id: <78t356$38n$1@nnrp1.dejanews.com>
I want to write something that will log into my hotmail and yahoo accounts
and identify whether I have any new messages. I normally set up an account
on one or the other for each project on which I work (I do a little
consulting) and it's a pain after awhile to log into 8-9 accounts each day.
I have been noodling with a couple Perl libraries, but haven't figured out
where to look for code that will help me through the login, etc.
Any ideas guys?
Barbara
perlquestions@yahoo.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 20:08:41 GMT
From: dragnovich@my-dejanews.com
Subject: Visitor email! How?
Message-Id: <78t4g0$4dq$1@nnrp1.dejanews.com>
Hello I have a NT server and IIS 3.0 (not my best choice)
Well suffing on the net I enter to Microsoft webpage and I say hey lets!
subscribe my self to the MS developers network!
When I enter my data I never put my email but in one time IS SEE MY EMAIL on
a filed! How can they do this??? Some frind tell me that he is reciving email
from other companies like CNN and others... so I think it is the same thing.
Are there somo new CGI ENV variables?? or it can be obtained by Java?? or Java
Script?? or C??or how in the hell! they can get that kind of info! because is
helpfull to know the email of my site visitors.
=-) bussiness are bussines!
Ok I hope you can help!
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 13:44:42 -0500
From: Paul Bruno <paullyb8@fnol.net>
Subject: Re: Win32: passing values into functions
Message-Id: <36B2019A.4C9FEF13@fnol.net>
Thanks a whole bunch, Matt! After I did that, it worked like a dream! I just
wondered one thing: Is the default scalar varible the same way? Is it $_
instead of $__?
Thanks for the help, Matt, and anyone else who replies!
Matthew Bafford wrote:
> On Thu, 28 Jan 1999 22:29:07 -0500, Paul Bruno <paullyb8@fnol.net> wrote:
> [snip]
> -> function, it is stored in the default @__ varible. Well, when I was
>
> s/\@__/\@_/;
>
> I don't have a LLama, so I can't say if it's a bug or a braino.
>
> [snip]
> -> was given to the @__ varible. So my question is this: What does Active
> -> Perl give the passed-on value to? What varible does it store it in?
>
> AS Perl is almost identical to the main dist. The only major differences
> are to work around Win32 limitations.
>
> -> Thanks for the help!
>
> HTH!
>
> --Matthew
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4780
**************************************