[9199] in Perl-Users-Digest
Perl-Users Digest, Issue: 2818 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 5 14:17:47 1998
Date: Fri, 5 Jun 98 11:00:50 -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 Fri, 5 Jun 1998 Volume: 8 Number: 2818
Today's topics:
Re: blat error message (Bob Trieger)
Re: blat error message (Jonathan Stowe)
Re: bug? comments inside regex can't have '/' (brian d foy)
compiled binary for Wais.pm or something similar for NT <mewilcox@unt.edu>
Re: decimal arithmetic <rootbeer@teleport.com>
Re: Foreach Efficiency <p-fein@uchicago.edu>
Re: Foreach Efficiency <p-fein@uchicago.edu>
Re: HTML to PERL translation Conversion (Jonathan Stowe)
Re: I'm having problems: <Dave.Cross@gb.swissbank.com>
Re: I'm having problems: <jdporter@min.net>
Re: I'm having problems: <mana@technologist.com>
Re: I'm having problems: <jdporter@min.net>
Invoking perl debugger dthanair@my-dejanews.com
Mapped Network problems with Perl dthanair@my-dejanews.com
Re: Mapped Network problems with Perl (Jonathan Stowe)
Re: newbie: trying to remove unwanted data from an arra (Tom Rokicki)
Not even an RFD (yet)... comp.lang.perl.(newbie|questio <cmcurtin@interhack.net>
Re: Not even an RFD (yet)... comp.lang.perl.(newbie|que (Michael J Gebis)
Re: Not even an RFD (yet)... comp.lang.perl.(newbie|que <jdporter@min.net>
Re: Not even an RFD (yet)... comp.lang.perl.(newbie|que (Mark-Jason Dominus)
Re: pattern match <jdporter@min.net>
perl cgi generated html with java app dont run Eadmund@writeme.com
perl equivalent to C's local static var? (James Lawrence)
Re: perl equivalent to C's local static var? (Matt Knecht)
Re: perl equivalent to C's local static var? <tchrist@mox.perl.com>
Re: perl equivalent to C's local static var? <tchrist@mox.perl.com>
Re: Perl Intepreter for Solaris (Stefan Berglund)
Re: Perl Intepreter for Solaris <cmcurtin@interhack.net>
Re: Q: apply func to mutate list; oneliner <jdporter@min.net>
Re: Q: dispatch find/replace string <jdporter@min.net>
Re: Q: dispatch find/replace string (Larry Rosler)
reading param values <vgopinat@cisco.com>
Re: Regular Expressions <rootbeer@teleport.com>
Re: Why is there no "in" operator in Perl? <tkil@scrye.com>
Re: Why is there no "in" operator in Perl? <jdporter@min.net>
Re: Win32::NetResource Module (Jeffrey R. Drumm)
Re: Win32::NetResource Module (Jonathan Stowe)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 05 Jun 1998 16:13:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: blat error message
Message-Id: <6l95i1$487$1@ligarius.ultra.net>
[ posted and mailed ]
"BBQ" <warp@internetcom.com.br> wrote:
-> On a side note, there is a comercial version of Sendmail for NT, which can
-> be found at http://www.demobuilder.com/sendmail.htm
->
-> Although Blat is freeware, it does help if you are writting your stuff on NT
-> and then deploying it on UNIX servers. This way, all you have to do is
-> change your $mail_prog when switching OSes.
Not true. There is a lot more to change in a script written to use Blat in
order to get in to work on a Unix or MAC server. There are different operators
and switches which also must be set.
The easiest way to make a mail script portable is to use Net::SMTP. All you
have to change then is the smtp server name and if you are using the same
server, you may not have to change a thing.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: Fri, 05 Jun 1998 17:09:36 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: blat error message
Message-Id: <357821a4.112054964@news.btinternet.com>
On Fri, 05 Jun 1998 16:13:20 GMT, Bob Trieger wrote :
>
>The easiest way to make a mail script portable is to use Net::SMTP. All you
>have to change then is the smtp server name and if you are using the same
>server, you may not have to change a thing.
>
<A well know thread exploder - nice one Bob>
I think a quick sweepstake on this might be in order right now:
I say 38.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Fri, 05 Jun 1998 13:47:53 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: bug? comments inside regex can't have '/'
Message-Id: <comdog-ya02408000R0506981347530001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35780AB2.F3B03C1E@email.unc.edu>, Xuming Wang <xuming@email.unc.edu> posted:
>I found I can't have '/' (or whatever character used for m//, s///) in the
>comments:
>
>$foo =~ /a # a test /
> test/x;
>
>or
>
>$foo =~ m{a # test }
> test}x;
>
>gives compilation error:
perl needs to be able to parse it before it can figure out you wanted
the x modifier. since "m{a # test }" is valid, how would perl
know that you didn't want that? :)
it's a feature. you can, however, use an alternate delimiter that
won't show up in the comments. Eli might suggest a control
character delimiter, but then again i'm thinking he probably has
control characters in his comments too :)
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
didn't talk to Eli at all last night. sorry...
------------------------------
Date: Fri, 05 Jun 1998 11:55:19 -0500
From: Mark Wilcox <mewilcox@unt.edu>
Subject: compiled binary for Wais.pm or something similar for NT?
Message-Id: <357822F6.56D2B1B5@unt.edu>
Hi,
Our gov-docs library needs to move their WAIS gateway from a LINUX box
to Windows NT (here it's a political move, not a technical reason).
Anyway I'm stuck on moving the gateway. All of the modules it requires
comes with the standard Perl for Win32 except for the Wais.pm modules.
This wouldn't be a problem except that they have alot of XS & C in them.
I don't have access to a Windows C compiler, nor would I really have an
idea on how to make it work if I even did (I learned C on old DOS and in
UNIX & I currently only speak Perl & JAVA :-)). Nor am I too familiar
with the Win32 port.
If anyone has any ideas or pointers, I would greatly appreciate it.
You'll also be helping many others because many libraries are getting
Windows NT now over UNIX (in a large part thanks to philanthropic Bill)
& would like to offer this gateway too.
thanks in adavance.
Mark
--
--------------------------------------------
Mark Wilcox
mewilcox@unt.edu
Web Administrator
University of North Texas
(940)565-2568
http://www.unt.edu/
------------------------------
Date: Fri, 05 Jun 1998 15:32:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: decimal arithmetic
Message-Id: <Pine.GSO.3.96.980605082924.29617e-100000@user2.teleport.com>
On Thu, 4 Jun 1998, Larry Rosler wrote:
> Why does it??
Why does eval (of a string) affect the value you see? It's because it
turns your number into a string. Then, you're turning it back into a
number to test it.
Exactly how a certain value is turned into a string and back again is
notoriously undependable. (Normally, Perl doesn't even do this itself,
but calls a system-level routine to do it.) In some cases, the results
aren't consistent even within a single program!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 Jun 1998 03:42:40 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Foreach Efficiency
Message-Id: <87bts8sedr.fsf@bj2-64.rh.uchicago.edu>
lr@hpl.hp.com (Larry Rosler) writes:
> Hehehe. I complimented John Porter by private email on his cool
> response, withdrew my response, and wondered whether and how *you* would
> respond.
>
> So I'll spoonfeed you (not necessarily good pedagogy):
Well, thanks. Nobody's done that since my mother. Don't you feel
special now?
Yes, I did read the Camel & perldoc. Obviously it didn't click.
Forgive me.
> What would make you think the sort (the generation of the list value
> that the foreach loop iterates over) would be done more than once?
I don't know.
--
Peter Fein 773-834-6206
1005 E. 60th St. Chicago, IL 60637
p-fein@uchicago.edu http://pfein.home.ml.org/
------------------------------
Date: Fri, 5 Jun 1998 17:22:54 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Foreach Efficiency
Message-Id: <8790nbsqz5.fsf@bj2-64.rh.uchicago.edu>
John Porter <jdporter@min.net> writes:
> Peter A Fein wrote:
> >
> > John Porter <jdporter@min.net> writes:
> > > Why don't you test your hypothesis using Benchmark?
> >
> > Well, because I have finals in a few days and I need to get this
> > working yesterday. Although I'd like to mess around & benchmark parts
> > of my code at some point, that point is not now.
>
> In that case, why are you bothering with usenet at all?
> If you're not sure whether one way is semantically equivalent to the
> other way, just go with the one you know, and get on with it.
Posting takes a few seconds tops. Compared to d/l'd, installing,
reading the docs, altering my code, running it, restoring my code &
then debugging the bugs I just introduced by doing this. ;)
Whatever. Look, it works, thanks for the pointer to Benchmark.
--
Peter Fein 773-834-6206
1005 E. 60th St. Chicago, IL 60637
p-fein@uchicago.edu http://pfein.home.ml.org/
------------------------------
Date: Fri, 05 Jun 1998 16:42:19 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: HTML to PERL translation Conversion
Message-Id: <35781881.109716971@news.btinternet.com>
On Fri, 05 Jun 1998 12:51:11 GMT, Eadmund@writeme.com wrote :
>Hi all,
>
>I'm a bit of a newbie with regard to Perl, HTML, Newsgroups so please don't
>flame me if I'm asking a stupid question or posing it to the wrong newsgroup.
>
You obviously didnt read the small print before you signed up.
"...reserve the right to cast aspersions on whomsoever they see fit
for reasons that need not be disclosed." ;-}
>I have put together some pretty daunting web pages using notepad and MS-
>Frontpage. I now want (for various reasons) to have a Perl script generate
Hey some of us put together "pretty daunting web pages" with vi.
(Aside - I've been getting into the HTML mode in Elvis just now)
There is a cure for Frontpage - its called "FORMAT".
>the same HTML code with various forms etc filled in by my web server. I know
>that the filling in the data bit will have to be coded in to Perl script by
>hand, but....
>
>MY QUESTION: Is there a program/tool that will convert an HTML page into perl
>script automatically, to remove the greater part of the donkey work?
>
Something like:
#!perl -w
use File::Basename;
my $shebang = "#!/develop/bin/perl -w";
for (@ARGV)
{
my ($inname,$inpath,$insuffix) = fileparse($_,".htm",".html");
my $outfile = $inpath . "/" . $inname . ".pl";
open(INFILE,$_) || die "Cant open $_ - $!";
open(OUTFILE,">$outfile") || die "Cant open $_ - $!";
print OUTFILE $shebang,"\n";
while(<INFILE>)
{
chomp;
s/\@/\\@/g;
print OUTFILE "print qq%$_\\n%;\n";
}
print OUTFILE "__END__\n";
close OUTFILE;
close INFILE;
}
__END__
But thats not what you actually wanted to do is it? I hope not.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Fri, 5 Jun 1998 15:58:36 GMT
From: David Cross-cmt <Dave.Cross@gb.swissbank.com>
Subject: Re: I'm having problems:
Message-Id: <eq03edjalhv.fsf@gb.swissbank.com>
[non-existant and mispelt groups snipped]
Chris,
I reckon a few moments studying the man pages for the module
File::Find could reap tremendous rewards for you.
Dave...
cmreynolds@hotmail.com (Chris Reynolds) writes:
> Can anyone help me: I am trying to do the following and am having a
> really hard time doing it.
>
> I am trying to write a Perl script called di that will provide summary
> information on a directory and its sub-directories. I am looking to
> make the script take a single directory as input parameter,
> and compute and display the following infor for that directory and for
> each of is sub-directories (and so on...):
>
> The number of sub-directories
> The number of ordinary files
> The number of special files (e.g., symbolic links, sockets,
> pipes, block & character device files)
> The size, in kilobytes, of all files, directories, and special
> files in the directory. Yes, directories and special files
> have sizes too!
>
>
> This is basically what I would like the output of a directory somedir
> which has sub-directories subdir1 and subdir2, and where sub-directory
> subdir2 has sub-directories subsubdir1 and subsubdir2, with subsubdir2
> unreadable due to file permission restrictions.
>
> % di dir1
>
> /home/someuser/somedir/subdir1:
> sub-directories: 0 (0)
> ordinary files: 3 (3)
> special files: 0 (0)
> space consumed: 3263 (3263)
>
> /home/someuser/somedir/subdir2/subsubdir1:
> sub-directories: 0 (0)
> ordinary files: 4 (4)
> special files: 0 (0)
> space consumed: 55759 (55759)
>
> /home/someuser/somedir/subdir2/subsubdir2: UNREADABLE
>
> /home/someuser/somedir/subdir2:
> sub-directories: 2 (2)
> ordinary files: 4 (8)
> special files: 0 (0)
> space consumed: 1612 (57371)
>
> /home/someuser/somedir:
> sub-directories: 2 (4)
> ordinary files: 4 (15)
> special files: 1 (1)
> space consumed: 15888 (76522)
> %
>
> I'd also like so that if the script is not provided exactly one input
> parameter or that parameter is a not a directory, a Usage message is
> displayed on the line immediately below the command line and the
> script terminate, as in:
>
> % di notADirectory
> Usage: di directory
> %
>
> If anyone can help I would really appreciate it. Thank-you!
>
--
If I wasn't so busy writing status reports,
my status report might just become a progress report.
Dave.Cross@gb.swissbank.com
------------------------------
Date: Fri, 05 Jun 1998 16:25:08 GMT
From: John Porter <jdporter@min.net>
Subject: Re: I'm having problems:
Message-Id: <35781D84.6ADF@min.net>
(sniff, sniff: hmmm. hw?)
Chris Reynolds wrote:
>
> I'd also like so that if the script is not provided exactly one input
> parameter or that parameter is a not a directory, a Usage message is
> displayed ...
( @ARGV == 1 and -d $ARGV[0] ) or die "Usage: $0 directory\n";
hth,
John Porter
------------------------------
Date: 5 Jun 1998 17:11:14 GMT
From: "mana" <mana@technologist.com>
Subject: Re: I'm having problems:
Message-Id: <01bd90a5$6c477d70$7f8d16ac@dn9n2153c1>
> I am trying to write a Perl script called di that will provide summary
> information on a directory and its sub-directories. I am looking to
> make the script take a single directory as input parameter,
> and compute and display the following infor for that directory and for
> each of is sub-directories (and so on...):
Use this logic for recursing into sub directories
sub CreateListOfFiles
{
local($dir) = $_[0];
local(*sourceExtension) = $_[1];
local($file,$ext,*lFileArray);
local(@dir_list);
#
# start with the source directory
# push each new directory into a stack
# Add each new file into the array
#
push (@dir_list, $dir);
while (@dir_list)
{
$dir = pop (@dir_list);
opendir (DIR, $dir);
foreach $file (sort readdir(DIR))
{
#
# Eliminate the directories '.' and '..'
#
if ($file ne '.' && $file ne '..')
{
if (-d "$dir/$file" && $file ne '')
{
# push into the stack if it is a directory
push (@dir_list, "$dir/$file");
}
else
{
foreach $ext (@sourceExtension)
{
$ext =~ s/\+/\\\+/g;
# if the file contains an extension specified
# add it to the file array
if ($file =~ /\.$ext$/i)
{
push (@lFileArray, "$dir/$file");
}
}
}
}
}
closedir (DIR);
}
return @lFileArray ;
}
------------------------------
Date: Fri, 05 Jun 1998 17:44:43 GMT
From: John Porter <jdporter@min.net>
Subject: Re: I'm having problems:
Message-Id: <35783028.1C09@min.net>
mana wrote:
>
> Use this logic for recursing into sub directories
Won't argue with the logic, but I take extreme exception
to your posting this awful code.
Where did you get this crap?
Whoever wrote it is a perl4-head -- I haven't seen that many
"local"s in years; and passing arrays by typeglob.
What about checking the result of opendir()?
And this:
foreach $ext ( @sourceExtension ) {
$ext =~ s/\+/\\\+/g;
# if the file contains an extension specified
# add it to the file array
if ( $file =~ /\.$ext$/i )
You think this is quoting any pluses in each extension,
but it adds another backwhack each time you hit this loop!
Clearly the better way is to quotemeta $ext in the regex:
foreach $ext ( @sourceExtension ) {
# if the file contains an extension specified
# add it to the file array
if ( $file =~ /\.\Q$ext\E$/i )
And extensions are case-insensitive? What, are you on DOS?
Besides, why the hell would I use that long nasty sub when I can
use File::Find;
[followups fixed]
John Porter
------------------------------
Date: Fri, 05 Jun 1998 15:51:37 GMT
From: dthanair@my-dejanews.com
Subject: Invoking perl debugger
Message-Id: <6l9469$3td$1@nnrp1.dejanews.com>
Hi,
I have been trying to use the perl debugger by executing the interpreter
in a different directory than where the perl.exe is, but it doesn't seem to
work. I am able to copy the .pl file into the directory where perl.exe is
and use the -d command line option to invoke the debugger, but when I try
interpreting the same .pl file in another directory with the -d option this
error message comes up:
Can't locate perl5db.pl in @INC.
BEGIN failed--compilation aborted.
Any suggestions,
Thanks,
David Thanairongroj
david.thanairongroj@amd.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 05 Jun 1998 16:27:50 GMT
From: dthanair@my-dejanews.com
Subject: Mapped Network problems with Perl
Message-Id: <6l96a6$664$1@nnrp1.dejanews.com>
Hi,
The problem I have is that I have a web server (IIS) and another server which
has the application that I want to invoke and execute its command-line
commands. I have the other server mapped to a certain drive on the web
server; and, I'm not able to use the "chdir" function in my cgi program to go
to that directory, but I'm able to do it through my web servers MS/DOS
prompt. I tried using the mapped drives path first, then the absolute path
of the other server; but, the webserver is still unable to get into the
directory I want. Can someone give me an idea of what might be wrong or
advise me on another route I might take to do this. Are there other
functions in perl that can do the same thing as "chdir".
I would really appreciate it if you would respond to my email address
below my name.
Thanks from a perl novice,
David Thanairongroj
david.thanairongroj@amd.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 05 Jun 1998 17:09:38 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Mapped Network problems with Perl
Message-Id: <35782377.112522156@news.btinternet.com>
On Fri, 05 Jun 1998 16:27:50 GMT, dthanair@my-dejanews.com wrote :
>Hi,
>
>The problem I have is that I have a web server (IIS) and another server which
>has the application that I want to invoke and execute its command-line
>commands. I have the other server mapped to a certain drive on the web
>server; and, I'm not able to use the "chdir" function in my cgi program to go
>to that directory, but I'm able to do it through my web servers MS/DOS
>prompt.
<snip>
This is of course nothing to do with Perl - but strangely is still
frequently asked here. Please use the appropriate newsgroup in
future.
A) Your drive mapping will almost certainly be unknown to any CGI
B) Your IUSR_<whatever> user almost certainly has no rights to
directories on the other server.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 5 Jun 1998 09:46:45 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <6l97dl$82@cello.hpl.hp.com>
> well, one thing to be wary of is that you compared 'grep EXPR, LIST'
> with 'map BLOCK, LIST' instead of 'map EXPR, LIST'. something i've
> been watching for a while now is how the EXPR forms tend to be
> faster (sometimes much faster).
Now this is very interesting. I wonder if it is possible for the
peephole optimizer to recognize when blocks are being used for their
semantics, and when they are not, and do the appropriate conversion?
For instance:
timethese(100000, {a => '{1}', b => '{{2}}', c => '{{{3}}}'})
Benchmark: timing 100000 iterations of a, b, c...
a: 2 secs ( 0.76 usr 0.00 sys = 0.76 cpu)
b: 4 secs ( 1.49 usr 0.00 sys = 1.49 cpu)
c: 3 secs ( 2.17 usr 0.00 sys = 2.17 cpu)
Each block seems to be taking ~7 microseconds on this machine, but
none of the blocks are doing anything useful . . .
I wonder how many unnecessary blocks I have in my multithousand-line
Perl script today . . .
-tom
------------------------------
Date: 05 Jun 1998 13:09:20 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Not even an RFD (yet)... comp.lang.perl.(newbie|questions)
Message-Id: <86soljsrlr.fsf@scooter.cis.ohio-state.edu>
Hi all,
I'm getting concerned about the quality of clpm, and also the sorts of
answers that potentially new Perl programmers are getting. I think
that the real problem is that with all that's going on in clpm, there
just isn't time to give the sort of attention to new people that new
people need. If we could move some of the less technical,
hand-holding, newbie-oriented sort of traffic to a new group, I think
we might be able to solve two problems:
1 decreasing signal::noise ratio in clpm
2 decreasing quality of help provided to new people
I have seen some noise about a comp.lang.perl.moderated, but I haven't
seen it reach any Official Stages toward becoming a real newsgroup.
The purpose of my post is twofold:
1 to find out the status of the comp.lang.perl.moderated newsgroup
proposal, (and its officially stated purpose, moderation
guidelines, etc.) Would clp.moderated be redundant with clp(n|q)?
If not, how would the two fit together?
2 get an initial feeler for the idea of a new group oriented toward
more warm-fuzzy traffic.
If I don't get stiff opposition on the clp(n|q) idea, I'll probably
press forward and make an official RFD, which would be floated here,
as well as all the Usual Places.
Thoughts? Comments?
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: 5 Jun 1998 17:40:03 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Not even an RFD (yet)... comp.lang.perl.(newbie|questions)
Message-Id: <6l9ahj$c5o@mozo.cc.purdue.edu>
Matt Curtin <cmcurtin@interhack.net> writes:
}I'm getting concerned about the quality of clpm, and also the sorts of
}answers that potentially new Perl programmers are getting. I think
}that the real problem is that with all that's going on in clpm, there
}just isn't time to give the sort of attention to new people that new
}people need. If we could move some of the less technical,
}hand-holding, newbie-oriented sort of traffic to a new group, I think
}we might be able to solve two problems:
} 2 get an initial feeler for the idea of a new group oriented toward
} more warm-fuzzy traffic.
}If I don't get stiff opposition on the clp(n|q) idea, I'll probably
}press forward and make an official RFD, which would be floated here,
}as well as all the Usual Places.
Good luck, my friend. You might want to study possible responses to
"But everybody knows newbies don't use newbie groups," because you're
going to be seing it a lot. This may or may not be true, but since
it's impossible to prove that clp(n|q|help) would work before it
actually exists, the bickering will continue ad naseum.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Fri, 05 Jun 1998 17:49:35 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Not even an RFD (yet)... comp.lang.perl.(newbie|questions)
Message-Id: <3578314D.57C3@min.net>
Matt Curtin wrote:
>
> I'm getting concerned about the quality of clpm, and also the sorts of
> answers that potentially new Perl programmers are getting. I think
> that the real problem is that with all that's going on in clpm, there
> just isn't time to give the sort of attention to new people that new
> people need. If we could move some of the less technical,
> hand-holding, newbie-oriented sort of traffic to a new group, I think
> we might be able to solve two problems:
> 1 decreasing signal::noise ratio in clpm
> 2 decreasing quality of help provided to new people
>[etc.]
q{
This is a FAQ. (Although it's not in the FAQ yet.)
Please use DejaNews to research this issue:
that's why God gave us DejaNews.
}
In a nutshell: it's a stupid idea.
John Porter
------------------------------
Date: 5 Jun 1998 13:55:36 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Not even an RFD (yet)... comp.lang.perl.(newbie|questions)
Message-Id: <6l9beo$q6n$1@monet.op.net>
In article <86soljsrlr.fsf@scooter.cis.ohio-state.edu>,
Matt Curtin <cmcurtin@interhack.net> wrote:
>I have seen some noise about a comp.lang.perl.moderated, but I haven't
>seen it reach any Official Stages toward becoming a real newsgroup.
There have been two charters posted with requests for discussion, most
recently on 26 May. The call for votes will go out in seven days.
Check DejaNews if you don't still have the RFD in your spool.
The subject is
Subject: RFD: comp.lang.perl.moderated moderated
It was posted here, in comp.lang.perl.announce, and in news.groups.
> Would clp.moderated be redundant with clp(n|q)?
No, but comp.lang.perl.misc would be. I'm surprised you didn't notice
this alerady. We have comp.lang.perl.questions. You're reading it new.
------------------------------
Date: Fri, 05 Jun 1998 16:14:22 GMT
From: John Porter <jdporter@min.net>
Subject: Re: pattern match
Message-Id: <35781AFC.3957@min.net>
Here's one solution.
Note where I assume that these are London postal codes.
hth,
John Porter
package Record;
sub new {
my $pkg = shift;
my $string = shift;
my $self = bless { }, $pkg;
$string =~ s/\n//sg; # get rid of newlines
/;/ or die "Record::new: no filename in record!";
$string = $`;
$self->{filename} = $';
my %lengths;
for ( split( /,\s*/, $string ) ) {
if ( s/\*$// ) {
$lengths{length($_)} = 1;
$self->{wild}{$_} = 1;
}
else {
$self->{exact}{$_} = 1;
}
}
$self->{lengths} = [ sort { $a <=> $b } keys %lengths ];
$self;
}
sub dump {
my $self = shift;
print "filename:$self->{filename}\n";
print "wild:", join(',',keys %{ $self->{wild}}),"\n";
print "exact:",join(',',keys %{ $self->{exact}}),"\n";
print "lengths:",join(',',@{ $self->{lengths}}),"\n";
}
sub match { # returns filename or undef
my $self = shift;
my $string = shift;
# If these are London postal codes, then we probably want to
# ignore everything after a space:
$string =~ s/ .*//;
$self->{exact}{$string}
and return $self->{filename}; # exact match
for my $len ( @{ $self->{lengths} } ) {
$self->{wild}{ substr($string,0,$len) }
and return $self->{filename};
}
undef;
}
package main;
my @records;
{
local $/ = ""; # parse input file on empty lines ("paragraph mode")
open(F,"< $datafile") || die "open $datafile: $!";
@records = map { chomp; new Record $_ } <F>;
close(F);
}
for ( @records ) { $_->dump; }
# test:
for (<>) { # read lines from stdin
chomp;
for my $r ( @records ) {
my $f = $r->match( $_ );
if ( $f ) {
print "$_ -> $f\n";
}
}
}
------------------------------
Date: Fri, 05 Jun 1998 16:49:11 GMT
From: Eadmund@writeme.com
Subject: perl cgi generated html with java app dont run
Message-Id: <6l97i7$7jj$1@nnrp1.dejanews.com>
Hi all,
I have a perl script which generates a page of HTML with a simple java cookie
function embeded.
When I run the script it generates the code ok, the html part is fine but the
java func just crashes out.
Here's the really odd bit: if I view-source the page that has just been
generated and has crashed, save it as a local htm file, then load it back it
to my browser directly, it all works fine - including the java?~?~?##/??
It seams that when perl generates the script, it won't run the java component
- why??????
I'm running this under ms-frontpage 98 under windows NT4.0 server - internet
server.
Any ideas as to why this should be will be gratfully recieved.
Ta
Ed
Eadmund@writeme.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 5 Jun 1998 16:39:43 -0500
From: lawrence@math.umass.edu (James Lawrence)
Subject: perl equivalent to C's local static var?
Message-Id: <35781f4f.0@oit.umass.edu>
I wish to have a variable inside a perl subroutine
which keeps its value when it goes out of scope.
In C, one could do
int f( void )
{
static int a = 0 ;
return( ++a ) ;
}
and each call to f() returns the successor of the previous
call.
Is there a way to do this in perl without using a global
variable?
------------------------------
Date: Fri, 05 Jun 1998 17:01:41 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: perl equivalent to C's local static var?
Message-Id: <VvVd1.828$14.3215179@news2.voicenet.com>
James Lawrence <lawrence@math.umass.edu> wrote:
>I wish to have a variable inside a perl subroutine
>which keeps its value when it goes out of scope.
Sure, you just need to use sub pointers.
>In C, one could do
>
>int f( void )
>{
> static int a = 0 ;
> return( ++a ) ;
>}
#!/usr/local/bin/perl
$b = gen_f();
$c = gen_f();
for (1..5) { print &$b, "\n"; }
for (1..3) { print &$c, "\n"; }
sub gen_f
{
my $a = 0;
return sub { ++$a; }
}
__END__
Running this you get:
1
2
3
4
5
1
2
3
Each call to gen_f returns an anonymous subroutine. Every one of these
subs knows about it's own variables, so you can have as many of them as
you want with their own personal set of variables.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 5 Jun 1998 17:35:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl equivalent to C's local static var?
Message-Id: <6l9a9q$chn$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
lawrence@math.umass.edu (James Lawrence) writes:
:I wish to have a variable inside a perl subroutine
:which keeps its value when it goes out of scope.
....
:and each call to f() returns the successor of the previous
:call.
:
:Is there a way to do this in perl without using a global
:variable?
% man perlsub
--
"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."
--Larry Wall
------------------------------
Date: 5 Jun 1998 17:52:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl equivalent to C's local static var?
Message-Id: <6l9b8a$dom$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, hex@voicenet.com (Matt Knecht) writes:
:Sure, you just need to use sub pointers.
No, you don't. You just need to read perlsub.
--tom
--
Hey, I had to let awk be better at *something*... :-)
--Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
------------------------------
Date: 5 Jun 1998 15:59:32 GMT
From: emwsbl@emw.ericsson.se (Stefan Berglund)
Subject: Re: Perl Intepreter for Solaris
Message-Id: <6l94l4$opi$1@news.emw.ericsson.se>
Ghim Soo Joong (ghimsj@apwinc.sookmyung.ac.kr) wrote:
: Where can I get the "Perl Intepreter" for Solaris 2.5?
Your email address indicates that you are in Korea so the closest
ftp sites should be:
ftp.bora.net
ftp.nuri.net
look after a directory named CPAN, in there you will find
src/latest.tar.gz , this is the latest perl source distribution.
Unpack and build as usual.
Also have a look at www.perl.com and www.perl.org
the CPAN button on www.perl.com should also take you to the closest
CPAN site.
After you have installed it be sure to read the FAQ with
>> perldoc perlfaq
learn about perldoc with perldoc perldoc
be sure to read the docs with perldoc (or in html via CPAN) before
posting a question here, you will find that people will answer your
questions if you have and you won't get any RTFM flames...
Welcome to the community!
--
/Stefan
Stefan.Berglund@emw.ericsson.se
f94stbe@dd.chalmers.se
http://www.dd.chalmers.se/~f94stbe
Life - the ultimate practical joke
------------------------------
Date: 05 Jun 1998 13:11:26 -0400
From: Matt Curtin <cmcurtin@interhack.net>
To: ghimsj@apwinc.sookmyung.ac.kr
Subject: Re: Perl Intepreter for Solaris
Message-Id: <86ra13sri9.fsf@scooter.cis.ohio-state.edu>
Ghim Soo Joong <ghimsj@apwinc.sookmyung.ac.kr> writes:
> Where can I get the "Perl Intepreter" for Solaris 2.5?
http://www.perl.com/CPAN/src/latest.tar.gz
You'll need a C compiler to build the package.
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: Fri, 05 Jun 1998 16:54:30 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Q: apply func to mutate list; oneliner
Message-Id: <35782464.45DA@min.net>
Xah Lee wrote:
>
> Suppose I have a list from split(...), then I want to apply a
> function to the second element, then return the list. How to do
> it in one line?
Depends on what you mean by "line".
You can write a whole nasty routine, and put no newlines in it.
Or maybe you mean no semicolons.
> my $line='1998/Mar/01';
> my @temp; # I want to avoid this.
> sub monthNameToNumber {return '03'};
> @temp= split(m(/), $line);
> $temp[1]= monthNameToNumber($temp[1]);
> $line = join ('.',@temp);
Here's an example that has no semicolons (except the one at the end):
my $line='1998/Mar/01';
$line=
join'.',@{(map{$_->[1]=monthNameToNumber($_->[1]),$_}[split(m(/),$line)])[1]};
It uses the stack liberally; otherwise it has no temporary variables
except the localized $_ inside the map.
hth,
John Porter
------------------------------
Date: Fri, 05 Jun 1998 16:58:49 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Q: dispatch find/replace string
Message-Id: <35782568.19A3@min.net>
F.Quednau wrote:
>
> s/(jan)|(feb)|(mar)|.../%reptabl{$1}/
^
^ I think you know better than this :-)
> Could be wrong
Typos happen...
John Porter
------------------------------
Date: Fri, 5 Jun 1998 10:01:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: dispatch find/replace string
Message-Id: <MPG.fe1c45c7f89c65a989680@nntp.hpl.hp.com>
In article <3577D12F.F61EA77@nortel.co.uk>, quednauf@nortel.co.uk says...
> Xah Lee wrote:
>
> > What's an efficient way of doing find and replace with a large "find/replace" lookup table?
> >
> > An example:
> >
> > my $str = '1992 feb 1 kim';
> > my %largeFindandRelpaceTable = ('jan'=>1,'feb'=>2,...);
> > my $desiredResult = '1992 2 1 kim';
>
> s/(jan)|(feb)|(mar)|.../%reptabl{$1}/
>
> Could be wrong (I don't have any reference around right now...)
Doubly wrong. Test before posting!!!
s/(jan)|(feb)|(mar)|.../$reptabl{$+}/
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Fri, 05 Jun 1998 10:37:28 -0700
From: Gopinath Venkataramanan <vgopinat@cisco.com>
Subject: reading param values
Message-Id: <35782CD8.6866968A@cisco.com>
Hi
i hv a url with http:.....?x1=1.2&x2=3.0&x3=4 and so on
I know how many x's are coming, ie the count,
how to i get them in the perl script
thro
for ($i=0;$i<=10;$i++)
{
$x{$i} = $q->param('x1'); -- here i want to generate x1 by x$i
}
can you tell me how to do this
regds.
------------------------------
Date: Fri, 05 Jun 1998 17:06:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Regular Expressions
Message-Id: <Pine.GSO.3.96.980605100246.29617j-100000@user2.teleport.com>
On Fri, 5 Jun 1998, Scott Erickson wrote:
> /<hw>(.*?)<\/hw>/igsm # non greedy matching, case-insensitive, global
> matching, ignore specialness of newlines
Of course, this won't work right on some valid HTML; you really need a
parser to do this properly.
The HW tag looks like this: <img src= "hw_tag.gif" alt= "<HW>" >
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 05 Jun 1998 10:12:54 -0600
From: Tkil <tkil@scrye.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <gra13ket5.fsf@scrye.com>
[posted and cc'd to tom]
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> Therefore, it is a perfectly valid generalization, and your
Tom> pointing out of tiny holes theory that an experienced programmer
Tom> would care about does nothing to do dispute this, since it is not
Tom> the experienced programmers who are asking these ridiculous
Tom> questions.
i agree with you in spirit, tom, but you did say:
Tom> Anyone who asks whether something is "in" a list has made a
^^^^^^
Tom> fundamental mistake. They've chosen a data structure that's O(N)
Tom> to search. Bad!
"anyone", to me, has a very specific meaning. you didn't say
"neophyte programmer", you didn't say "beginner". you said "anyone".
if you're going to generalize, please be more careful.
and if you're saying that an "experienced programmer" would never ask
if something is "'in' a list", i will respectfully disagree.
Tom> As for the ordering of hashes, or rather, the lack thereof, I
Tom> have never *once* found this to be a hardship. The workarounds
Tom> are many, and easy, and they all take more time and space than a
Tom> sort in the real cases (not the general computational complexity)
Tom> that I have tested.
i somehow think you left out a negator in that last sentence, although
it still makes sense as written. my primary concern with using hashes
just to facilitate membership tests has to do with the memory cost,
which can be double that of a single array (i think). as others have
pointed out, there may be other reasons for preferring arrays over
hashes while still requiring the occasional membership test.
[in fact, i'll probably soon need a persistent queue; having not done
much research yet, i suspect i'll end up playing games with a tied
hash, special "_first" and "_last" members, and numeric keys. we'll
see.]
t.
--
Tkil * <URL: http://www.scrye.com/~tkil> * hopelessly hopeless romantic.
"So amplify this little one | She hears as much as she can see
She's a volume freak | And what she sees, she can't believe."
-- Catherine Wheel, _Happy Days_, "Judy Staring At The Sun"
------------------------------
Date: Fri, 05 Jun 1998 16:22:26 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <35781CE2.5AC2@min.net>
Glen Koundry wrote:
> Actually the point to my question was not "what is the fastest way to
> search a list?". I think an "in" operator would make the code a lot
> easier to write (and to read as well).
So write an 'in' subroutine, and put it in a .pl file in one of
your common areas.
John Porter
------------------------------
Date: Fri, 05 Jun 1998 16:02:48 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Win32::NetResource Module
Message-Id: <35791669.354163009@news.mmc.org>
[posted and mailed]
On Fri, 5 Jun 1998 14:11:55 +0100 , "Williams, Brian"
<Brian.Williams@uuplc.co.uk> wrote:
>I am trying to use the Win32::NetResource module to "net use" drive
>mappings, without much success. If anybody has any worked examples, or
>the the URL of a site with examples, please post.
>
>Brian Williams
>Brian.Williams@uuplc.co.uk
#!perl -w
my ($error,%resource);
use Win32::NetResource;
# Note: for Netware resources, change Provider to 'Netware Services'
%resource = (Scope => RESOURCE_CONNECTED,
Type => RESOURCETYPE_DISK,
DisplayType => RESOURCEDISPLAYTYPE_SERVER,
Usage => RESOURCEUSAGE_CONNECTABLE,
LocalName => 'Y:',
RemoteName => '\\\\SERVER\\SHARE',
Comment => 'Oy gee wow!',
Provider => 'Microsoft Windows Network');
unless (Win32::NetResource::AddConnection(\%resource,'pass','user',0)) {
Win32::NetResource::GetError($error);
print "Couldn\'t connect to $resource{RemoteName}. Error # $error\n",
"Type NET HELPMSG $error for the failure reason, since\n"},
"WNetGetLastError() seems to be broken.\n"}
__END__
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Fri, 05 Jun 1998 16:42:27 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Win32::NetResource Module
Message-Id: <35781bc6.110553973@news.btinternet.com>
On Fri, 5 Jun 1998 14:11:55 +0100 , Williams, Brian wrote :
>I am trying to use the Win32::NetResource module to "net use" drive
>mappings, without much success. If anybody has any worked examples, or
>the the URL of a site with examples, please post.
>
>
This a snippet from a real program:
use Win32;
use Win32::NetResource;
my $NWCommon = {
Scope =>
&Win32::NetResource::RESOURCE_GLOBALNET,
Type =>
&Win32::NetResource::RESOURCETYPE_DISK,
DisplayType =>
&Win32::NetResource::RESOURCEDISPLAYTYPE_GENERIC,
Usage =>
&Win32::NetResource::RESOURCEUSAGE_CONNECTABLE,
LocalName => "R:",
RemoteName => "",
Comment => "Blah Blah Blah",
Provider => "Netware Services"
};
if(Win32::NetResource::AddConnection($NWCommon,"Password","User_name",0))
{
#
# Do some stuff with R:
#
if(!Win32::NetResource::CancelConnection("R:",0,1))
{
print STDERR "Error closing connection :\n";
Win32::NetResource::GetError($err);
print STDERR Win32::FormatMessage($err), "\n";
}
}
else
{
warn("Unable to open $service\n");
Win32::NetResource::GetError($err);
print STDERR Win32::FormatMessage($err), "\n";
}
However, there is a problem (which has been discussed here - search
DejaNews) with doing this kind of stuff from the Schedule service
among other things. Oh and it probably wont work on W95 either. And I
seem to recall a suggestion that some of this stuff is broken on some
ActiveState release (... burble burble restraining himself from
advocating Linux )
/J\
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
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 2818
**************************************