[8135] in Perl-Users-Digest
Perl-Users Digest, Issue: 1753 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 28 17:17:25 1998
Date: Wed, 28 Jan 98 14:00:29 -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 Wed, 28 Jan 1998 Volume: 8 Number: 1753
Today's topics:
[CGI] Re: Repost of question re how to write informati (Chip Salzenberg)
Re: Anyway to handle inconsistent perl locations in #! <sveerara@cisco.com>
Re: Anyway to handle inconsistent perl locations in #! (brian d foy)
Re: Anyway to handle inconsistent perl locations in #! (Greg Andrews)
Re: check URL <*@qz.to>
Re: Check Variable type (Jeff Stampes)
Re: Conversion to an array (Clay Irving)
Re: Conversion to an array <tchrist@mox.perl.com>
Creating a network share with Win32 nick@ciof.sbcc.net
Re: email address (brian d foy)
Re: email address <shimpei+this+address+is+NOT+munged+.mil+.gov@socrates.caltech.edu>
embedding ActiveState Perl questions <mjc@rodagroup.com_>
Re: FAQ too big (Was: Re: PERL forking) (Andrew M. Langmead)
Re: Find ^M in file (Richard Bellavance)
Re: Find ^M in file (brian d foy)
Re: globbing probs via www (brian d foy)
Re: Hello... another prob :( (Chip Salzenberg)
help needed with varaible in a pattern (Sylvain Juneau)
Re: hex -> int -> byte ??? (Martin Vorlaender)
Re: Looking for a really basic mailto/form script (Martin Vorlaender)
No MIME, please. This means you, Bill. (Chip Salzenberg)
Re: Perl ISAPI Build 315 for NT & Arguments (Chip Salzenberg)
Re: Perl script reading in HTML POST Form info (brian d foy)
Problem with typeglob (Gene Johannsen)
Re: Problem with typeglob (Chip Salzenberg)
Re: Problem With use <barnett@houston.Geco-Prakla.slb.com>
Re: Profiler for Perl4 (yup. Perl4) (Andrew M. Langmead)
Re: Question about answering (older) questions in c.l.p (brian d foy)
Re: regexes: fun with /x (brian d foy)
replacement for ls command? (Peter Chen)
Re: replacement for ls command? (Dan Greenblatt)
Re: Repost of question re how to write information to a (brian d foy)
Re: sed2perl conversion? (Matthew Cravit)
Re: sed2perl conversion? <barnett@houston.Geco-Prakla.slb.com>
Re: size limit to the length of a perl script (brian d foy)
Re: size limit to the length of a perl script <dballing@speedchoice.com>
Some very basic perl ?'s <pjmone@symbioticinc.com>
sorry, help needed with variable in a pattern (Sylvain Juneau)
Re: sorry, help needed with variable in a pattern (brian d foy)
Re: Survival Of perl (Chip Salzenberg)
Re: Survival Of perl <tchrist@mox.perl.com>
Web based perl script with SCCS commands <mwick@toy.mem.ti.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jan 1998 20:39:30 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: [CGI] Re: Repost of question re how to write information to a file.
Message-Id: <6ao55l$5cv$1@cyprus.atlantic.net>
According to "DianaH" <dhoober@interserv.com>:
>I have checked the resources mentioned in the message new postees receive
>and cannot identify an answer to the situation described below.
That's because you're in the wrong group. You need to go visit
comp.infosystems.www.authoring.cgi -- just down the hall, and turn
left at the sound of useless page counters.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: 28 Jan 1998 12:10:03 -0800
From: ranga <sveerara@cisco.com>
Subject: Re: Anyway to handle inconsistent perl locations in #! ?
Message-Id: <ls3yb00icmc.fsf@naan.cisco.com>
Hi,
I have seen this at the beginning of several scripts:
: # Use perl
eval 'exec perl -S $0 "$@"'
if 0;
I hear it is slower than #!/usr/bin/perl (or whatever)
HTH,
----ranga <sveerara@cisco.com>
------------------------------
Date: Wed, 28 Jan 1998 15:35:30 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Anyway to handle inconsistent perl locations in #! ?
Message-Id: <comdog-ya02408000R2801981535300001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34d5eeea.59309571@news.ncal.verio.com>, carroll@tjc.com (Terry Carroll) posted:
>For reasons known only to the sysadmin, perl is located at two different
>locations: /usr/bin/perl on one system, /usr/local/bin/perl on another.
>
>So, #!/usr/bin/perl works on the first, but not the second;
>#!/usr/local/bin/perl works on the second, but not the first.
ask for symlinks in to the real perl in /usr/bin. i normally have
many version sof perl installed at the same time, but /usr/bin/perl
always points to the current one.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 28 Jan 1998 20:30:54 GMT
From: gerg@shell. (Greg Andrews)
Subject: Re: Anyway to handle inconsistent perl locations in #! ?
Message-Id: <6ao4hu$b4g$4@news.ncal.verio.com>
carroll@tjc.com (Terry Carroll) writes:
>I have some perl programs that are resident on a filesystem mounted on two
>different systems.
>
>For reasons known only to the sysadmin, perl is located at two different
>locations: /usr/bin/perl on one system, /usr/local/bin/perl on another.
>
>So, #!/usr/bin/perl works on the first, but not the second;
>#!/usr/local/bin/perl works on the second, but not the first.
>
>I thought of creating a link in my home directory, and pointing to that,
>but the home directory is the same on both shells, too.
>
>To complicate things, I make the program available to users besides
>myself, so I couldn't just set an environmental variable in my .cshrc and
>use that.
>
Terry, just ask Al to set a symlink from /usr/local/bin/perl to
/usr/bin/perl on the Aimnet machines.
-Greg
------------------------------
Date: 28 Jan 1998 21:44:24 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: check URL
Message-Id: <qz$9801281633@qz.little-neck.ny.us>
Abigail <abigail@fnx.com> wrote:
> Tom Phoenix (rootbeer@teleport.com) wrote on 1611 September 1993 in
> ++ On 27 Jan 1998, Wei Weng wrote:
> ++ > Is there anyway to use perl to test a URL is valid or not?
> ++ Use the LWP module. Hope this helps!
> LWP will tell you if email addresses are valid?
Dunno, but the mailtools package could be helpful there. :^)
> Abigail
> --
> <URL:mailto:abigail@fnx.com> is also an URL.
And it being a well-formed URL, it meets my definition of "valid."
Elijah
------
knows better than assuming one can easily check for the usefulness of a URL
------------------------------
Date: 28 Jan 1998 20:10:35 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Check Variable type
Message-Id: <6ao3br$hak$1@neocad.com>
Real (real@earthling.net) wrote:
: Daniel Balderman <Daniel.Balderman@digital.com> wrote in article
: <34CC7D84.5B4@digital.com>...
: > I'm writing a WEB application where the user has to enter an integer.
: > How can I check the user input to see if the user has entered the
: > correct type (in this case integer).
: This is a Unix style of checking. There might be a shorter one but this
: will work.
: print "Number: "; $number = <STDIN>; chomp($number);
: $chknum = $number; $chknum =~ s/[0-9]//g;
: if ($chknum eq '') { print "Nummeric\n" } else { print "Alpha-nummeric\n";
: }
Ouch...Yup, that'll work, but as we all know, TMTOWTDI:
print "How many beers do you want? ";
my $input = <STDIN>;
chomp $input;
($input =~ m{\D}) ?
print "Not a number!\n" :
print "$input beers, coming right up!\n";
If it matches a non-digit, it's not an integer
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 28 Jan 1998 16:19:28 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Conversion to an array
Message-Id: <6ao7d0$hd6@panix.com>
In <6anu4r$nd2@shell.clark.net> hdiwan@shell.clark.net (Hasan Diwan) writes:
>Barring syntax errors, this foreach loop should do it:
>foreach <FileVar> s/\n/ { # breakup records
> $line = $_; # assign line to dummy var
> @item = split($line,/|/);
> @results = $item[2];
>}
Geez. No, no...
Open the file:
open DB, "/path/file.db" or die "Can't open database: $!\n";
Read each line:
while (<DB>) {
Remove the newline:
chomp;
Split on the | symbol and get the third element of the list:
$item = (split /\|/)[2];
End the while loop:
}
Close the file:
close DB;
Syntax counts!
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 28 Jan 1998 21:41:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Conversion to an array
Message-Id: <6ao8ms$oel$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
hdiwan@shell.clark.net (Hasan Diwan) writes:
:Barring syntax errors, this foreach loop should do it:
That's amazingly wrong.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
When in doubt, parenthesize. At the very least it will let some
poor schmuck bounce on the % key in vi.
--Larry Wall in the perl man page
------------------------------
Date: Wed, 28 Jan 1998 15:37:45 -0600
From: nick@ciof.sbcc.net
Subject: Creating a network share with Win32
Message-Id: <886022629.109248517@dejanews.com>
Hello,
I'm trying to start using Perl for Windows NT; I need to share a directory
on the network server. I have looked at the docos on the ActiveState site
but even the example doesn't work.
Any help, please??
Thanks,
Nick
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 28 Jan 1998 15:15:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: email address
Message-Id: <comdog-ya02408000R2801981515220001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CF3C3C.41C6@meta3.com>, Ken Holm <rets@meta3.com> posted:
>Following is a non-optimal function that returns true or false for an
>email passed to it. This certainly is not fool proof but works well
>enough to use:
> foreach $Section ($user, $domain) {
> @List = split(/\./, $Section);
> for (@List) {
> return (0) if $_ =~ /\W/;
> }
i guess you'll never be able to mail Elijah then. perhaps you
should read his email address FAQ, which i'm sure he'll tell you
about when he gets to this post :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 28 Jan 1998 20:58:09 GMT
From: Shimpei Yamashita <shimpei+this+address+is+NOT+munged+.mil+.gov@socrates.caltech.edu>
Subject: Re: email address
Message-Id: <6ao651$77e@gap.cco.caltech.edu>
Ken Holm <rets@meta3.com> writes:
>
>Following is a non-optimal function that returns true or false for an
>email passed to it. This certainly is not fool proof but works well
>enough to use:
>
>################
>sub emailCheck {
> my $Item = shift;
> $Item =~ s/^\s+|\s+$//g;
> my @List;
> return (0) unless $Item;
> my ($user, $domain) = split(/\@/, $Item);
> return (0) unless ($user && $domain);
> return (0) if ($domain !~ /\./);
> foreach $Section ($user, $domain) {
> @List = split(/\./, $Section);
> for (@List) {
> return (0) if $_ =~ /\W/;
> }
> }
> return(1);
>}
I take it you aren't going to accept businesses from rose-hulman.edu,
asahi-net.or.jp, and all other hosts that have hyphens in their
names....
--
Shimpei Yamashita <http://www.patnet.caltech.edu/%7Eshimpei/>
The address I have listed in the headers is a working address. It just
looks like it's an invalid address in order to fool spammers collecting
addresses from newsgroups.
------------------------------
Date: Wed, 28 Jan 1998 13:46:18 -0800
From: "Michael Callahan" <mjc@rodagroup.com_>
Subject: embedding ActiveState Perl questions
Message-Id: <6ao92k$eqn$1@nntp2.ba.best.com>
I have some questions about using Perl as an embedded interpreter
on Win32. In particular, I'm using the ActiveState port.
I'd like to build an MFC application that uses Perl to parse web pages,
and to complicate things I want to have multiple web pages being
downloaded asynchronously while other user interface things are going
on.
The best solution for me would be if I could create a pool of worker
threads, each of which would create a Perl interpreter. I assume that
a given interpreter instance cannot be used by multiple threads
simultaneously, but I'm hoping that it's OK to have separate interpreters
in use simultaneously by separate threads, assuming I compile the Perl
DLL with -DMULTIPLICITY. (I.e., I want to do what Microsoft calls
"Apartment model" threading with my Perl interpreters.)
So question 1 is, is this likely to work?
Question 2: to do this, should I expect to instantiate multiple IPerlSupport
instances (I've been using a slightly hacked version of CPerlExe), or
should I modify CPerlExe so that it can support multiple CPerl interpreters
(and introduce appropriate interlocks on CPerlExe's member variables)?
Question 3 has to do with an apparent hack in CPerlExe, there to overcome
a Win95 bug (according to the source).
The method CPerlExe::OpenOSfhandle() uses apparently
undocumented routines _alloc_osfhnd() and _set_osfhnd(), and an
undocumented global __pioinfo, to fiddle with the C runtime's file
descriptor emulation table. Unforunately, these symbols seem not
to be exported by the DLL version of the C runtime. That's no problem
for Perl.exe, which is linked with the static single-threaded C runtime,
but for me it's not very attractive, since I'd like to use the DLL
versions of the C runtime and MFC.
So, question 3: can I overcome this apparent Win95 bug (what is it?)
and still link to the multithreaded C runtime DLL?
Thanks in advance!
Michael
---
Michael Callahan
mjc@rodagroup.com
(address in From: line has obvious erroneous character to discourage
address trawling)
------------------------------
Date: Wed, 28 Jan 1998 21:40:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <EnIK7z.J3@world.std.com>
bart.mediamind@tornado.be (Bart Lateur) writes:
>aml@world.std.com (Andrew M. Langmead) wrote:
>>Are you saying that many Windows users don't realize that there is any
>>way to search through text?
>Sortof. Make that "search though multiple text files".
OK, so many Windows users don't realize that they either have (the
"FIND" command line tool or the "Find" on the Start menu.) or can
download ("grep" or some sort of text searching tool), buy, or create
for themselves (in a half dozen lines of perl) a program to search
through multiple text files. (and no one has though that this is an
incredible marketing opportunity for someone who would line to make
and sell such a tool.)
Forget about the idea that they could simply concatenate all the FAQ
pieces together hand have one file that they could search with their
text editor.
And these people would rather post to Usenet to find their answers
rather than do _anything_ to get themselves out of this situation?
Then can someone remind my why I spend my time here?
--
Andrew Langmead
------------------------------
Date: 28 Jan 1998 15:05:19 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: Find ^M in file
Message-Id: <6ao31v$t60@stratus.CAM.ORG>
In article <34CF80FE.79F7@daytonoh.ncr.com>,
Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com> wrote:
>I have a file with "^M" in some records.
>I think the ^M is a hex 0d
Yes, it is (in ASCII, at least...)
>
>I am trying to drop the ^M and write out "".
>
Fair enough.
>I open the file in binmode and read it 1 byte at a time looking for a
>double quote.
>
>When I find it I start looking for another double quote or a hex 0d.
>
>I am doing the following to determine if the byte is a hex 0d
>
>$stat = read FILE, $byte, 1;
>$wrk = sprint "%x",ord($byte);
>if ($wrk == 13)
>{
> xxxxx
>}
>
>I never get to the xxxx line.
>
>Can anyone tell me why ????
>
Sure. Assuming you meant sprintf in the code above, $wrk will contain the
*string* representing the hex value of the byte you read (i.e. "0d" in the
case you want). Then, you try to compare the *numeric* value of that
string (that's what "==" does) with 13. Now, the numeric value of "0d" is
0, so it's not equal to 13, ever. To do it "your way", drop the sprintf
and use "if(ord($byte) == 13)" as your test.
But There's More Than One Way To Do It, and here's a more Perlish way
of doing what you want:
while(<INPUT_FILE>) {
s/"\r"/""/g;
write_the_modifed_line_wherever_it's_supposed_to_go
}
Hope this helps,
Richard.
--
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: Wed, 28 Jan 1998 15:03:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Find ^M in file
Message-Id: <comdog-ya02408000R2801981503510001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CF80FE.79F7@daytonoh.ncr.com>, Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com> posted:
>I have a file with "^M" in some records.
>I think the ^M is a hex 0d
>
>I am trying to drop the ^M and write out "".
$data =~ s/ \c M //xg;
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 15:24:59 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: globbing probs via www
Message-Id: <comdog-ya02408000R2801981524590001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6anp3h$263$1@nz12.rz.uni-karlsruhe.de>, udta@rzstud1.rz.uni-karlsruhe.de (who) posted:
>the following code works fine....
>@a = <*>;
>via telnet .....but if i call the code via www (maybe within a html-page)
>i get no output (@a is empty)..
>does someone know, what4s wrong ?
sounds like the standard problem of running the script in a
different environment.
perhaps you would prefer to use opendir() and friends or a module.
don't forget about turning on taint checking and using absolute paths.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 20:44:58 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Hello... another prob :(
Message-Id: <6ao5fo$5e4$1@cyprus.atlantic.net>
According to "diogo" <np59re@mail.telepac.pt>:
>But, nothing works. I downloaded perl for Win NT again. And nothing works.
>My www directory is in c:\inetpub\wwwroot.
Apparently you want comp.infosystems.www.servers.misc. Just down the
hall, turn right at the sound of Monopoly being played with real money.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: Wed, 28 Jan 1998 20:42:33 GMT
From: sjuneau@microtec.net (Sylvain Juneau)
Subject: help needed with varaible in a pattern
Message-Id: <34d29565.24052618@news.cmc.ec.gc.ca>
I need help,
The following script:
open a file client_conf_file and retreive some names.
save those names in an array.
for each names in that array
it saves the whole line containing this name in a file called prodfile
The patytern matching does not work. if(/^$d/)
how do I get to use a variable in a pattern?
Thank you so much
@client_prod_list=();
open(CLIENTCONF, "client_conf_file")|| die "Can't open:$!\n";
while(<CLIENTCONF>)
{
next if(/^#/);
push @client_prod_list, /(\w+)\./;
push @client_prod_list1, /\.(\w+)/;
}
close CLIENTCONF;
#
# open cislist and retrieve file that matches
#
$count1=@client_prod_list;
for($b=0;$b<=$count1;$b++)
{
open(PRODUCTFILE, ">> /usr/cmis/cmisx/prodfile") || die "Can't
open:$!\n";
$d="$client_prod_list[$b]";
@ARGV="/users/operator/cislist";
while (<>)
{
if(/^$d/)
{
print PRODUCTFILE;
}
}
}
Sylvain
e-mail sjuneau@microtec.net
------------------------------
Date: Wed, 28 Jan 1998 20:32:17 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: hex -> int -> byte ???
Message-Id: <34cf87c1.524144494f47414741@radiogaga.harz.de>
patrik lundin (f95-plu@nada.kth.se) wrote:
: My question is, if I have a string with hexadecimal values ( 0 - 255 )
: separated with "-" like this : "-0D-0A-FF-EF-09" ... etc
: How can I convert the hexnumbers to byte's and then write them to
: a binary file.
If you remove that leading '-' from the string:
$hexnumbers = '0D-0A-FF-EF-09';
@hexbytes = split /-/, $hexnumbers;
$bytes = pack 'H2' x @hexbytes, @hexbytes;
print BINARY_FILE $bytes;
If your perl machine weren't Unix, you'd have to binmode BINARY_FILE first.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Wed, 28 Jan 1998 20:46:48 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Looking for a really basic mailto/form script
Message-Id: <34cf8b28.524144494f47414741@radiogaga.harz.de>
Robert Tobin (chamber@gsat.edu.au) wrote:
: I am looking for a basic form/mailto script
: can anyone help?
Perhaps the people who discuss CGI scripts?
comp.infosystems.www.authoring.cgi - right down the hall, turn left at the
routers aching under the load of forwarding all-form, no-content.
(Regards to Chipmunk - I like your style)
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Wed, 28 Jan 1998 20:42:38 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: No MIME, please. This means you, Bill.
Message-Id: <6ao5bh$5dg$1@cyprus.atlantic.net>
According to bill@astro.fccj.cc.fl.us:
>This is a multi-part message in MIME format.
>--------------4870D71F39E7369E7AB897B8
We don't need this.
>--------------4870D71F39E7369E7AB897B8
>Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
We DEFINITELY don't need this.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: Wed, 28 Jan 1998 21:03:31 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Perl ISAPI Build 315 for NT & Arguments
Message-Id: <6ao6ij$5h1$1@cyprus.atlantic.net>
According to john_helt@hp.com:
>I am trying to use perl ISAPI & perl for win32 as to process CGI
>information with IIS3.0.
>But, for some reason, arguments are not being passed through.
Sounds like you need comp.infosystems.www.authoring.cgi, just down
the hall, turn left at the sound of standards screaming in agony.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: Wed, 28 Jan 1998 15:22:31 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl script reading in HTML POST Form info
Message-Id: <comdog-ya02408000R2801981522310001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CF403E.244D01E6@houston.Geco-Prakla.slb.com>, Dave Barnett <barnett@houston.Geco-Prakla.slb.com> posted:
>Go to http://www.perl.com and follow the CPAN link.
>
>Look for CGI.pm. It makes the entire process rather painless, and the
>documentation in the module is sufficient to get started using it right
>away.
if they don't already have CGI.pm, they should be looking for
latest.tar.gz
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
it comes standard
------------------------------
Date: 28 Jan 1998 20:57:29 GMT
From: gej@spamalot.mfg.sgi.com (Gene Johannsen)
Subject: Problem with typeglob
Message-Id: <6ao63p$8n593@fido.asd.sgi.com>
Hey:
I have this bit of code in my program:
use strict;
.
.
.
my @states = ('names', 'header', 'footer', 'general', 'special', 'schedules');
my %abstates = ();
&abbrev(*abstates, @states); # Create abbreviations of state names
But when I run it I get the warning:
Name "main::abstates" used only once: possible typo at ./mksked line 230 (#1)
(W) Typographical errors often show up as unique variable names.
If you had a good reason for having a unique name, then just mention
it again somehow to suppress the message. The use vars pragma is
provided for just this purpose.
How do I use a typeglob in this case without getting the Typographical
error warning and without using `use vars (..)`?
Thanks.
gene
------------------------------
Date: Wed, 28 Jan 1998 21:39:59 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Problem with typeglob
Message-Id: <6ao8n2$5k9$1@cyprus.atlantic.net>
According to gej@spamalot.mfg.sgi.com (Gene Johannsen):
>my @states = ('names', 'header', 'footer', 'general', 'special', 'schedules');
>my %abstates = ();
>&abbrev(*abstates, @states); # Create abbreviations of state names
Globs are symbol table entries. Lexical (my) variables don't live in
symbol tables. Ergo, you can't use a glob to pass a lexical.
I suggest you read "perlref" and then use this:
&abbrev(\%abstates, @states)
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: Wed, 28 Jan 1998 14:21:23 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Problem With use
Message-Id: <34CF9343.A2A5D0DB@houston.Geco-Prakla.slb.com>
Robert Sample wrote:
<snip>
> The problem is this message:
> Can't locate Win32/Registry.pm in @INC at LotusReg.pl line 3.
> BEGIN failed--compilation aborted at LotusReg.pl line 3.
>
> or for the first script:
>
> Can't locate Cwd.pm in @INC at TestModule.pl line 3.
> BEGIN failed--compilation aborted at TestModule.pl line 3.
>
> I have \Perl5\Lib on my path as well as \Perl5. Is there something I am
> missing here?
>
> TIA...Robert
To determine what your current @INC variable includes, you can do this:
for (@INC) {
print $_, "\n";
}
That will print out, one per line, each directory that Perl searches for
included modules. This is NOT the same as your regular PATH variable.
If the directories you mention are not included, then Perl cannot find
them. You have several options (as always TMTOWTDI):
1. use lib "/path/to/the/libraries";
2. set an environment variable "PERL5LIB" that is a ":" seperated list
of directories to search.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 28 Jan 1998 21:47:17 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Profiler for Perl4 (yup. Perl4)
Message-Id: <EnIKIu.4s3@world.std.com>
bren@fangorn.cs.monash.edu.au (Brendan Macmillan) writes:
>Tom Phoenix (rootbeer@teleport.com) wrote:
>: It's called "perl5". Install that, and you'll get a lot more than a
>: profiler. Or do you still use whale oil in your lamps? :-)
>Ah, the ever-so-helpful responses to perl4 questions from the perl5
>community.
Just try to call up Microsoft and get support for Microsoft C version
5.0.
Look at it this way. It seems that they very knowledgeable perl users
that respond to questions around here have all stopped using perl
4. So they choice is for someone to say "If you use perl 5, I might be
able to help." Or someone can wait for a user developing in perl 4
(and has the answer) comes around.
--
Andrew Langmead
------------------------------
Date: Wed, 28 Jan 1998 15:13:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Question about answering (older) questions in c.l.p.*
Message-Id: <comdog-ya02408000R2801981513240001@news.panix.com>
Keywords: from just another new york perl hacker
In article <linberg-2801981110400001@projdirc.literacy.upenn.edu>, linberg@literacy.upenn.edu (Steve Linberg) posted:
>Occasionally, though, I have a question I can't find an answer to
>anywhere, and I have to crack it the old-fashioned way - by hammering on
>it and experimenting. Sometimes I get one.
one would have an easier time learning if one tried this
approach. one learns a lot more through this process than just
the task at hand :)
>It occurred to me, however, that there is not a clear avenue to sharing
>this information. I'm sure other people will have this problem down the
>road -- maybe people have it right now and are just giving up after their
>dejanews searches yield no answers. I could post a general announcement
>in one of the groups, but that would strike me as clutter. Why answer a
>question no-one's asking?
i don't see why usenet has to be a question and answer forum. if you
have something that you want to share, compose a post, give it a
good subject line, then post it!
if you are posting good stuff, other people will read it and hopefully
discuss it. it would be an oasis in the middle of the desert of FAQs and
CGI questions (and lately the "I need a script to do this...") posts.
let me add you to the auto-select list... :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 15:02:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: regexes: fun with /x
Message-Id: <comdog-ya02408000R2801981502040001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CECDAD.7714FC60@coos.dartmouth.edu>, rjk@coos.dartmouth.edu posted:
>Can you find a useful regex that will only work with the /x modifier?
that depends on your definition of useful. i like to be able to
do things like
#!/usr/bin/perl -w
$\="\n";
$_ = 'just another perl hacker';
$regex = <<'HERE';
just\ another\
#new\ york\
perl\ hacker
HERE
print $_ if $_ =~ m/$regex/x;
which only works with the /x modifier. :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 28 Jan 1998 20:18:35 GMT
From: peter@lucent.com (Peter Chen)
Subject: replacement for ls command?
Message-Id: <6ao3qr$dn1@nntpa.cb.lucent.com>
Is there an equivalent way of doing a Unix ls command? For example,
@found=`ls abc*/def*/some*.txt`;
Without resorting to ``, or system, of course.
--
Peter Chen G__ Work to live.
,>/- Live to bike.
630-979-4679 O \O Bike to work.
------------------------------
Date: Wed, 28 Jan 1998 13:49:03 -0800
From: danielg@ea.com (Dan Greenblatt)
Subject: Re: replacement for ls command?
Message-Id: <danielg-ya02408000R2801981349030001@newshost.ea.com>
In article <6ao3qr$dn1@nntpa.cb.lucent.com>, peter@lucent.com (Peter Chen)
wrote:
> Is there an equivalent way of doing a Unix ls command? For example,
> @found=`ls abc*/def*/some*.txt`;
>
> Without resorting to ``, or system, of course.
Look up the 'readdir' function in your friendly neighborhood Camel book.
If you only want certain files a la your example, look up 'grep' while
you're in there.
Hope this helps.
> --
> Peter Chen G__ Work to live.
> ,>/- Live to bike.
> 630-979-4679 O \O Bike to work.
--
Dan Greenblatt danielg@ea.com
Lord of the Snow Monkeys Electronic Arts
These are MY opinions, not my employer's. Capiche?
------------------------------
Date: Wed, 28 Jan 1998 15:30:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Repost of question re how to write information to a file.
Message-Id: <comdog-ya02408000R2801981530340001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6aiqrb$spi$1@lal.interserv.com>, "DianaH" <dhoober@interserv.com> posted:
>I have checked the resources mentioned in the message new postees receive
>and cannot identify an answer to the situation described below. If this is
>to advanced a question for this posting area, please let me know.
i don't think anything could be too advanced now that Chip seems to be
hanging out here...
>I am new to perl scripting but have been creating internal pages using html,
>perl and cgi scripts for about 5 months now so I do understand a little. I
>have a project which requires placing information from an internal web page
>into another web page. Normally, to place information in the destination
>page it is necessary to login in using passwords and identification, then a
>form is filled out and the information is placed on the external web page.
does this mean that you are using some sort of web browser and
interacting with a CGI script? or are you interacting with some
GUI thingy from the server?
>Both pages are on the same server. Is this an instance where the open
>command would be used to pass info and if so, is it necessary to write any
>sort of subroutine to take care of the password entry to the destination
>page?
open() would be useful.
it sounds as if the username/password stuff is already done. this
sort of thing might be handled by the server which means your script
doesn't have to worry about it. however, that is a server/CGI
issue best discussed elsewhere.
was there a perl question in there somewhere?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 28 Jan 1998 11:50:28 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: sed2perl conversion?
Message-Id: <6ao264$jdh$1@shell3.ba.best.com>
In article <6antov$aca$1@uni00nw.unity.ncsu.edu>,
John Davidson Highfill <nNature_Boy@earthling.net> wrote:
>Hi, i am trying to learn perl and know a bit about sed (more than i
>know about perl) and heard that there is a sed2perl sc utility out
Yes, there is. It's called s2p and it comes with Perl. However, you'll
want to be aware of the following considerations in using it (from the
man page):
The perl script produced looks very sed-ish, and there may very well
be better ways to express what you want to do in perl. For instance,
s2p does not make any use of the split operator, but you might want
to.
The perl script you end up with may be either faster or slower than
the original sed script. If you're only interested in speed you'll
just have to try it both ways. Of course, if you want to do something
sed doesn't do, you have no choice. It's often possible to speed up
the perl script by various methods, such as deleting all references to
$\ and chop.
So, it's a good way to port a sed script to perl (under some circumstances)
but it's probably not a good way to learn Perl. The best way I know of to
do the latter is to get your hands on a copy of the "llama" book, which is:
Learning Perl, 2nd Edition
By Randal L. Schwartz & Tom Christiansen Foreword by Larry Wall
O'Reilly & Associates, 2nd Edition July 1997
ISBN: 1-56592-284-0
302 pages, $29.95
Make sure you get the second edition rather than the first.
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Wed, 28 Jan 1998 14:24:59 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: sed2perl conversion?
Message-Id: <34CF941B.8569029C@houston.Geco-Prakla.slb.com>
John Davidson Highfill wrote:
>
> Hi, i am trying to learn perl and know a bit about sed (more than i
> know about perl) and heard that there is a sed2perl sc utility out
There is one, and it comes with the std distribution. Look up "s2p".
It should be in the same directory as your perl executable.
> there but i have had little sucess finding it. anyone out know wher
> i can find it?
>
> thanks.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 28 Jan 1998 15:06:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: size limit to the length of a perl script
Message-Id: <comdog-ya02408000R2801981506250001@news.panix.com>
Keywords: from just another new york perl hacker
In article <886009786.1510866945@dejanews.com>, cotal@delphi.com posted:
>Is there a size limit to the length of a perl script running as a cgi?
>
>My script is about 1500 lines, across 3 different files.
>
>It fails to run if I add another line or another subroutine.
i have CGI scripts as long as 12k lines (or even more since i didn't
count the lines from included modules and such).
perhaps there is a problem with your server or another part of the
set-up. however, these issues are best discussed elsewhere.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 15:32:58 -0600
From: Derek Balling <dballing@speedchoice.com>
Subject: Re: size limit to the length of a perl script
Message-Id: <291467512F41E07F.A581DB73269AE6CD.6BF9585590399A93@library-proxy.airnews.net>
brian d foy wrote:
>
> In article <886009786.1510866945@dejanews.com>, cotal@delphi.com posted:
>
> >Is there a size limit to the length of a perl script running as a cgi?
> >
> >My script is about 1500 lines, across 3 different files.
> >
> >It fails to run if I add another line or another subroutine.
>
> i have CGI scripts as long as 12k lines (or even more since i didn't
> count the lines from included modules and such).
>
> perhaps there is a problem with your server or another part of the
> set-up. however, these issues are best discussed elsewhere.
It could also be something as simple as a memory-quota usage thing,
where his OS/kernel/whatever is limiting what resources he can allocate,
and "that little bit" puts him over-budget.
Unlikely, but possible.
d
------------------------------
Date: Wed, 28 Jan 1998 16:44:41 -0500
From: Paul Mone <pjmone@symbioticinc.com>
Subject: Some very basic perl ?'s
Message-Id: <6ao8u7$phb@bgtnsc03.worldnet.att.net>
I've moved on from Javascript to Perl to try to have a little cgi
program to password protect certain areas of my web page. When I
attempt to run the script I get an Internal Server error, and in my
error_log it says "premature end of script headers"...Any ideas?
Also, is there anyway to use any sort of bitwise operators (AND, OR,
XOR) in Perl? thanks for your help,
Paul
------------------------------
Date: Wed, 28 Jan 1998 20:44:17 GMT
From: sjuneau@microtec.net (Sylvain Juneau)
Subject: sorry, help needed with variable in a pattern
Message-Id: <34d397f7.24710450@news.cmc.ec.gc.ca>
I need help,
The following script:
open a file client_conf_file and retreive some names.
save those names in an array.
for each names in that array
it saves the whole line containing this name in a file called prodfile
The patytern matching does not work. if(/^$d/)
how do I get to use a variable in a pattern?
Thank you so much
@client_prod_list=();
open(CLIENTCONF, "client_conf_file")|| die "Can't open:$!\n";
while(<CLIENTCONF>)
{
next if(/^#/);
push @client_prod_list, /(\w+)\./;
push @client_prod_list1, /\.(\w+)/;
}
close CLIENTCONF;
#
# open cislist and retrieve file that matches
#
$count1=@client_prod_list;
for($b=0;$b<=$count1;$b++)
{
open(PRODUCTFILE, ">> /usr/cmis/cmisx/prodfile") || die "Can't
open:$!\n";
$d="$client_prod_list[$b]";
@ARGV="/users/operator/cislist";
while (<>)
{
if(/^$d/)
{
print PRODUCTFILE;
}
}
}
Sylvain
e-mail sjuneau@microtec.net
------------------------------
Date: Wed, 28 Jan 1998 17:00:49 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: sorry, help needed with variable in a pattern
Message-Id: <comdog-ya02408000R2801981700490001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34d397f7.24710450@news.cmc.ec.gc.ca>, sjuneau@microtec.net (Sylvain Juneau) posted:
>The patytern matching does not work. if(/^$d/)
>
>how do I get to use a variable in a pattern?
depends on what you are trying to do. the variable is interploted
and the result is used as the regular expression. this means that
regex meta-characters in the variable's value act like regex
metacharacters.
for instance, let's suppose
$string = 'apples + oranges'; # + is a regex metacharacter
and that we want it to match itself
print "Match\n" if $string =~ m/$string/;
however, the match fails. the '+' in the string was translated
to mean "one or more of thingy that preceeded me" in the regex.
this sort of thing can be useful, but you have to be careful and
know what you are doing to make it work.
if you want to match the literal text of the string in some
portion of the target, you can escape the string so that meta
characters lose their meaning. there are a couple of ways to
do this:
* escape the metacharacters before the regex
$string = quotemeta($string);
* escape meta characters in the regex with \Q and \E
$string =~ m/\Q$string\E/;
and, since you wanted to match thingys at the beginning of the
string, you could do interesting things with substr() and
string comparison:
#!/usr/bin/perl
$nypm = 'just another new york perl hacker';
$look_for = 'just another';
print "Found!\n"
if $look_for eq substr($nypm, 0, length($look_for) );
__END__
(i guess this works anywhere is you let the OFFSET vary as well).
good luck :)
--
brian d foy <comdog@computerdog.com>
wonders about another modifier - m//q
------------------------------
Date: Wed, 28 Jan 1998 20:56:30 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Survival Of perl
Message-Id: <6ao64i$5g4$1@cyprus.atlantic.net>
According to Dave Barnett <barnett@houston.Geco-Prakla.slb.com>:
>The FAQ is a good source of information, but I find it cumbersome to find
>information in. Do I use perldoc -f function? Do I use perldoc module
>name? Which one of the 9 perlfaq's should I start with?
Does "grep" ring a bell?
>Maybe this is just me
It _is_ you. Sadly, it is not _just_ you.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
Like Perl? Want to help out? The Perl Institute: www.perl.org
-> Ask me about Perl training and consulting <-
"It's the lemon zester of death!!" // MST3K
------------------------------
Date: 28 Jan 1998 20:57:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Survival Of perl
Message-Id: <6ao64h$m4a$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Dave Barnett <barnett@houston.Geco-Prakla.slb.com> writes:
:Do I use perldoc -f function? Do I use perldoc module name? Which one
:of the 9 perlfaq's should I start with?
prompt$ agrep -1i 'stuff here' /usr/src/perl/pod/*.pod
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
That's gonna be tough for Randal to beat... :-)
--Larry Wall in <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Wed, 28 Jan 1998 15:31:37 -0600
From: "M. Wick" <mwick@toy.mem.ti.com>
Subject: Web based perl script with SCCS commands
Message-Id: <34CFA3B8.3E393596@toy.mem.ti.com>
I was just wondering if anyone knew of any scripts that might help. I'm
looking for a script, preferably perl, that can check files in and out
using the Unix SCCS command, and is used on the web (ie CGI program).
Any possible suggestions or any help would be appreciated.
Thanks in advance.
M. Wick
------------------------------
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 1753
**************************************