[9573] in Perl-Users-Digest
Perl-Users Digest, Issue: 3167 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 15 17:08:04 1998
Date: Wed, 15 Jul 98 14:01:22 -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 Wed, 15 Jul 1998 Volume: 8 Number: 3167
Today's topics:
Re: $my_debugger{contains_bugs} = 1; <mgregory@asc.sps.mot.com>
Re: $my_debugger{contains_bugs} = 1; (Kevin Reid)
Re: $my_debugger{contains_bugs} = 1; (Kevin Reid)
Re: 'use diagnostics' with Win32-perl <bowlin@sirius.com>
Re: Arrays (The Wildman)
Clarification?: Re: regexp s/// for removing tail end o (C. Abney)
copying softlinks <kin@omni.c-cube.com>
Re: Editing files (Larry Rosler)
Re: Editing files <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: executing other applications???? <nguyend7@egr.msu.edu>
Re: executing other applications???? <romank@graphnet.com>
First time writing for the PC <rick@tgix.com>
Re: I am an "antispam spammer"? (Alan Krueger)
Re: Indentation <scribble@pobox.com>
input length?? <ketter@lincolninvestment.com>
Re: input length?? (Steve Linberg)
m//g strange behaviour ? <desar@club-internet.fr>
Re: m//g strange behaviour ? <desar@club-internet.fr>
Netware use Socket workaround <jperkins@wtmail.wtamu.edu>
Re: newbie question on pattern match (Craig Berry)
Parameter Passing to Perl program <whaidri@ford.com>
Re: Parameter Passing to Perl program <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: passing variables by reference <jdf@pobox.com>
perl and inet sockets (Chris Doherty)
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page (Kevin Reid)
Re: Perl debugging in emacs - possible? <Eric.Zylberstejn@wanadoo.com>
Re: perl IDE and compiler (Michael J Gebis)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jul 1998 13:11:02 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: $my_debugger{contains_bugs} = 1;
Message-Id: <r8zpebn5m9.fsf@asc.sps.mot.com>
kpreid@ibm.net (Kevin Reid) writes:
> I am trying to write an alternate Perl debugger.
>
> Here it is (so far):
>
> ------------------------------------------------------------------------
>
> package DB;
>
> open DBW, "> Dev:Console:Debug Lines"
> or die "Couldn't open debugger output window: $!";
>
> sub DB {
> my ($package, $filename, $line) = caller;
>
> my $packlines = \@{"main::_<$filename"};
> printf DBW "%-4s %s\n", "$line:", do {chomp (my $temp =
> $packlines->[$line]); $temp}
> if $package !~ /^Mac/;
> 1;
> }
>
> 1;
>
> ------------------------------------------------------------------------
>
> However, when the following simple program is run (with my debugger), it
> does not wait for input properly:
>
> print "?";
> print scalar <STDIN>;
> print "end\n";
>
Is the issue that it prints "?end\n", or that it doesn't print
anything? Are you running with -w?
Actually, hadn't you better show us how you attempted to run this
"with your debugger"? How, exactly, are you going about getting sub DB
called?
The reason I ask all this is because it looks like -w would give you
"useless use of variable in void context at <the place where you have $temp>"
.. that is what this code does:
$a = "print 'yay\n'";
do {$a};
(doesn't print anything!)
Is there anything difference between this and yours?
HTH,
Martin.
------------------------------
Date: Wed, 15 Jul 1998 16:57:12 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: $my_debugger{contains_bugs} = 1;
Message-Id: <1dc7u44.3ce3ky18sqsnkN@[166.72.108.128]>
Kevin Reid <kpreid@ibm.net> wrote:
> I am trying to write an alternate Perl debugger.
<snip>
> However, when the following simple program is run (with my debugger), it
> does not wait for input properly:
Never mind. I got it working.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 15 Jul 1998 16:57:13 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: $my_debugger{contains_bugs} = 1;
Message-Id: <1dc7v3v.at1bh91qykwsbN@[166.72.108.128]>
Martin Gregory <mgregory@asc.sps.mot.com> wrote:
> kpreid@ibm.net (Kevin Reid) writes:
>
> > I am trying to write an alternate Perl debugger.
> >
> > Here it is (so far):
> >
> > ------------------------------------------------------------------------
> >
> > package DB;
> >
> > open DBW, "> Dev:Console:Debug Lines"
> > or die "Couldn't open debugger output window: $!";
> >
> > sub DB {
> > my ($package, $filename, $line) = caller;
> >
> > my $packlines = \@{"main::_<$filename"};
> > printf DBW "%-4s %s\n", "$line:", do {chomp (my $temp =
> > $packlines->[$line]); $temp}
> > if $package !~ /^Mac/;
> > 1;
> > }
> >
> > 1;
> >
> > ------------------------------------------------------------------------
> >
> > However, when the following simple program is run (with my debugger), it
> > does not wait for input properly:
> >
> > print "?";
> > print scalar <STDIN>;
> > print "end\n";
> >
>
> Is the issue that it prints "?end\n", or that it doesn't print
> anything? Are you running with -w?
The issue is that the three-line program did not wait for input at line
2.
> Actually, hadn't you better show us how you attempted to run this
> "with your debugger"? How, exactly, are you going about getting sub DB
> called?
I set the environment variable PERL5DB to 'BEGIN {require "gdebug.pl"}'
(where gdebug.pl contains the above code).
> The reason I ask all this is because it looks like -w would give you
> "useless use of variable in void context at <the place where you have $temp>"
>
> ... that is what this code does:
>
> $a = "print 'yay\n'";
>
> do {$a};
>
> (doesn't print anything!)
>
> Is there anything difference between this and yours?
Yes. My do {} was part of the arguments to printf.
>From perlfunc.pod:
do BLOCK
Not really a function. Returns the value of the last command in
the sequence of commands indicated by BLOCK.
<snip>
Therefore, the do returns the chomp()ed value of $packlines->[$line].
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 15 Jul 1998 12:28:23 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Steve Pettay <spettay@lgc.com>
Subject: Re: 'use diagnostics' with Win32-perl
Message-Id: <35AD02D7.D4EA82D0@sirius.com>
Steve Pettay wrote:
>
> What's the secret to using "use diagnostics" under Win32-perl?
The secret is to get rid of the ActiveState distribution and
install the standard Perl distribution.
-- Jim Bowlin
------------------------------
Date: 15 Jul 1998 19:07:04 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: Arrays
Message-Id: <slrn6qq0be.cp.the_wildman_98@foobar.net>
On 15 Jul 1998 05:46:12 GMT, Wildman's eyes rolled up in his head and
froth dripped from his fangs when Martien Verbruggen
<mgjv@comdyn.com.au> said the following fighting words:
>In article <35AB3140.42ADBF7F@email.sps.mot.com>,
> Paul Keenan <r11354@email.sps.mot.com> writes:
>
>> The most serious error seems to be that you don't increment your
>> loop variable $i.
>>
>> Replace
>> for (...; ...; $i)
>
>Errrr.. I don't know what's going wrong with your news reader, but the
>original post contained:
>
>for ($i = 0;$i < MAX;$i++) {
> $array[$i] = $i;
>}
>
>That clearly increments $i.
>
>> with
>> for (..., ..., $i+-+-)
>
>Where is the operator +-+- documented?
>
As others have pointed out (and I wish I had taken a closer look before
posting, but it resulted in a great deal of help elsewhere) that code is
perfectly fine.
The *real* problem was that I was trying to do this:
for ($i = 0;$i < $MAX;) {
$array[$i] = $i;
if ($foo == $bar) { $i++; }
print $array[$i];
}
However, someone pointed out a more efficient way to do this. Thanks for all
the help people.
As for the +-+-, I think he was pointing out that *some* operator should be
used.
--
The Wildman
PLEASE do NOT reply to this post! If you MUST email me, please use wildman at
microserve dot net, but a followup is preferred. If you DO reply to the
wrong address, I'll still read it but don't expect a reply. Unless you are a
spammer, in which case I will reply to your ISP.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ 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++++
------END GEEK CODE BLOCK------
------------------------------
Date: 15 Jul 1998 15:46:58 GMT
From: cabneySP4M@SP4M.SP4Mcyberpass.net (C. Abney)
Subject: Clarification?: Re: regexp s/// for removing tail end of string
Message-Id: <6oiiti$tin$1@news.infonex.net>
In article <6o0vaj$18s@newsserver.trl.oz.au>,
ac1@fspc.netsys.itg.telecom.com.au (nobody) writes:
> Jerry (jerry@fitzweb.com) wrote:
>: I have a string that is a full path to a file, i.e.
>: dir/subdir/subsubdir/file.ext What I want to do is strip off the file name,
>: leaving just the path info (with the final / ) in a string. The paths will
<snip>
>: I tried substitution, using this:
>: $path =~ s/\/.*?$//;
>: but it strips off everything after the first '/'. I thought the '.*?' would
>: give me the minimal match, and the '$' would make the match start at the
>: end of the string, but I'm wrong.
> Try $path =~ s/\/[^\/]*$//;
> which is any number of non-/'s
> rather than any number of characters.
>
> By the way, what was the extraneous '?' for?
I can do that. '?' constrains the match to the smallest one found,
where perl would normally grab the largest match. The confusion comes
when it is used to constrain the left end of a match. If I recall, PP
says the constraint only works in the left to right direction, and if
you've already matched the left end of your string....
I am by no means a perl expert, however, so would welcome comments or
criticism. The closest I've come to being a perl hacker was
reformatting the GNU chessbook library of openings file into something
rational and consistent ( it was wearisome for a newbie like me, but I
plugged the data there into a dbm style database.)
The rest of this thread is very cool (my first time in this group, I'm
gearing up for a short term stint on a Sun box). Looks like a fun
group.
-C
--
All your qualifications for kookiness seem to be aimed at eliminating
yourself simply because you advocate a mainstream product. That is sort
of just being a kook who is a conformist. A bit of a contradiction in
terms, but a valid description. -Bob O C. Abney
------------------------------
Date: 15 Jul 1998 12:09:16 -0700
From: Kin Cho <kin@omni.c-cube.com>
Subject: copying softlinks
Message-Id: <cohyatv3p9f.fsf@omni.c-cube.com>
Does someone has some quick Perl code to copy softlinks?
That is:
ln -s a b # point b at a
perl cpln.pl b c d # I want c and d to point at a as well
Thanks.
-kin
------------------------------
Date: Wed, 15 Jul 1998 12:28:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Editing files
Message-Id: <MPG.1016a2a47ac5ca1989717@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6oiopg$5e5$1@nnrp1.dejanews.com> on Wed, 15 Jul 1998 17:27:12
GMT, tim221175@my-dejanews.com <tim221175@my-dejanews.com> says...
> In article <6oicsb$hbr$1@nnrp1.dejanews.com>,
> merzky@physik.hu-berlin.de wrote:
> > In article <6oi70h$8u9$1@nnrp1.dejanews.com>,
> > tim221175@my-dejanews.com wrote:
> > > Is there an easy way of editing a file. I want to append a line of text in
> > > the middle of a text file. Will I have to cut the file in two halves and
> then
> > > concatenate them with new line in the middle or is there an easy way to do
> > > this in perl?
...
> > something like this could do the job:
> >
> > #!/usr/bin/perl -w
<LOTS OF CODE SNIPPED>
> > # done...
...
> Thanks very much it works perfectly.
>
> Is there an easy way to delete lines from a text file as well ?
This return question is a classic illustration of the futility of
providing someone with a detailed answer instead of telling them to read
the FFAQ so they can figure it out for themselves.
Once again, my response to the original post:
I'd read perfaq5: "How do I change one line in a file/delete a
line in a file/insert a line in the middle of a file/append to
the beginning of a file?"
After you have read the FAQ, understood it, tried it out, and run into
problems, *then* you should come back here with a specific question.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Jul 1998 21:54:23 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Editing files
Message-Id: <7x67gynb4g.fsf@fidelio.vcpc.univie.ac.at>
Re: Editing files, Larry <lr@hpl.hp.com> said:
Larry> After you have read the FAQ, understood it, tried it
Larry> out, and run into problems, *then* you should come
Larry> back here with a specific question.
And remember the 8 golden rules
o include sample code you've written
o say what it is supposed to do (show intended output)
o say what it actually does (show actual output / errors)
o say what you don't understand
o use a meaningful subject line
o learn to count
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: 15 Jul 1998 18:58:19 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: executing other applications????
Message-Id: <6oiu4b$iu5$1@msunews.cl.msu.edu>
Aquil Abdullah <aha@moldyn.com> wrote:
: I am trying to write a perl script that will start an application. I
: created an HTML form that asks for the executables name. I know how to
: decode the data that the Web Browser sends to the Web Server, but when I
: use the system() function with the string that the user inputs the system
: just hangs. I am runnig IIS on aN NT box. I know that there are issues of
: permissions to be dealt with, but what other issues are involved in such a
: task?
: Here is an example? I have written a C application that asks fir a users
: name and address and then updates a text file. I want to be able to start
: this application running from a web browser. Or say I wanted to start
: notepad running. Where does the execution take place and do I have to
: concern myself with network issues???
: Any answers? I've go plenty of questions.
Hi,
Here's the problem. Your C app is platform dependent. Even if you've
written protable code, your C app will need to be recompiled on every
platform. Remember the M$ Windows is not the only OS out there. The
second problem is running another random app without any security
restrictions is major problems. Lets say your not a nice person (I
don't know you so I can't judge, but just for this example) you could
write a virus to infect the person computer, and even be able to
execute it. That's why Java applets are not allowed to do any
commands on the system their running on.
Here's what happening. Your HTML form sends data for the Perl script
to handle, and the script is suppose to execute some program on the
clients computer. Basically your missing a few steps. If it we're
possible, you'll have to figure out how the script can execute
something on the clients box. The system() call will only run local
programs on the system. It's very very very dangerous to do so. You
should use the -T (taint) options to limit dangerous activity.
--
Dan Nguyen |
nguyend7@cse.msu.edu | I am Grey.
http://www.cps.msu.edu/~nguyend7 |
------------------------------
Date: Wed, 15 Jul 1998 14:50:12 -0400
From: Roman Katsnelson <romank@graphnet.com>
To: Aquil Abdullah <aha@moldyn.com>
Subject: Re: executing other applications????
Message-Id: <35ACF9E4.8095CFE3@graphnet.com>
> Here is an example? I have written a C application that asks fir a users
> name and address and then updates a text file. I want to be able to start
> this application running from a web browser.
this is a job-specific application on the server. you can start that
like any other cgi-from-cgi, i.e. write an html file on the fly with a
form in it that asks for the info
and the action tag pointing to the this application.
> Or say I wanted to start notepad running.
this is different. i would _think_ though i am not sure that you _could_
start up notepad, but why would you want to? what could you possibly get
it to do after you started it?
> concern myself with network issues???
always.
hth,
roman
--
_________________________________________
| The box said: |
| |
_ | Win95, NT 4.0 or better. | _
/ )| |( \
/ / | So I installed FreeBSD. | \ \
_( (_ | | _) )_
(((\ \>|_/-) (-\_|</ /)))
(\\\\ \_/ /___________________________________\ \_/ ////)
\ / Email: romank@graphnet.com \ /
\ _/ \_ /
////// ==================================== \\\\\\
------------------------------
Date: Wed, 15 Jul 1998 20:22:58 GMT
From: Rick Mangi <rick@tgix.com>
Subject: First time writing for the PC
Message-Id: <35ACD7F3.2D4435A0@tgix.com>
I have just been told by my boss to program a relitively simple program
in PERL, but for the PC in Windows 95. The point of the code is to
serve as a "mock-up" for a version that will be written in C and sit on
a UNIX server. Unfortuanately, while I have been programing in PERL for
a few years now, I have never written a single line of code intended to
be run on anything other than a UNIX environment. The code like I said
is fairly simple, and really only reads in a few documents, handles some
basic navigation control, all from the browser. While this task would
only take me a day or so in UNIX, I am not sure what problems I will run
into with the Windows 95, so does anyone know of any common pitfalls or
problems with running a PERL program in a Windows environment, and/or
know of any good refrences for writting PERL code for the Windows.
Also, I need to find a good PERL program for the PC, I havent even
looked around for one yet, but if there is one that I should know about
please let me know. Please reply to my email or the list.
Thanks in advance
James
------------------------------
Date: 15 Jul 1998 20:49:30 GMT
From: krueger@cs.umn.edu (Alan Krueger)
Subject: Re: I am an "antispam spammer"?
Message-Id: <6oj4kq$7om$1@news1.tc.umn.edu>
In article <35aabbb2.879906728@news.escnd1.sdca.home.com>,
John Oliver <do.not.reply@this.address> wrote:
> On Mon, 13 Jul 1998 15:37:01 -0400, jordyn@bestweb.net (Jordyn A.
> Buchanan) wrote:
[...]
> >I'm not saying that address-munging doesn't have its place; it's never
> >bothered me particularly much. There are certainly situations in which it
> >costs a respondant time and effort, though.
>
> I can see that... heck, I've had a carefully-crafted email reply
> bounce off a munged address I didn't notice once or twice. But
> instead of becoming irate at the guy for daring to try to prevent
> becoming a spam victim, I felt a little foolish for not noticing and
> overcoming the block. Perhaps this is why some become so incensed by
> munging... they got caught, and lashed out.
Why should someone feel foolish for not noticing that someone sabotaged
their email address? If one isn't in the habit of doing so, and one
decides to answer someone's question privately, why shouldn't one feel
annoyed if the message bounces?
Understanding why people do this, I will usually bounce it off to the
right address, but I don't think I should feel foolish in any way, as
their message was tailored to do just what it did.
--
W. Alan Krueger |--------- http://bounce.to/alan-krueger ---------------
Software Engineer | "Even I have to ask - when was the last time
EXi Corporation | you received a moral, ethical OR legal spam?"
www.exicorp.com | - Sanford Wallace, formerly of CyberPromotions
------------------------------
Date: 15 Jul 1998 14:15:46 -0500
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Indentation
Message-Id: <6oiv52$iv@tekka.wwa.com>
rra@stanford.edu writes:
>Editors really should not insert tabs for anything.
I'll take that as the crux of the whole matter. Consider
me a convert.
Actually, I used to set tabstops to 229 in the old vi...
And forced wrap at 76.
------------------------------
Date: Wed, 15 Jul 1998 15:51:34 -0400
From: Kerrie Etter <ketter@lincolninvestment.com>
Subject: input length??
Message-Id: <35AD0846.D8D4B1A2@lincolninvestment.com>
I'M NEW TO THIS... so excuse the ignorance...
I have a form (basically builds a resume) one field asks for a
description of current responsibilities.....
The input from the form (which is e-mailed to our recruiter) could be up
to 100 words - how do I "wrap" it so that it doesn't just run off the
page...
(sorry, again for being so ignorant BUT I'M TRYING!!!!)
------------------------------
Date: Wed, 15 Jul 1998 16:37:31 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: input length??
Message-Id: <linberg-1507981637310001@projdirc.literacy.upenn.edu>
In article <35AD0846.D8D4B1A2@lincolninvestment.com>, Kerrie Etter
<ketter@lincolninvestment.com> wrote:
> I'M NEW TO THIS... so excuse the ignorance...
We can excuse ignorance, but we can't excuse not reading the FAQ.
> I have a form (basically builds a resume) one field asks for a
> description of current responsibilities.....
>
> The input from the form (which is e-mailed to our recruiter) could be up
>
> to 100 words - how do I "wrap" it so that it doesn't just run off the
> page...
What are you talking about? HTML? Why don't you read an HTML book, or
post in an HTML newsgroup? Does this have anything to do with Perl? If
so, what?
> (sorry, again for being so ignorant BUT I'M TRYING!!!!)
Not hard enough, perhaps. You really need to read some FAQs and figure
out where to post before you start your work. What you have just done is
flamebait. PLEASE take the time to learn about the discussion here before
barging in with your questions. It's simple politeness, and simple
politeness will take you a long way on your sojourn through USENET. This
is not an HTML group.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 15 Jul 1998 21:11:51 +0200
From: Francois DESARMENIEN <desar@club-internet.fr>
Subject: m//g strange behaviour ?
Message-Id: <35ACFEF7.BC33FC8B@club-internet.fr>
Could someone tell me why this script:
--------------------------------------
sub foo {
$_[0] =~ /\G(.)/g;
$1
}
print scalar foo('abcdef'), foo('abcef');
--------------------------------------
output "af" instead of "aa" that I would have expected ?
Why the list context of second call to foo should modify
the $_[0] =~ /\G(.)/g behaviour ?
I'd understand if foo was written:
sub foo {
$_[0] =~ /\G(.)/g
}
I'm using perl 5.004_04 on SCO Unix, Linux 2.31 and Win32.
Any ideas ?
Frangois
----------------------------------------------
Hiroshima 45 - Tchernobyl 86 - Windows 95
----------------------------------------------
------------------------------
Date: Wed, 15 Jul 1998 21:20:57 +0200
From: Francois DESARMENIEN <desar@club-internet.fr>
Subject: Re: m//g strange behaviour ?
Message-Id: <35AD0119.1F66F50@club-internet.fr>
Sorry, I should have wrote:
I'd understand if foo was written:
sub foo {
wantarray ? ($_[0] =~ /\G(.)/g)[-1] : ($_[0] =~ /\G(.)/g, $1);
}
------------------------------
Date: Wed, 15 Jul 1998 13:39:43 -0500
From: Justin Perkins <jperkins@wtmail.wtamu.edu>
Subject: Netware use Socket workaround
Message-Id: <35ACF76F.59A3473D@wtmail.wtamu.edu>
Anybody know of a way to hardcode the use Socket; into a script so it
can be used in netware perl?
thanks,
Justin Perkins
------------------------------
Date: 15 Jul 1998 20:04:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: newbie question on pattern match
Message-Id: <6oj1vr$5gg$1@marina.cinenet.net>
Larry Rosler (lr@hpl.hp.com) wrote:
: > Note that N here is not the size of the number in the sense of its
: > magnitude, but rather in the sense of its left-of-the-decimal digit
: > count...which is roughly the base-10 logarithm of the (absolute value of
: > the) number. I don't think even a quadratic algorithm is a problem for Ns
: > in perhaps the low teens at most (which takes us up into the trillions).
:
: Abigail hit it right on the head. The crossover on my system is one
: million. As demonstrated:
[snip]
Oh, I'm not surprised; I'm just saying that for small N, algorithmic
complxity/overhead is (usually) of little concern. Using bubblesort to
sort 10,000 items is silly; using it on 10 items probably will not make
much of a difference over (say) quicksort.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Wed, 15 Jul 1998 15:05:16 -0400
From: Wali Haidri <whaidri@ford.com>
Subject: Parameter Passing to Perl program
Message-Id: <35ACFD6C.BA2@ford.com>
I am passing an argument list to a perl program in the form
VARIABLE1=VALUE1 VARIABLE2=VALUE2 and so on. This list could contain one
or more arguments.
Following piece of code breaks the argument list into variable names
while ($ARGV[1] =~ /^(\w+)=(.*)/ && shift)
{
eval "\$1=\$2";
}
It does a good job upto a certail length of the argument list (e.g. it
takes upto 4 arguments) and ignores rest of them.
I put a print statment inside the while loop but it shows me only 4
values while I pass 6 or more.
Anybody has any clue. By the way, I am running perl 4 on HP 9.x
thanks.
------------------------------
Date: 15 Jul 1998 21:50:15 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Parameter Passing to Perl program
Message-Id: <7x7m1enbbc.fsf@fidelio.vcpc.univie.ac.at>
Re: Parameter Passing to Perl program, Wali
<whaidri@ford.com> said:
Wali> I am passing an argument list to a perl program in the
Wali> form VARIABLE1=VALUE1 VARIABLE2=VALUE2 and so on. This
Wali> list could contain one or more arguments.
Wali> Following piece of code breaks the argument list into
Wali> variable names
Wali> while ($ARGV[1] =~ /^(\w+)=(.*)/ && shift) { eval
Wali> "\$1=\$2"; }
You could be allowing the script to do arbitrary things
passed on the command line. You just accept the arguments
and `eval' them blindly. Not a good idea.
(TAOWODT of course and untested and just a fragment, YMMV,
don't blame me if it scares your cat, and so on)
my %args;
for (@ARGV) {
my ($var, $val) = split /=/; # "my" = perl5
$args{$var} = $val;
}
Now you can access the arguments through the hash %args.
"keys" tells you the variable names used. See the
documentation for "keys" and "each" for more info about
iterating over hashes.
This wouldn't be an attempt at CGI would it? If so, make
sure you upgrade to perl5 and use CGI.pm instead.
Wali> Anybody has any clue. By the way, I am running perl 4
Wali> on HP 9.x
Upgrade. Now. Yes, NOW! :-)
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: 15 Jul 1998 15:32:34 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Cyril Matalon <matalon@jouy.inra.fr>
Subject: Re: passing variables by reference
Message-Id: <u34iety5.fsf@mailhost.panix.com>
Cyril Matalon <matalon@jouy.inra.fr> writes:
> sub test1
> {
> local (\@liste1,\@liste2) = @_;
> shift (@liste1);
> }
> I would like that the list @list1 don't been modified, is there a
> solution ?
Yes: make a copy of the list.
my @copie = @liste1;
shift @copie;
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Wed, 15 Jul 1998 16:45:27 -0500
From: cdoherty@skidmore.edu (Chris Doherty)
Subject: perl and inet sockets
Message-Id: <cdoherty-1507981645280001@frodo.skidmore.edu>
howdy all--
I'm writing a server program in Perl. eventually it needs to talk to a
Java applet, but for debugging purposes I have a client Perl script I'm
using. I'm having some trouble with organizing two-way socket
communcation. here's the setup (this is on Solaris, but I don't think it
matters):
since my prior experience with sockets is nil, I started with the server
script from page 350 of the Camel Book. the sockets set up correctly, and
data moves without problem from the server to the client, but not the
other way around. the server is writing to the client like this (STDIN and
STDOUT have been duped to the client socket):
open OUTFILE, "$outfile";
while (<OUTFILE>) { print; }
which works. the client is reading with a simple "while <SOCK> { print;
}", which also works. the problem comes when I want the server to wait for
the client to send a "ready" signal before it sends data. here's what I
tried:
do {
$foo = <>; # also did <STDIN> and <ClientSock> just for fun
} while ( $foo =~ /ACK/ )
and equivalent constructs. meanwhile, the client is trying this:
print SOCK "ACK";
I also tried "ACK\n" and sending an EOF at the end of the string--no good.
so here's my question: what am I missing? the server is only going to send
after receiving a signal from the client. what special arrangements do I
need to make for that to happen? does a socket option need to be set
differently? "Programming Perl" offers no help on actually sending data
both ways through the socket. I'm sort of out of my league here, so I'd
really appreciate any help.
thanks,
Chris Doherty
cdoherty@skidmore.edu
------------------------------
Date: Wed, 15 Jul 1998 18:59:27 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35ACFDB2.477B@min.net>
Ilya Zakharevich wrote:
>
> Failed logic. Perl4 code is not Perl5 code, but it is parsed by Perl
> v5 interpreter. There is no restrictions what code is *illegal*, but
> there are tons of descriptions of what is *legal*.
Nothing wrong with my logic, friend. (Not here, anyway.)
What we have is problem of semantics.
You say code which includes both perl4 and perl5 constructs can
not be called perl code, even though there exists a program (named perl)
which compiles and executes that code.
I say such code can be called perl code -- and there are good
reasons for saying it. perl implements Perl, period. It is a
defining implementation.
> There is no "the interpreter". My home machine has hundred(s?) of
> versions of perl, all slightly different.
Sure. And so you have implementations of hundred(s?) of slightly
different languages. I submit that any/all of them may legitimately
be called by the name of Perl.
--
John Porter
We have enough youth, how about a fountain of smart?
------------------------------
Date: Wed, 15 Jul 1998 16:57:15 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Perl Beautifier Home Page
Message-Id: <1dc49f1.5noj2el9zgw1N@[166.72.108.128]>
Tim Maher <tim.maher@halcyon.com> wrote:
> I've got my Perl Beautifier running, with a reasonable set
> of default options, on
> http://www.consultix.wa.com/yumpy/cgi-pvt/pbeaut.cgi.
>
> It's been tested primarily with the 66 modules of the standard
> Perl distribution, so I'm interested to see what happens when
> it's confronted with other programming styles.
>
> Please help me test it by whipping some of your code at
> it! I'll be Emailed progrmaany syntax errors that my beautifier
> introduces, which could help me improve it, prior to making
> it more generally available.
>
It appears not to handle prototypes on subroutines correctly.
Try it on this program:
sub AUTOLOAD {join+"",reverse+split//,$_
[0].q. ..($AUTOLOAD =~ /^.*::(.*)$/)[0]}
print tsuJ(qq)\n).hacker(rehtona(lreP)))
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 15 Jul 1998 21:11:03 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
Subject: Re: Perl debugging in emacs - possible?
Message-Id: <35ACFEC7.EE2DC886@wanadoo.com>
Hello,
Jorge Kinoshita wrote:
> Is there any debugger interface in emacs or anything that resembles
> it?
Use cperl.el (download it from CPAN). Open a Perl file. Choose 'Debugger' in
the 'Perl' menu.
Eric
------------------------------
Date: 15 Jul 1998 19:41:39 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: perl IDE and compiler
Message-Id: <6oj0lj$s79@mozo.cc.purdue.edu>
Tushar Samant <scribble@pobox.com> writes:
}gebis@albrecht.ecn.purdue.edu writes:
}>"Greg Rebuck" <Gregory.Rebuck@digital.com> writes:
}>}Okay, I just tried the Perl-to-C-to-binary procedure with a bonehead simple
}>}Perl script and it worked fine (the executable came out to 850K!) Bothers
}>}me still that the guy who wrote it seems to have lost interest and therefore
}>}it just sits out there collecting dust.
}>}If anyone knows what happened to Malcolm Beattie let us all know.
}>
}>He's working on some minor release of some obscure software package or
}>something, I heard.
}Unobfuscated: He was for the most part the pumpkin holder for the
}very major 5.005 release, whose public beta (?) is out, and which
}comes with the compiler.
Ok, since I sort of feel bad about choosing to make a joke instead of
actually adding useful information, let me add this: the latest The
Perl Journal has an article entitled "Perl 5.005" by Gurusamy Sarathy
that explains the state of the upcoming release in great detail. If
you don't get TPJ and are interested, this is the perfect excuse to go
out and get yourself a copy.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3167
**************************************