[10975] in Perl-Users-Digest
Perl-Users Digest, Issue: 4575 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 7 19:07:27 1999
Date: Thu, 7 Jan 99 16:00:19 -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 Thu, 7 Jan 1999 Volume: 8 Number: 4575
Today's topics:
Re: $a = `$cmd` repost (Martien Verbruggen)
About $_ <kcchan@csis.hku.hk>
Re: Absolute Yuck <aqumsieh@matrox.com>
ANNOUNCE: 'lowcal' wrapper for 'cal' (Rahul Dhesi)
autorun CGI <jdixon@slip.net>
Re: autorun CGI <chub@healtheon.com>
Good example of Perl use in everyday life <che@debian.org>
Re: How to NOT use GOTO (Martien Verbruggen)
HTML::Parser documentation or examples <mpitman@phelpsdodge.com>
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism (Martien Verbruggen)
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Re: Perl equivalent to unix's uniq command <aqumsieh@matrox.com>
Re: ping script in perl ....where can I get one? (Greg Ward)
Position Available ASAP in Perl <cmcnamar@maximgroup.com>
regexp problem <marty@catnmoose.com>
Re: regexp problem (Greg Bacon)
Re: regexp problem (Martien Verbruggen)
XS Cookbook question, C++ <chub@healtheon.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 07 Jan 1999 22:16:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: $a = `$cmd` repost
Message-Id: <bnal2.54$FY1.1974@nsw.nnrp.telstra.net>
In article <3694F593.D1159D1E@cig.mot.com>,
Edmond Shum <shum@cig.mot.com> writes:
> I added:
> close(p[that]) just under close(p[this])
> in the similar segment of perl4.036.
You should probably submit a bug report :), using perlbug, so that the
perl porters can fix the problem for coming releases.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Fri, 8 Jan 1999 03:01:49 +0800
From: Rollo Chan Ka Chun <kcchan@csis.hku.hk>
Subject: About $_
Message-Id: <Pine.GSO.4.03.9901080259390.9735-100000@eagle.csis.hku.hk>
Dear all,
I would like to ask a question about the following code.
while ( $_ = readdir DIR )
{
do something...
}
How to find the the $_ whether is the last element or not???
thanks for all of your help...
Regards,
Rollo
------------------------------
Date: Tue, 5 Jan 1999 14:22:17 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
To: alecler@cam.org
Subject: Re: Absolute Yuck
Message-Id: <x3yogodle3b.fsf@tigre.matrox.com>
alecler@cam.org (Andre L.) writes:
>
> In article <368AE152.5F89@erase.callisto.si.usherb.ca>,
> elssa09@erase.callisto.si.usherb.ca wrote:
>
> > $1 = @inputData;
> > $1 =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;
> >
> > I get this error message:
> > Modification of a read-only value attempted at postcard.pl line 23.
> >
> > 23: $1 = @inputData;
> >
>
> The main problem here is assigning a whole file to a scalar. Here's a
Don't be silly! A scalar can be as large as your memory allow it to
be. That is not the problem here.
The problem is assigning to $1 which is a reserved variable. You can't
assign to ${\d}. Use other variable names.
Ala
------------------------------
Date: 7 Jan 1999 23:24:12 GMT
From: c.c.eiftj@62.usenet.us.com (Rahul Dhesi)
Subject: ANNOUNCE: 'lowcal' wrapper for 'cal'
Message-Id: <773fms$1nf$1@samba.rahul.net>
Get it at:
ftp://ftp.rahul.net/pub/dhesi/lowcal
Invokes 'cal' in a friendly way. Optional arguments:
jan - print january
jan 1998 - print january 1998
1998 jan - print january 1998
jan feb mar - print january, february, march
1998 jan feb mar - print january, february, march 1998
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: Thu, 07 Jan 1999 14:53:22 -0800
From: John Dixon <jdixon@slip.net>
Subject: autorun CGI
Message-Id: <36953AE2.A89D29BA@slip.net>
Anybody have suggestions to get a HTML page to automatically run a CGI
when a user hits that page?
Thanx
JD
------------------------------
Date: Thu, 07 Jan 1999 15:22:26 -0800
From: Bruce Chu <chub@healtheon.com>
Subject: Re: autorun CGI
Message-Id: <369541B2.33569207@healtheon.com>
I'm no expert, but there are 2 methods that I've seen:
1) use SSI to exec a cgi
2) use image to refer to the cgi script. I think you may have to return an
image here
-bruce
John Dixon wrote:
> Anybody have suggestions to get a HTML page to automatically run a CGI
> when a user hits that page?
>
> Thanx
>
> JD
------------------------------
Date: 07 Jan 1999 14:35:54 -0800
From: Ben Gertzfield <che@debian.org>
Subject: Good example of Perl use in everyday life
Message-Id: <yttn23uk8xh.fsf@gilgamesh.cse.ucsc.edu>
Here is a good example of what Perl can do in every-day life, for
something that many people need to do.
If your computer at home dials up to the Internet using the PPP
protocol (most do, nowadays) you'll probably have experienced the
interesting problem of not having a static IP (Internet Protocol)
address that is dedicated to your computer.
Because most ISPs are short on IP addresses, they often set up their
dial-ups to get a random IP address from their pool of addresses each
time they dial up -- this is called dynamic IP addressing. The problem
with dynamic IPs is that you never quite know which one your computer
will have each time you dial up, making it hard for people out on the
Net to contact your computer.
Also, if you leave your computer dialed up all day, it may
automatically redial your ISP if it gets disconnected. If it does so,
its IP will probably change; this makes it difficult for you to telnet
or ssh into your home box from work!
The solution I came up with is to have your home machine automatically
format a HTML page containing your home machine's current IP address
to your favorite web server, each time you dial up. This way, you can
just point your web browser, wherever you may be, at whatever web page
the script creates, and immediately know your IP address.
For an example of this script's use, Debian Linux has directories
/etc/ppp/ip-up.d/ and /etc/ppp/ip-down.d/ which can contain any number
of programs, each of which will be executed whenever the machine dials
up or disconnects, respectively. Simply put this script in
/etc/ppp/ip-up.d/ and edit it to configure your username and password
et cetera, and chmod +x it. You'll then have a web page you can always
refer to to get your home machine's IP address!
I would not suggest you leave this program world-readable if it has
your password in it. Please take due precautions on whichever OS you
use to make sure everyone on your system cannot see your password.
Enjoy. If there are any suggestions or comments or creative criticism
or flames, please be sure to let me know.
#!/usr/bin/perl -w
# WHIP -- web hosted IP script
# FTPs a nicely formatted display
# of your current IP address to
# a server.
# written 24 Nov 1997, che@debian.org
# This script is released under the
# GNU General Public License, version
# 2 or later.
# Thanks to Arlon for much-needed
# suggestions and improvements.
# Good buck. :)
# Change the settings below to reflect
# your setup.
my @devices = qw(ppp0 ppp1 ppp2);
# Which devices do we want to check?
# Change to 'eth0' for ethernet,
# 'sl0' for slip, et cetera. You may
# add as many devices as you like,
# just separate them by spaces.
# The first device that has an IP
# is the one we use.
my $upload_server = 'www';
# Change 'www' to the name of the server
# you wish to upload your page to.
my $upload_user = 'username';
# Change this to your username on the
# above server.
my $upload_password = 'password';
# Change this to your password on the
# upload server.
my $upload_directory = 'public_html';
# Change the above to the directory in
# which you'd like to put the web page.
my $upload_file = 'dynamic.html';
# Change the above to the filename you'd
# like to store the file in.
use Net::FTP;
use POSIX;
my $ip;
foreach my $device (@devices) { # The first device in @devices to have
$ip = get_ip($device); # a legal IP is assumed to be the one
last if defined $ip; # we want.
}
if (not defined $ip) {
die "Could not get a IP for any of the devices: @devices\n";
}
my $tempname = tmpnam(); # tmpnam() is from the POSIX module
my $date = scalar localtime();
open (TEMP, ">$tempname") or die "Couldn't open temp file $tempname for writing: $!\n";
print TEMP <<EOF;
<html>
<title>$upload_user\'s Dynamic IP Address</title>
<body>
<h1>$upload_user\'s Dynamic IP Address</h1>
<p>My current IP address is <b>$ip</b>
<p>
<a href="telnet://$ip">Access via telnet</a><br>
<a href="http://$ip">Access via web</a><br>
<a href="ftp://$ip">Anonymous ftp</a>
<p>
Yiff!
<hr>
This page was brought to you on $date by <a
href="http://csl.cse.ucsc.edu/~ben/whip/">WHIP, the Web-Hosted IP
script</a>, copyright 1997, 1999 by Ben Gertzfield, <<a
href="mailto:che\@debian.org">che\@debian.org</a>>.
</body>
</html>
EOF
close TEMP;
my $ftp = Net::FTP->new($upload_server);
$ftp->login($upload_user, $upload_password) or die "FTP login as user $upload_user failed.\n";
$ftp->cwd($upload_directory) or die "Could not FTP to dir $upload_directory.\n";
$ftp->ascii();
$ftp->put($tempname, $upload_file) or die "Could not put file $tempname as $upload_file.\n";
$ftp->quit();
unlink $tempname or die "Couldn't delete $tempname: $!\n";
# get_ip: from a device name, run 'ifconfig' and get the IP address of
# that device. Return the IP address you find.
sub get_ip {
my $device = shift;
open (IFCONFIG, 'ifconfig |') or die "Couldn't open ifconfig for reading: $!\n";
while (<IFCONFIG>) {
if (/^$device/) { # Found the device, so..
my $line_to_munge = <IFCONFIG>; # Get the next line.
my ($ip) = $line_to_munge =~ /inet addr:(\d+\.\d+\.\d+\.\d+) /;
close IFCONFIG;
return $ip;
}
}
return undef; # if we get here the device wasn't found
}
__END__
--
Brought to you by the letters S and F and the number 5.
"Do you wish to see our *surprising toys*? No! Do not!"
Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet/Open Projects IRC as Che_Fox.
------------------------------
Date: Thu, 07 Jan 1999 23:17:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to NOT use GOTO
Message-Id: <pgbl2.75$FY1.2228@nsw.nnrp.telstra.net>
In article <36944FFE.B29DD828@ecpi.com>,
"John T. Jarrett" <jjarrett@ecpi.com> writes:
> Alright, my eyes are crossed and I can't read no more doc's. Could you
> tell me how to get out of this without using goto? Without the goto, it
> comes back! (And the problem I am trying to solve is check if a
> directory exists and if so exit with a message but if not do all the
> real work at &makeit)
> sub repsite {
> $UserDir =
> "\/nfs\/www\/com\/webs\/www.wondertek.com\/htdocs\/$fields{'Username'}\/";
You don't need backslashes before the slashes.
> opendir(DIR, $UserDir) || goto &makeit;
> print "Content-type: text/html\n\n";
> print <<__W2__;
> <H1>User Name / Directory Name Taken</H1>
> Please press Back on your browser and try a
> different User Name.
> __W2__
> exit;
> }
First of all, I am not entirely sure what you are trying to do..
Do you want the stuff which you have (misleadingly) indented to be
only executed when the opendir succeeds, and do you want to create it
if it didn't succeed?
if (opendir(DIR, $UserDir))
{
Print stuff here.
}
else
{
&makeit;
# You should print confirmation here
}
If all you need to know is whether a directory exists (and is a
directory), something like this is probably better:
# print http headers here
if (-e $UserDir)
{
if (-d _) # Look up the special file handle _ in perlfunc, under -X
{
print "Directory $UserDir already exists";
}
else
{
print "There is already a file with the name $UserDir";
# This can be any kind of file, symlink, named pipe. etc.
}
}
else
{
mkdir $UserDir, 0755;
print "Made $UserDir";
}
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | This matter is best disposed of from a
Commercial Dynamics Pty. Ltd. | great height, over water.
NSW, Australia |
------------------------------
Date: Thu, 7 Jan 1999 16:32:57 -0700
From: "Mark A. Pitman" <mpitman@phelpsdodge.com>
Subject: HTML::Parser documentation or examples
Message-Id: <3695552d.0@anode.phelpsd.com>
Are there any good books, or websites with decent docs and examples of the
HTML::Parser module? I am trying to write a script that takes an HTML file
and places "<B></B>" tags around all occurances of a specific word. I can
do that, but I am trying to use HTML:Parser to avoid placing the bold tags
inside of other html tags. I am not a Perl guru (obviously) so I am having
a little trouble with the object-orientedness of this module. Any help
would be great!
Mark
------------------------------
Date: 7 Jan 1999 22:31:19 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79addn.mcd.dformosa@godzilla.zeta.org.au>
In article <7739gu$ial$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <2HRk2.93$5P1.3093@nsw.nnrp.telstra.net>,
> mgjv@comdyn.com.au (Martien Verbruggen) wrote:
[...]
>> You also seem to make a distinction between programming languages and
>> scripting languages where there is none.
>
>Scripting languages are a subset of programming languages. C, C++,
>Pascal, and Java are NOT scripting languages, for example.
Ok how do you diffrentuate a scripting languge from a nonscriptiong langage?
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: Thu, 07 Jan 1999 21:33:48 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77397s$i5h$1@nnrp1.dejanews.com>
In article <770e9f$21f$1@nnrp1.dejanews.com>,
dturley@pobox.com wrote:
> In article <770b22$uq6$1@nnrp1.dejanews.com>,
> topmind@technologist.com wrote:
> > Subject: Perl Criticism
>
> >
> > [P.S. screw those arrogant, lazy mind-police known as 'moderators']
>
> Of course, everyone is entitled to an opinion. But one has to wonder why you
> are so unsure of yours that you go immediately into the defensive with
> disparaging remarks.
>
> (Esp. since this isn't even amoderated group.)
> ____________________________________
> David Turley
> dturley@pobox.com
> http://www.binary.net/dturley/
Let's just say I had a bad experience with them.
I probably should have waited until I "cooled off"
before posting that.
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 07 Jan 1999 21:38:38 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <7739gu$ial$1@nnrp1.dejanews.com>
In article <2HRk2.93$5P1.3093@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <770b22$uq6$1@nnrp1.dejanews.com>,
> topmind@technologist.com writes:
> > Subject: Perl Criticism
> >
> > Perl gets a lot of credit for its powerful features. However, there are also
> > some major annoyances about it that prevent more widespread and formal
> > acceptance. Some say that "fixing" these would dilute its power, but I do
not
> > fully agree with this. I have put together an evaluation of different
language
> > features that I think could be used to build a "safer Perl":
> >
> > http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
>
> You have obviously no real idea about where Perl came from, how it
> developed, and most importantly, how it works. I suggest you get some
> real acquaintance with it before attempting to write about it.
>
> Some of your statements about Perl are inaccurate, some incorrect, and
> some blatant lies.
>
I came here to learn about any such alleged inaccuracies. You did not supply
specifics or details. Your criticism of my article is far worse
than my criticism of Perl because at least I attempted to give
specifics.
> There is more misinformation and incorrectness in that article,
> besides the perl statements, but that's offtopic, and irrelevant.
> You also seem to make a distinction between programming languages and
> scripting languages where there is none.
Scripting languages are a subset of programming languages. C, C++,
Pascal, and Java are NOT scripting languages, for example.
>
> Martien
> --
> Martien Verbruggen |
> Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
> Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
> NSW, Australia |
>
Details, where's du details!?
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 07 Jan 1999 21:50:56 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <773a7v$ivj$1@nnrp1.dejanews.com>
In article <comdog-ya02408000R0601991921420001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
> In article <slrn797thn.5pg.dformosa@godzilla.zeta.org.au>,
dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) posted:
>
> > Indeed your desige critor are very diffrent to perls, Perl wasn't
> > created to be easy to learn,
>
> i don't think that is so since Larry officially sanctions using only
> a subset of Perl to complete the task. no one has to learn all of
> Perl to get the job done.
>
> however, if people don't like Perl, they don't have to use it. they
> can stay at the office solving their problems while the Perl Mongers
> go out and drink. ;)
>
I am not so much attacking Perl as pointing out what seems
good about it and what stinks so that future language builders
can avoid mistakes, or at least are AWARE of the alternatives
before preceding.
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
>
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/
"...and to go where no man has been flamed before"
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 07 Jan 1999 23:36:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl Criticism
Message-Id: <dybl2.87$FY1.2228@nsw.nnrp.telstra.net>
In article <7739gu$ial$1@nnrp1.dejanews.com>,
topmind@technologist.com writes:
> Scripting languages are a subset of programming languages. C, C++,
> Pascal, and Java are NOT scripting languages, for example.
Huh? This is one that you made up, I suppose? How is sh or csh a
subset of a programming language?
You're only convincing me more that you don't really know what you're
talking about. There is no real distinction between scripting and
programming languages. It is an artificial one, and not defined by
anything globally or generally. Depending on which criteria you use,
perl is seen as a programming language, or a scripting language. Same
fot tcl python, and a few others. Yes, there are languages that are
always described as programming languages or scripting languages, but
there is no set rule for either.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Thu, 07 Jan 1999 23:31:50 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <773g57$n91$1@nnrp1.dejanews.com>
Reply to Heath Holcomb's 1/7 message:
>> the distinction between scripting
and non-scripting languages is meaningless marketing hype. There is no
difference. <<
Perhaps there is no sharp dividing line, but one can still make a dichotomy.
Your statement is like saying, "There are no such thing as short people
because there is no clear dividing line."
Scripting languages are not *optimized* for:
1. Fast applications like 3D graphics.
2. Critical military and medical applications.
3. Building a big commercial OS and/or interpreter.
4. Building mass-distribution applications like wordprocessing.
>> [Unnecessary deviations from the "function rule".]
This seems like an effort to codify something that is more a matter of taste
than anything else. <<
I gave 3 criteria why the function rule is important. (Simpler language,
easier to document, easier to learn). If you disagree, I challenge you to
give higher- ranking criteria or reasons. Criticism is easy, supplying
alternatives is the hard part.
>> Perl's parameter passing takes a little getting used to, but I see no real
problem with it. <<
1. Very tough to mix arrays and scalars unless you have only one array at the
end of the list.
2. "Getting used to" means it is tougher to learn, with little benefits in
return.
3. There is no simple mechanism for passing by-value.
>> I also object to your use of the word "inheritance" in this context. <<
I took it out of the title a day or so ago. Why is only OOP allowed to use
that word?
>> ["Leaky" assignment statements] Again, a matter of taste. <<
It's all a matter of taste, but at least I am attempting to evaluate different
"tastes". Leaky assignments create several rough spots in a language. Their
risks outweigh the benefits IMO.
>> What's your problem with UNIX, anyway? <<
There is a certain tersness culture to it. C.Conrad agrees with me on this.
"If the follow on dude cannot figure it out, then HE/SHE is the problem, not
the writer". Windows also has a culture. They both have good and bad. No
reason to get huffy.
>> Using default arguments (which I think is what you mean by "command piping")
is optional. If you think it makes your code hard to read, then don't do it.
<<
Optional = stupid programmers will overuse it and stick SOMEBODY ELSE with the
mess! Hit and run programming.
>> If you're going to post something like this here, you *really* need to make
sure you've done your homework first. <<
You have not pointed out a single factual error on my part. (I am sure they
exist, but not rampant.)
Keep trying.
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 07 Jan 1999 23:28:14 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <773fud$n5h$1@nnrp1.dejanews.com>
Reply to Jerome O'Neil's 1/6 message:
>> I have four different shells open on my desktop right now, along with
several X-processes and other GUI like things. Which one represents the
"one" command line? <<
I did NOT say Unix has *only* command lines. Command streaming is or was
COMMON in Unix and INFLUENCED many languages and language builders. Do you
disagree with this fact?
You just defeated your self-built straw man. What motivated you to turn light-
grey and dark-grey into black-and-white? Common != Only
>> Your attempts at differentiating "scripting" languages, as opposed to "real"
languages is false. There is no such dichotomy. <<
See my reply to Heath Halcomb's similar false statement.
>> What particular operators would you have rewritten into functions? <<
How about |, cmp, $_, @_, >>, &=
to name a few. (@_ should be chucked altogether, but why couldn't it be a
function anyhow? Why a fricken symbol?)
>> What part of the strict pragma does not satisfy your needs? my() and local
() are well documented. <<
For one, there is no direct passing by value (or read-only) designated by the
routine; second, there is no way to make the scope of an entire routine
"isolated". (Why should I have to localize 20 variables when I could just
localize an entire routine?)
>> I consider any language that does not return a value from an assignment
broken. If it's the rvalue, that's a Good Thing. <<
What is your criteria for stating that? Because you are just plain used to it?
Nicotine? I worded the pros and cons if it. Where's your's?
>>... belies the fact that you have no idea how subroutines operate in perl.
How perl handles parameters is well defined and documented. <<
Perl routines can put the result into unstated results and another routine can
use that unstated result as
a parameter or parameter-like mechanism. is this NOT true????????
>> In short, perl has almost none of the problems you imply. I'll bet another
beer that your biggest misunderstanding stems from having not
RTFM enough. <<
I think you have had too many beers and too much Perl. Go to AA and get a Perl
Arm Patch. You are too used to bad language constructs that you think they are
good. Addiction city!
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
"Dare to compare, dare to fix"
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 07 Jan 1999 23:23:55 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <773fma$n1j$1@nnrp1.dejanews.com>
Reply to David Formosa's 1/6 message:
>> Perl is based on a greate meany languges, its a polyglot of most of
computer scince. Indeed perl is the way that it is because Mr Wall
beleaved given the options it was the best was to go. <<
Is the exact decision and ranking process documented somewhere? At least I am
documenting my choices and making it public.
>> Perl is basicly the embodyment of the unix philophy of "Don't stop people
from doing stupid things because you might stop someone from doing something
cleaver." <<
What if it turns out that the ratio of stupidity to cleverness is 2:1? If that
is the case, then Unix will drag down a company. (It may not be 2, but IMO
stupidy gt cleverness.)
>> Perl wasn't created to be easy to learn, it was resoned that given that a
languge
is used for a lot longer then the learning period features that are
hard to learn but powerfull where considered more usefull then fatures
that where safe for new users but tight ropes for advanced ones. <<
My observation is that there are too many stupid programmers that use certain
features out pure BOREDOM and technical CHALLANGE, not to make programs more
maintanable or elegant. Some language constructs are more likely to be abused
than used to make better software IMO.
What is an example of something you consider powerful in Perl that cannot be
done in a "safer" way without significant power loss? (That is a direct
challenge, by the way. Any takers?)
>> This seems to reflext less some sort of rule and more a fondness for prefix
notation. I don't think that prefix is neccerly more readable nor beter then
infix (though I will concead that postfix is a real pia). Calling this a
"rule" is enshiring what is basicly an issue oftaste. <<
Whatever xfix you dicide on, you should not MIX unless there is a good reason
to. Also, it *is* more readable because "instr" is infinity percent more self-
documenting than "$". (Wow! That was the first time I ever used "infinity"
without exaggerating.)
I don't see a lot of descriptive infix operators. It is usually symbols. If
there are only a few parameters, then the xfix is not really important--you
might as well stick with one type out of consistancy. This "one type" happens
to be prefix out of custom. I did not invent this custom.
Hmmmmm...
mod(x, y)
x (mod) y
x mod y
x, y (mod)
(x, y)mod
[just kicking around the idea of descriptive infix and postfix.]
>> On the issue of Option selectors, my view is this is very close to
perls notorious "$[" verable, which allows you to select if you are
starting your arrays from 0 or 1. It will drive me nuts if I have to
check every time weather or not the compuler for this code is in line
orented or semicolen oriented mode. <<
Why would you have to check the compiler settings? It should be obvious by
looking at the code (assuming you follow the bundling of ; and x/endx advice.)
What do you recommend instead? Use different languages? You would then have to
check to see what language is being used. No gain. I am open to suggestions.
>> Your use of the word "inherentence" is quite odd in this context, most
people would have used global verables or dynamic binding. Perl
offers lexicaly scoped varablies threw the "my" keyword. <<
At times it would be easier to "isolate" the entire routine rather than list
each variable under Local() or my(). You might forget a few.
>> In fact everything in perl leeks, indeed assignment stamets can even
be RValuse wich allows us to do things like ($old = $set) =$new; <<
You are not helping Perl's case here.
>> Your stament "We enough well-chosen string and
parsing functions, the power of Perl can be approached without
sacrificing readability." is not quite correct, the number of
functions neccery is quite large. Regexps are a way of creating a
parser for such constructs. <<
Thanks for pointing out my typo. I did *not* recommend *against* having
regex's. They can even be implimented without violating the function rule (for
the most part).
Thanks for the feedback. Your level of flaming was lower than others. Kudos!
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 7 Jan 1999 22:35:31 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79adli.mcd.dformosa@godzilla.zeta.org.au>
In article <773a7v$ivj$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <comdog-ya02408000R0601991921420001@news.panix.com>,
> comdog@computerdog.com (brian d foy) wrote:
[...]
>I am not so much attacking Perl as pointing out what seems
>good about it and what stinks so that future language builders
>can avoid mistakes, or at least are AWARE of the alternatives
>before preceding.
I think that you should have done a little bit of study into languge
thory. At least enougth to use the correct terms for a number of the
features/options.
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: Tue, 5 Jan 1999 13:54:25 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl equivalent to unix's uniq command
Message-Id: <x3ypv8tlfdr.fsf@tigre.matrox.com>
"bpike" <bpike@netspace.net.au> writes:
> Does anyone no of away to simulate the unix command uniq in perl on an array
We all do, since it's in the 4th FAQ manual.
>From perlfaq4:
How can I extract just the unique elements of an array?
There are several ways shown there, you pick the one that suits your
need the most.
HTH,
Ala
------------------------------
Date: 7 Jan 1999 22:48:36 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: ping script in perl ....where can I get one?
Message-Id: <773dk4$huh$1@news0-alterdial.uu.net>
Mads <maso@int.tele.dk> wrote:
> I've searched and searched, but I can't find a script that can 'ping'. Are
> there any of you who knows where I can find a ping script (preferably in
> perl)?
Try the Net::Ping module, included with Perl. Should make writing such
a script trivial. It's rather more flexible than the good ol' fashioned
Unix 'ping' command, too. 'perldoc Net::Ping' for details.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Thu, 07 Jan 1999 18:33:22 -0500
From: Christian McNamara <cmcnamar@maximgroup.com>
Subject: Position Available ASAP in Perl
Message-Id: <36954442.4ABB5B9F@maximgroup.com>
Since 1987, Maxim Group has been a leader in providing Information
Technology professionals to all companies. We focus on providing you a
path to achieve your goals both personally and professionally. Please
take a moment to call and see what opportunities we may have for you.
Presently we are in need of professionals with the following skill sets:
A Programmer/Analyst to work on a market Risk Application using Perl and
Korn Shell. We are looking for someone with 2 or 3 years experience.
The platform being used is Unix with a Solaris flavour. (Version 5.1
or 2.6). This position is available ASAP and is located in downtown
Toronto at a major financial institution. The position is a month long
contract. Maxim Group offers free software training and world class
customer service to
all of our consultants. For more information, please contact Chris
McNamara at 1-800-241-5950 or 905-501-2830 or e-mail me at the address
below.
Chris McNamara
Maxim Group
cmcnamar@maximgroup.com
------------------------------
Date: Thu, 07 Jan 1999 16:51:07 -0500
From: Marty Landman <marty@catnmoose.com>
Subject: regexp problem
Message-Id: <36952C4B.F18E1F39@catnmoose.com>
I'm interested in substituting a scalar value for a variable which is
imbedded in data that I am printing out. The application is a sign on
screen and the data is $Tries which is a hidden form field. The pgm
reads and prints a file containing the HTML code for the signon.
Is it reasonable for me to read the file into a string and then
substitute the value of $Tries in my pgm to the '$Tries' text in the
file? And if so, how? Assuming my code is properly structured to
accomplish this, I would like to know what the regexp would be to
accomplish this.
sub PrintIt {
my $string;
my $Tries = @_;
my $Signon = "./sign.file";
open (Signon,"$Signon") || die "cannot open signon file $!\n";
$string .= $_ while <Signon>;
# here's where I would put the regexp for the substitution
print $string,"\n";
close(Signon) || die "cannot close signon file $!\n";
}
tia
--
Marty Landman - web programming and graphics
Cat 'n Moose dot com http://www.catnmoose.com/
------------------------------
Date: 7 Jan 1999 22:42:05 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: regexp problem
Message-Id: <773d7t$fi2$1@info.uah.edu>
In article <36952C4B.F18E1F39@catnmoose.com>,
Marty Landman <marty@catnmoose.com> writes:
: I'm interested in substituting a scalar value for a variable which is
: imbedded in data that I am printing out. The application is a sign on
: screen and the data is $Tries which is a hidden form field. The pgm
: reads and prints a file containing the HTML code for the signon.
FAQ. Section 4. How can I expand variables in text strings?
Greg
--
Ferengi Rule of Acquisition #48: The bigger the smile, the sharper the knife.
------------------------------
Date: Thu, 07 Jan 1999 23:30:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: regexp problem
Message-Id: <lsbl2.83$FY1.2228@nsw.nnrp.telstra.net>
In article <36952C4B.F18E1F39@catnmoose.com>,
Marty Landman <marty@catnmoose.com> writes:
> I'm interested in substituting a scalar value for a variable which is
> imbedded in data that I am printing out. The application is a sign on
Read the part of the faq that talk about this:
# perldoc -q 'var.*string'
=head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq4.pod
=head2 How can I expand variables in text strings?
# perldoc perlfaq4
/ How can I expand variables in text strings?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: Thu, 07 Jan 1999 14:59:02 -0800
From: Bruce Chu <chub@healtheon.com>
Subject: XS Cookbook question, C++
Message-Id: <36953C35.4474C305@healtheon.com>
Hi,
I am trying to build a loadable perl module with XS that accesses some
C++ routines. I downloaded Dean Roehrich's XS CookBook from CPAN, but am
unable to get the C++ example (Ex7) running. It compiles properly, but
failed during the test. Any ideas? I am running into a similar problem
with the wrapper that I'm writing (different symbol though) and hope
that fixing the Ex7 testcase will provide me with the insight I need to
fix my module.
Here is the output:
vortex [466] % make test
PERL_DL_NONLAZY=1 /usr/dist/bin/perl -Iblib/arch -Iblib/lib
-I/usr/dist/lib/perl5/5.00502/sun4-solaris -I/usr/dist/lib/perl5/5.00502
-e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests
@ARGV;' t/*.t
t/test1.............Can't load 'blib/arch/auto/CookBookA/Ex7/Ex7.so' for
module CookBookA::Ex7: ld.so.1: /usr/dist/bin/perl: fatal: relocation
error: file blib/arch/auto/CookBookA/Ex7/Ex7.so: symbol __0OdlPv:
referenced symbol not found at
/usr/dist/lib/perl5/5.00502/sun4-solaris/DynaLoader.pm line 168.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4575
**************************************