[7543] in Perl-Users-Digest
Perl-Users Digest, Issue: 1169 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 13 15:27:14 1997
Date: Mon, 13 Oct 97 12:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 13 Oct 1997 Volume: 8 Number: 1169
Today's topics:
Re: ?Help making MakeMaker/NT (Danny Aldham)
choosing a recipent to send to via form. <mattb@netrex.com>
Connecting to a HTTP server franklin@nospamingideas4you.com
Re: Connecting to a HTTP server (Jeremy D. Zawodny)
Re: Connecting to a HTTP server (Danny Aldham)
Re: Coping with backslashes in Win32 Perl? <egodeath@geocities.com>
Re: Coping with backslashes in Win32 Perl? <bryan@eai.com>
DBM documentation <mark_aurit@NOSPAM.mail.northgrum.com>
Re: DBM documentation (Jeremy D. Zawodny)
Frontpage and Perl <george@smithgeo.demon.co.uk>
Re: help building libraries keng@removethis.wco.com
Re: Help embedding html tag in output <jefpin@bergen.org>
Re: How can I "use vars" with Perl 5.001? (Andrew M. Langmead)
Need RE to change overstrikes to HTML (Clinton Pierce)
Re: Need RE to change overstrikes to HTML (Clinton Pierce)
newbie: counting patterns (Sandra Batista)
Re: newbie: counting patterns (Jeremy D. Zawodny)
Re: newbie: counting patterns <ajohnson@gpu.srv.ualberta.ca>
Re: newbie: counting patterns (Tad McClellan)
Re: Perl + MS Internet Information Server <richard@ifi.uio.no>
Re: perl -e -i ... (Tad McClellan)
Perl for Win32 in cgi (Paul D. Chapin)
Problems compiling perl under Solaris 2.5.1 (Steve Heaven)
Re: Recursive pattern replacement - help (Tad McClellan)
reg exp size limit !? sartang@pcocd2.intel.com
reg exp size limit !? <sartang@pcocd2.intel.com>
Re: reg exp size limit !? (Jeremy D. Zawodny)
Re: s/ / /g or tr/ / / what is the difference? <bryan@eai.com>
Re: s/ / /g or tr/ / / what is the difference? (Andrew M. Langmead)
statics or const in perl ? <sartang@pcocd2.intel.com>
Re: Testing for file (Jeremy D. Zawodny)
Re: Wanted: Wall/Schwartz book (1st ed) <bryan@eai.com>
Re: Warnings when testing undefined variables with perl <eike.grote@theo.phy.uni-bayreuth.de>
Re: Why the ambiguity? <add@rice.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Oct 1997 11:18:50 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: ?Help making MakeMaker/NT
Message-Id: <61toma$8bf$1@lennon.postino.com>
keng@removethis.wco.com wrote:
: Running Perl/Win32 on WindowsNT, and trying to build LWP, I ran into the
: problem that I seem to not have MakeMaker. So I got the sources for
: MakeMaker, and when trying to build them, I seemed to be missing extutils.
: Fine, get the extutils, and try to build that, but of course I can't,
: because I don't have MakeMaker!?!?!
: Isn't MakeMaker and/or extutils supposed to be part of the perl5
: distribution? Did I forget something? I installed Pw32i310, plsei310,
: and Piis310. Can someone help me sort this out?
MakeMaker is not included in the Activestate binary. But, you can
install LWP by manually copying the modules into the \Perl\lib\LWP
directory. You also need the Mime64 module to run LWP.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I wak'd, she fled, and day brought back my night. jm
------------------------------
Date: Mon, 13 Oct 1997 14:26:50 -0300
From: mattb <mattb@netrex.com>
Subject: choosing a recipent to send to via form.
Message-Id: <344259D9.FDD591D7@netrex.com>
--------------789A6C325665B4CEBED025E5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I am using perl with a form that sends out an email to managers of
different department in my company. The user selects the department to
be billed in the form. I want to take the users entry, from a pull down
menu, which they use to select the department, I then want the perl
script to reassign the $recipient, to be from the selection from that
pull down menu.
any ideas???
--
Matt Barnes Netrex Inc.
Web Project Manager http://www.netrex.com
1.248.945.6726 mattb@netrex.com
---------------------------------------------------
--------------789A6C325665B4CEBED025E5
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
I am using perl with a form that sends out an email to managers of different
department in my company. The user selects the department to be billed
in the form. I want to take the users entry, from a pull down menu,
which they use to select the department, I then want the perl script to
reassign the $recipient, to be from the selection from that pull down menu.
<BR>any ideas???
<PRE>--
Matt Barnes Netrex Inc.
Web Project Manager <A HREF="http://www.netrex.com">http://www.netrex.com</A>
1.248.945.6726 mattb@netrex.com
---------------------------------------------------</PRE>
</HTML>
--------------789A6C325665B4CEBED025E5--
------------------------------
Date: Mon, 13 Oct 97 11:38:43 -0400
From: franklin@nospamingideas4you.com
Subject: Connecting to a HTTP server
Message-Id: <3442412b$1$senaxyva$mr2ice@news.alltel.net>
Could someone show a small script on how to connect to a HTTP server.
Would you make the example connect to www.ideas4you.com on port 80?
I've read the docs on this and it just doesn't make any real sense to me.
--
-----------------------------------------------------------
Coming Soon,
"Discussion Groups" the power of the news groups packed into the manageablity of a mail list.
Virtual Computer Shopper
VCS Manager: Franklin Smith
E-Mail Address: franklin@ideas4you.com
Web Site: http://www.ideas4you.com/vcs
Ideas Unlimited Consulting
http://www.ideas4you.com
We do custom REXX and Paradox programming, Web Site Construction and Management, and Computer Hardware and Software Sales and Service.
Books Unlimited
BU Mangaer: Jim Smith
E-Mail Address: jimsmith@ideas4you.com
http://www.ideas4you.com/bu
-----------------------------------------------------------
------------------------------
Date: Mon, 13 Oct 1997 16:48:13 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Connecting to a HTTP server
Message-Id: <34475090.422168846@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 97 11:38:43 -0400, franklin@nospamingideas4you.com
wrote:
>Could someone show a small script on how to connect to a HTTP server.
>
>Would you make the example connect to www.ideas4you.com on port 80?
>
>I've read the docs on this and it just doesn't make any real sense to me.
I'd suggest getting the LWP modules. They come with a script called
"GET" which does what you're looking for. It's a superb web client
implementation in Perl--well worth your time to learn if you will be
doing a significant amount of it.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 13 Oct 1997 11:25:09 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Connecting to a HTTP server
Message-Id: <61tp25$8g0$1@lennon.postino.com>
franklin@nospamingideas4you.com wrote:
: Could someone show a small script on how to connect to a HTTP server.
: Would you make the example connect to www.ideas4you.com on port 80?
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTML::Parse;
my $ua = new LWP::UserAgent;
# Could also use ARGV[0] instead of "http://www.ideas4you.com"
my $request = new HTTP::Request('GET', "http://www.ideas4you.com" );
my $response = $ua->request($request);
if ($response->is_success) {
print parse_html($response->content)->format;
} else {
print $response->as_string;
}
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I wak'd, she fled, and day brought back my night. jm
------------------------------
Date: Mon, 13 Oct 1997 10:55:24 -0400
From: Steve Harvey <egodeath@geocities.com>
Subject: Re: Coping with backslashes in Win32 Perl?
Message-Id: <3442365C.13D9@geocities.com>
Hans Schrader wrote:
> This is completely new to me: I am using Perl32 5.00_3 and use "normal"
> Unix type forward slashes in both WinNT and Win95 and they are correctly
> interpreted!
>
>
> In article <343D11F2.4C1E@geocities.com>, Steve Harvey <egodeath@geocities.com> wrote:
>
> >I'm writing some maintainance scripts using Win32 Perl for our Netware
> >servers, which means I have to dereference all the backslashes when
> >referring to directory paths (i.e. I have to use '\\\\fs1\\sys\\foo'
> >instead of just '\\fs1\sys\foo')
> >I have tried myriad combinations of weird quotes, but I have been > >unable
> >to get the substitute/translate/etc. operators to recognize the
> >single backslash in the original string for what it is.
Thanks for your reply, Hans. The forward slashes *do* work, and are
probably neater than what I was doing, but the reason I started using
the backslashes in the first place is because I'm the only Perl/Unix
person in our (mostly Netware) shop... The idea is for the script to
take as its input a list of Netware directories, parse them for certain
criteria (age, etc.) and write another list of directories as the
output. Since these same text files may also be used with DOS batch
files, etc., it would be preferable to use backslashes wherever
possible, but I can't get the single backslashes to work in the input
file.
This is relatively minor, and certainly not mission-critical, but I'm
very frustrated since this is the sort of thing Perl is supposed to be
ideally suited for, yet I'm completely stumped! :-)
-Steve
------------------------------
Date: Mon, 13 Oct 1997 13:33:24 -0500
From: Bryan Hart <bryan@eai.com>
To: Steve Harvey <egodeath@geocities.com>
Subject: Re: Coping with backslashes in Win32 Perl?
Message-Id: <34426974.446B@eai.com>
Steve Harvey wrote:
>
> I'm writing some maintainance scripts using Win32 Perl for our Netware
> servers, which means I have to dereference all the backslashes when
> referring to directory paths (i.e. I have to use '\\\\fs1\\sys\\foo'
> instead of just '\\fs1\sys\foo')
>
> My problem is with a subroutine which parses a list of pathnames,
> read from a user-maintained text file. The program chokes if I don't
> dereference the backslashes, and I'd rather not make the
> (perl-illiterate) users have to deal with the ugly syntax. In other
> words, if the program reads a line from the file:
>
> \\fs1\sys\foo
>
> and assigns it to $pathname, I'd like to be able to do something like
>
> $pathname =~ tr/'\'/'\\'/;
>
> in order to end up with the value '\\\\fs1\\sys\\foo' which the rest of
> the program can digest for purposes of evaluation, output, etc... I
> have tried myriad combinations of weird quotes, but I have been unable
> to get the substitute/translate/etc. operators to recognize the single
> backslash in the original string for what it is.
>
> Suggestions?
>
> Thanks,
> Steve
you need to derefence the \'s inside the s/// and tr/// statements as
well, try
$pathname =~ tr/\\/\\\\/;
this should replace all single \'s with \\
Bryan
--
-------------------------------
| Bryan Hart
| Network Products Engineer
| Engineering Animation Inc.
| Phone: (515) 296-5979
| Fax: (515) 296-7025
| Email: bryan@eai.com
| Web: http://www.eai.com/
-------------------------------
"A conclusion is simply the place where you got tired of thinking"
------------------------------
Date: Mon, 13 Oct 1997 15:30:03 GMT
From: "Mark Aurit" <mark_aurit@NOSPAM.mail.northgrum.com>
Subject: DBM documentation
Message-Id: <01bcd7ec$dd83fe40$3d846380@MAURIT>
Can anyone point me to a good (perferably on-line) source of DBM
documentation? The books I have say very little about it, and my
searches on www.perl.com were all over the place. I just want to use
some basic functionality (read from a file, write to the file, lookups,
etc).
Thanks, Mark
mark_aurit@mail.northgrum.com
------------------------------
Date: Mon, 13 Oct 1997 16:38:52 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: DBM documentation
Message-Id: <34444e09.421522397@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 1997 15:30:03 GMT, "Mark Aurit"
<mark_aurit@NOSPAM.mail.northgrum.com> wrote:
>Can anyone point me to a good (perferably on-line) source of DBM
>documentation? The books I have say very little about it, and my
>searches on www.perl.com were all over the place. I just want to use
>some basic functionality (read from a file, write to the file, lookups,
>etc).
Well, for DBM itself, 'man -k dbm' yields about 20 hits on my Solaris
box.
As for Perl specific, the Camel Book has some good examples. Actually,
so does the Lama, come to think of it. Which books are you using?
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 18:08:01 +0100
From: "George Smith" <george@smithgeo.demon.co.uk>
Subject: Frontpage and Perl
Message-Id: <876762483.15686.0.nnrp-09.9e98e7a3@news.demon.co.uk>
Help,
I am trying to run perl scripts with FrontPage and the PWS,
perl appears to be installed fine and it runs at DOS with no problems, it
also runs via windows by opening a DOS box and executing the script, when
called however from a form in Frontpage it does not run but asks if you wish
to open or download the file. When acalled from and external account a HTTP
1.0 Error 500 occurs.
Can anyone tell me what I am going wrong and what the
command line should be in the FrontPage action box, please e-mail yo
george@smithgeo.demon.co.uk.
In Anticipation
George Smith
THE PIGOYLE PRESS
(The Paper that puts the PUB in
Publication)
http://www.smithgeo.demon.co.uk
------------------------------
Date: 13 Oct 1997 12:59:56 GMT
From: keng@removethis.wco.com
Subject: Re: help building libraries
Message-Id: <61t60c$nhp$1@news.wco.com>
Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:
> [cc'd automagically to original author]
> On 12 Oct 1997 15:30:14 GMT, keng@removethis.wco.com wrote:
> >Trying to install libnet-1.0505 (and others) I get the message:
> >"Checking to see if your kit is complete....
> >Can't locate ExtUtils/Manifest.pm in @INC at (eval 1) line 374.
> >
> >There is indeed no "manifest.pm" in the extutils directory. Was that
> >supposed to have been generated when I installed the Perl/Win32 source?
> Get Gurusamy Sarathy's Perl5.004 for Win32 port, and I think you'll
> have better luck. You're using AvtiveState's, right?
Yes, I have been using ActiveState's. Thanks very much for the advice,
I will purge my current installation and get the Gurusamy Sarathy port.
-Ken
> Jeremy
> --
> Jeremy Zawodny
> Internet Technology Group
> Information Technology Services
> Marathon Oil Company, Findlay Ohio
> http://www.marathon.com/
> Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 11:11:34 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Chris Welch <cwelch@cais.com>
Subject: Re: Help embedding html tag in output
Message-Id: <Pine.SGI.3.95.971013110941.15312A-100000@vangogh.bergen.org>
>I'm parsing a string for a users's request. They enter a state via a
>pulldown and it matches this in the "states_served" field. When I output
>this I'd like to make the state they selected bold.
>
>In other words make "VA-MD-WV" appear as "<b>VA</b>-MD-WV" when it's
>displayed.
>
>I've looked high and low but don't have a clue as to what I'm doing
>wrong. I'm learning Perl on my own and don't know anybody at work using
>it...
>
>Am I even on the right track ? I've tried the following:
> $tserved =~ tr'$fstate'<b>$fstate</b>';
No no... not tr///... and incidentally, I believe perl5 doesn't
interpolate when you use single quotes for s/// and m// and tr///.
You want something like:
$tserved =~ s/$fstate/<b>$fstate</b>/;
That should help ya!
----------------
| "She turned me into a newt... I got better."
| - John Cleese (Monty Python)
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: Mon, 13 Oct 1997 18:08:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How can I "use vars" with Perl 5.001?
Message-Id: <EI051p.3ov@world.std.com>
dan@gulch.demon.co.uk (Dan Sumption) writes:
>Does anyone know of a good workaround which doesn't require removing
>every 'use strict' in the program?
1. Find another ISP who won't leave obsolete software (with security
flaws) like 5.001 around unfixed.
2. BEGIN { eval "use vars; use strict;" if $] > 5.001; }
3. See if you can make any of those globals file scoped lexical
variables. That is, my'd variables outside of any block.
4. Use fully qualified variable names. According to the "strict"
documentation (man page or local ports equivalent), the
"use strict 'vars'" directive will complain about variables unless
they are either lexically local variables declared via "my" or are
fully qualified with their package name. The "use strict 'vars'"
pragma won't complain about the variable "$main::DEBUG", only
"$DEBUG".
--
Andrew Langmead
------------------------------
Date: 13 Oct 1997 15:34:31 GMT
From: cpierce1@cp501.fsic.ford.com (Clinton Pierce)
Subject: Need RE to change overstrikes to HTML
Message-Id: <61tf27$grc2@eccws1.dearborn.ford.com>
I've been diddling with this for couple of hours now, and want to
know if anyone has a clever way of doing this?
Given input text that looks like:
t^Ht^Ht^Hh^Hh^Hh^He^He^He^H q^Hq^Hq^Hu^Hu^Hu^Hi^Hi^Hi^Hc^Hc^Hc^Hk^Hk^Hk^H
(the phrase "the quick" with 3 backspace-overstrikes per letter)
Is there a simple RE that will change the text to:
<B>the quick</B>
I won't embarass myself by posting my attempts at getting this to work.
Can anyone help?
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P++++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: 13 Oct 1997 17:06:55 GMT
From: cpierce1@cp501.fsic.ford.com (Clinton Pierce)
Subject: Re: Need RE to change overstrikes to HTML
Message-Id: <61tkfg$pa81@eccws1.dearborn.ford.com>
In article <61tf27$grc2@eccws1.dearborn.ford.com>,
cpierce1@cp501.fsic.ford.com (Clinton Pierce) writes:
>Given input text that looks like:
>
>t^Ht^Ht^Hh^Hh^Hh^He^He^He^H q^Hq^Hq^Hu^Hu^Hu^Hi^Hi^Hi^Hc^Hc^Hc^Hk^Hk^Hk^H
Typo in the input text!!! All overstrikes, no advances. This is correct:
t^Ht^Ht^Hth^Hh^Hh^Hte^He^He^He q^Hq^Hq^Hqu^Hu^Hu^Hui^Hi^Hi^Hic^Hc^Hc^Hck^Hk^Hk^k
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P++++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: 13 Oct 1997 15:49:04 GMT
From: batista@fas.harvard.edu (Sandra Batista)
Subject: newbie: counting patterns
Message-Id: <61tftg$bhc$1@news.fas.harvard.edu>
hi, can anyone please tell me how to count the number of patterns on a
line in a file? particularly, i am trying to count the number of tabs per
line?
please respond to this group or to batista@fas.harvard.edu
thanks very much in advance.
best regards,
sandra
------------------------------
Date: Mon, 13 Oct 1997 16:43:14 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: newbie: counting patterns
Message-Id: <34464efb.421763684@igate.hst.moc.com>
[cc'd automagically to original author]
On 13 Oct 1997 15:49:04 GMT, batista@fas.harvard.edu (Sandra Batista)
wrote:
>hi, can anyone please tell me how to count the number of patterns on a
>line in a file? particularly, i am trying to count the number of tabs per
>line?
>please respond to this group or to batista@fas.harvard.edu
>thanks very much in advance.
>best regards,
>sandra
To quote the Perl FAQ directly:
---quote---
How can I count the number of occurrences of a substring within a
string?
There are a number of ways, with varying efficiency: If you want a
count of a certain single character (X) within a string,
you can use the tr/// function like so:
$string = "ThisXlineXhasXsomeXx'sXinXit":
$count = ($string =~ tr/X//);
print "There are $count X charcters in the string";
This is fine if you are just looking for a single character. However,
if you are trying to count multiple character substrings
within a larger string, tr/// won't work. What you can do is wrap a
while loop around a global pattern match. For example,
let's count negative integers:
$string = "-9 55 48 -2 23 -76 4 14 -44";
while ($string =~ /-\d+/g) { $count++ }
print "There are $count negative numbers in the string";
---quote---
There you have it. The answer was there all along.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 11:38:27 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: newbie: counting patterns
Message-Id: <34425C93.239FB87B@gpu.srv.ualberta.ca>
Sandra Batista wrote:
>
> hi, can anyone please tell me how to count the number of patterns on a
> line in a file? particularly, i am trying to count the number of tabs per
> line?
> please respond to this group or to batista@fas.harvard.edu
> thanks very much in advance.
> best regards,
> sandra
if the pattern is a single character you could use tr///
$count=tr/\t//;
if the pattern is more complicated than a single character:
$count=()=/$pattern/g; #perl5.004 or better only
or perhaps
$count=@{[/$pattern/g]};
or even
$count=s/($pattern)/$1/g;
(assuming the line is in $_ ... efficiency concerns left
as an excersise :-)
regards
andrew
------------------------------
Date: Mon, 13 Oct 1997 12:48:33 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: newbie: counting patterns
Message-Id: <htmt16.1o1.ln@localhost>
Sandra Batista (batista@fas.harvard.edu) wrote:
: hi, can anyone please tell me how to count the number of patterns on a
: line in a file? particularly, i am trying to count the number of tabs per
: line?
Why count patterns when all you really want to count is characters?
$cnt = tr/\t/\t/;
If you did want to count patterns you could do:
$cnt = s/(\t)/\t/g;
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Oct 1997 19:52:29 +0000
From: Richard Moe <richard@ifi.uio.no>
Subject: Re: Perl + MS Internet Information Server
Message-Id: <hhpvp9o2yq.fsf@birk98.studby.uio.no>
"Justin Kamerman" <justink@dexel.co.za> writes:
> I have been doing HTML scripting for MS Internet Information Server running
> on NT 4.0.
> I now want to include Perl scripts in some of my pages. Does anyone know
> how I test/develop/implement Perl scripts on this server platform ?
I have been struggling with this myself. You need to install perl
in some local directory and add a path to it (control-panel|system).
Start regedit and find the key called 'ScriptMap' and insert a new
value for the '.pl' extension and fill in the path to the perl.exe
file.
I could never get this to work properly on IIS v2.0 so I would recommend
trying it on IIS v3.0 or greater in order to get it to work.
(With IIS it almost seems like M$ is trying to force web-developers to
use VB, ActiveX etc. instead of Perl)
--
richard@ifi.uio.no
richard.moe@jbi.hioslo.no
http://birk98.studby.uio.no
------------------------------
Date: Mon, 13 Oct 1997 12:39:26 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: perl -e -i ...
Message-Id: <ecmt16.1o1.ln@localhost>
Berne Woolley (Berne@worldnet.att.net) wrote:
: I have a file that contains the string "unikixvsamHP" once and the string
: "$(COBOL) $(COBFLAGS)" on many lines. I want to insert a string between the
: 2 words of the COBOL string.
: $(BINDIR)/unikixvsamHP: $(VSAMOBJECTS) makefile
: rm -f $@
: $(COBOL) $(COBFLAGS) -x $(LDFLAGS) -o $@ \
: So, what have I wrong with this perl 5.003 command?
you are not giving it a -0777 switch (documented in the perlrun man page)
: I simply end up with
: identical copies of makefile & makefile.orig. I've tried it with and
: without the s modifier (i.e., s/.../.../s).
If you want to match against a multiline string, then you need to
have a multiline string to match against ;-)
: perl -e 's/.*(unikixvsamHP.+?\$\(COBOL\))\s+?(\$\(COBFLAGS\))/$1 Syncsort
: String $2/' -wp -i.orig ./makefile
The pattern never matches, so never substitutes, because perl normally
reads a single line at a time, and you didn't tell it to do any differently.
You don't need non-greedy for the \s matching either.
I would also probably go with \Q and \E to avoid all that backwacking:
UNTESTED
perl -p -i.orig -0777 -e 's/(unikixvsamHP.+?\Q$(COBOL)\E)\s+(\Q$(COBFLAGS)\E)/$1 Syncsort String $2/gs' makefile
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Oct 97 15:16:33 GMT
From: pdchapin@unix.amherst.edu (Paul D. Chapin)
Subject: Perl for Win32 in cgi
Message-Id: <34423b51.0@amhnt2.amherst.edu>
Is it possible to create a perl cgi script that will run with the
Personal Web Server on a Win95 system and, if so, how? Unfortunately,
the documentation on both the perl and server side are a little weak
on this.
Why would I want to do this you might add. Well, we've been letting
our users write cgi scripts that run on our UNIX server. This is
generally a very bad idea. We've also been considering replacing the
UNIX server with an NT based server. The idea is that we'll block
individuals from running cgi scripts on our server and tell them that
if they really want to have a cgi script, set up their own personal
server and run the scripts there. However, for this to work, there
has to be a relatively painless way of running the scripts - as
painless as the shebang notation that can be used with UNIX.
--
Paul Chapin
pdchapin@unix.amherst.edu
Unix Systems Manager I'm too busy to have time
Amherst College for anything important.
413-542-2144
------------------------------
Date: Mon, 13 Oct 1997 16:09:56
From: sheaven@crossings.u-net.com (Steve Heaven)
Subject: Problems compiling perl under Solaris 2.5.1
Message-Id: <sheaven.380.00102AE4@crossings.u-net.com>
I have been trying to compile per l5.004_01 on a Solaris 2.5.1 machine with
Sun's C compiler. I get errors such as:
`sh cflags libperl.a util.o` util.c
CCCMD = cc -DPERL_CORE -c -O
"util.c", line 1111: va_start: argument mismatch
"util.c", line 1183: va_start: argument mismatch
"util.c", line 1240: va_start: argument mismatch
"util.c", line 1297: va_start: argument mismatch
and
`sh cflags libperl.a sv.o` sv.c
CCCMD = cc -DPERL_CORE -c -O
"sv.c", line 3507: va_start: argument mismatch
"sv.c", line 4132: va_start: argument mismatch
"sv.c", line 4154: va_start: argument mismatch
There is ifo in the README about varargs and gcc but I'm not using that
compiler.
I've checked around in config.h etc and seen that /user/include/varargs.h is
getting included.
Can anyone help
Thanks
Steve
------------------------------
Date: Mon, 13 Oct 1997 12:44:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Recursive pattern replacement - help
Message-Id: <hmmt16.1o1.ln@localhost>
Donna Smith CT90 (d1smith@gmr.com) wrote:
: I'm trying to search for and replace a pattern in a
: directory tree that is over 3GB (an entire web site).
: The pattern is in html and is very long but is the same in
: all of the files it appears in.
: <center><a href="/htbin/imagemap/toolbar... yada yada yada
: I'm trying a quick and dirty way, escaping all the appropriate characters
^^^^^^^^^^^
: with:
That's OK if you want to, but none of them _need_ to be escaped...
: perl -pi.bak -e 's/\<center\>\<a href\=\"\/htbin.../new string' `cat filelist`
perl -pi.bak -e 's#<center><a href="/htbin...#new string#'
: where filelist is a file containing a list of all the html
: files in this directory tree. This works fine on a short list but the system can't handle an input list of files this big and I get:
: Argument list too long
That is a message from the shell, not from perl.
Possible solutions:
1) Switch to a shell that does not have that limit, such as tcsh
2) use xargs
3) have perl read the filenames from the file itself, instead of having
the shell do it
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 13 Oct 1997 12:22:07 -0600
From: sartang@pcocd2.intel.com
To: sartang@pcocd2.intel.com
Subject: reg exp size limit !?
Message-Id: <876762888.948@dejanews.com>
is there a limit on how big a string can be used
for matching in a regular expression. I'm having
this difficulty with size of the string.
using something like this :
if ( /keyword (\(.+\))/ )
where .+ may be very very long. And perl
doesn't match it if it is long. Is there a
way to extend this limit if there is one.
It fails to match it if it's over 32786 characters.
thanks
saviz
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 13 Oct 1997 10:14:05 -0700
From: Saviz Artang - MPG ~ <sartang@pcocd2.intel.com>
Subject: reg exp size limit !?
Message-Id: <344256DD.167E@pcocd2.intel.com>
is there a limit on how big a string can be used
for matching in a regular expression. I'm having
this difficulty with size of the string.
using something like this :
if ( /keyword (\(.+\))/ )
where (.+) may be very very long. And perl
doesn't match it if it is long. Is there a
way to extend this limit if there is one.
------------------------------
Date: Mon, 13 Oct 1997 18:19:31 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: reg exp size limit !?
Message-Id: <344265e6.2134409@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 1997 10:14:05 -0700, Saviz Artang - MPG ~
<sartang@pcocd2.intel.com> wrote:
>is there a limit on how big a string can be used
>for matching in a regular expression. I'm having
>this difficulty with size of the string.
>
>using something like this :
>
>if ( /keyword (\(.+\))/ )
>
>where (.+) may be very very long.
Define "very very long" for us...
>And perl
>doesn't match it if it is long. Is there a
>way to extend this limit if there is one.
Are there embedded funky characters of any sort (like nulls or '\n')?
Is "very very long" so long that it could exhaust all the memory in
your computer? I'd hope not, but... you never know.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 13:29:34 -0500
From: Bryan Hart <bryan@eai.com>
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <3442688E.2781@eai.com>
Toutatis wrote:
>
> In article <344215A6.3805@shianet.org>, bwilcox@shianet.org wrote:
>
> > Could someone explain the difference between s/// and tr/// and when you
> > use one or the other?
>
> The return value:
> tr/// counts the substituted characters, s/// returns boolean (1 or 0).
>
> print "xxxxxx" =~ s/x/ /g; #prints '1'
> print "xxxxxx" =~ tr/x/ /; #prints '6'
>
> --
> Toutatis
Besides that, tr/// is strictly character substitution, where s/// can
replace multiple characters and can use regular expressions. tr/// is
generally faster where it's applicable, but s/// is more powerful.
Bryan
--
-------------------------------
| Bryan Hart
| Network Products Engineer
| Engineering Animation Inc.
| Phone: (515) 296-5979
| Fax: (515) 296-7025
| Email: bryan@eai.com
| Web: http://www.eai.com/
-------------------------------
"A conclusion is simply the place where you got tired of thinking"
------------------------------
Date: Mon, 13 Oct 1997 17:55:10 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <EI04Fy.Hvu@world.std.com>
Bob Wilcox <bwilcox@shianet.org> writes:
>Could someone explain the difference between s/// and tr/// and when you
>use one or the other?
s/// scans its argument for a sequence of characters (a string) and
once found replaces it with a differnet string. The sequence of
characters to find are expressed in the regular expression
language. (works on strings)
tr/// scans its argument for any single occurance of any of the
characters in the search list, and replaces them with their
counterparts in the replacement list. (works on characters.)
($result = "axbxc") =~ s/abc/def/; # find a followed by b followed by c
print "$result\n";
($result = "axbxc") =~ tr/abc/def/; # find a or b or c
print "$result\n";
($result = "abcdef") =~ s/abcd/ef/; # find string "abcd" and replace with "ef"
print "$result\n";
($result = "abcdef") =~ tr/abcd/ef/; # find any of a,b,c,d replace with e or f
print "$result\n";
--
Andrew Langmead
------------------------------
Date: Mon, 13 Oct 1997 11:04:46 -0700
From: Saviz Artang - MPG ~ <sartang@pcocd2.intel.com>
Subject: statics or const in perl ?
Message-Id: <344262BE.2781@pcocd2.intel.com>
Is there a way to make a variable in perl a const. As in
once it is set or when it is passed to a certain subroutine
the variable can't be modified. I'm looking at something like
this.
@array = ( "a", "b" ) ;
&mysub ( \@array ) ;
sub mysub {
my ( $arrayref ) = @_ ;
@$array[0] = "z" ;
}
as you can see I can change the value of array[0] but how
can i make it so arrayref is passed but read only and protected ?
So I can't make changes to it.
One way is ofcourse to copy it when passed but is there any
command I can use to restrict changes to a variable ?
thanks
saviz
------------------------------
Date: Mon, 13 Oct 1997 15:34:13 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Testing for file
Message-Id: <34423f6c.417781357@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 1997 06:59:12 -0700, John Grimm <jgrimm@wireedm.com>
wrote:
>How can I test to see if a file is there?
if -e $file
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 13:25:01 -0500
From: Bryan Hart <bryan@eai.com>
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <3442677D.167E@eai.com>
Sitaram Chamarty wrote:
>
> On 09 Oct 1997 19:54:02 +0200, Oliver Flimm <flimm@ph-cip.uni-koeln.de> wrote:
> >I got my panther book here in germany on 16.9. - and I like it a lot ;-)
>
> Err, umm, what is the panther book? Am I behind in my purchase of Perl books
> (from ORA only, I may add)? :-)
Yes you are :)
The panther book is "Advanced Perl Programming" (ISBN 1-56592-220-4) by
Sriram Srinivasan (ORA).
It's very good IMHO.
Bryan
--
-------------------------------
| Bryan Hart
| Network Products Engineer
| Engineering Animation Inc.
| Phone: (515) 296-5979
| Fax: (515) 296-7025
| Email: bryan@eai.com
| Web: http://www.eai.com/
-------------------------------
"A conclusion is simply the place where you got tired of thinking"
------------------------------
Date: Mon, 13 Oct 1997 17:19:31 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Warnings when testing undefined variables with perl -w
Message-Id: <34423C03.15FB@theo.phy.uni-bayreuth.de>
Hi,
Dan Sumption wrote:
>
> I am writing a script which, when run using perl -w, generates a
> number of warnings.
>
> All of the lines generating warning are ones where I am testing to see
> if a variable has a defined value, e.g.
> my $parent = undef;
> if ($parent = $self->{ALLITEMS}[$#{$self->{ALLITEMS}}]) {
> .... code here....
> }
>
> This generates the warning "Use of uninitialized value at....."
Not on my machine (running Perl 5.004_01) ... at least not with the
snippet of code posted above.
> Is there a standard workaround for this, or am I stuck with a screen
> full of warnings (or am I doing it all wrong?)
You are sure that you want a single '=' (assignment) in if's argument
and not '==' (comparison) ? If so, you should better say
if(defined($parent = ...)) {
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Mon, 13 Oct 1997 10:18:41 -0500
From: Arthur Darren Dunham <add@rice.edu>
Subject: Re: Why the ambiguity?
Message-Id: <34423BD1.4700@rice.edu>
brian d foy wrote:
>
> In article <343E967C.42A0@rice.edu>, Arthur Darren Dunham <add@rice.edu> wrote:
>
> >open (FILE, "+>>128_42_${sub}_0");
> >
> >Now I get a warning that ...
> >Ambiguous use of ${sub} resolved to $sub at ....
> >
> >I was assuming that I could always use ${var} within a
> >double-quoted string. Now I'm guessing that this is worrying
> >about some sort of referenced hash or anonymous hash that I might
> >be trying to define?? Maybe?
>
> remember that sub is a Perl keyword :)
Duhh... OK... :-) That helps.
--
Darren Dunham add@is.rice.edu
UNIX Sysadmin Rice University
(This line currently in revision) Houston, TX
Any resemblance between real opinions and my post is coincidental
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1169
**************************************