[23900] in Perl-Users-Digest
Perl-Users Digest, Issue: 6102 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 9 18:10:46 2004
Date: Mon, 9 Feb 2004 15:10:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 9 Feb 2004 Volume: 10 Number: 6102
Today's topics:
Re: Why is Perl losing ground? <news4@earthsong.null.free-online.co.uk>
Re: Why is Perl losing ground? (Malcolm Dew-Jones)
Re: Why is Perl losing ground? <bagneski@execpc.com>
Re: Why is Perl losing ground? <kirk@strauser.com>
Re: Why is Perl losing ground? <dwall@fastmail.fm>
Re: Why is Perl losing ground? <dd-b@dd-b.net>
Re: Why is Perl losing ground? <ian@WINDOZEdigiserv.net>
Re: Why is Perl losing ground? <ian@WINDOZEdigiserv.net>
Re: Why is Perl losing ground? lesley.b@zen.co.yuk
Re: Why references?? (Walter Roberson)
Re: Why references?? (Malcolm Dew-Jones)
Re: Why references?? <usenet@morrow.me.uk>
Re: Why references?? <bmb@ginger.libs.uga.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 09 Feb 2004 19:22:28 +0000
From: Andy Baxter <news4@earthsong.null.free-online.co.uk>
Subject: Re: Why is Perl losing ground?
Message-Id: <pan.2004.02.09.19.22.27.768788@earthsong.null.free-online.co.uk>
Kirk Strauser said:
>> PHP
>
> Oh, Lord. I can't stand PHP. It seems like someone wanted "Perl Lite" for
> web scripting, and when it caught on and people started demanding more
> functionality, they just started randomly adding portions of almost-Perl
> until it compiled without too many warnings. I can't think of one single
> reason why anyone would use PHP over Perl, other than "my free web host made
> it available", which is just a made decision made cyclic.
I had a quick look at some PHP code a month or so ago, and some things
about it seemed quite nice, like the way cgi variables are automatically
turned into local variables in the script. Apart from that, I don't know,
as I've not tried coding in it. I'm not sure that mixing code and content
is the best way anyhow - the HTML::Template approach where the two are
kept seperate is more to my taste. And having started writing my web app
like this, it means someone with few coding skills could easily translate
the whole site into another language, or change the layour or whatever,
which is a bonus to this way of doing it.
--
http://www.niftybits.ukfsn.org/
remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.
------------------------------
Date: 9 Feb 2004 11:39:57 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Why is Perl losing ground?
Message-Id: <4027e20d@news.victoria.tc.ca>
Kirk Strauser (kirk@strauser.com) wrote:
: =2D----BEGIN PGP SIGNED MESSAGE-----
: Hash: SHA1
: At 2004-02-09T17:07:32Z, Ben Morrow <usenet@morrow.me.uk> writes:
: > PHP is great for what it was designed for: a simple way to put a small
: > amount of scripting into a basically static HTML page.
: Having used both, though, I honestly don't see what's easier or simpler
: about PHP's syntax. It comes with syntax for embedding logic inside
: presentation, granted, but any number of Perl modules do the same thing.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's at least half the problem. Unlike Java (JSP) or ASP (and what ever
language it uses) or PHP, perl has no _standard_ way to create web pages
in this sort of manner.
Making decisions is a large part of any project.
Working with PHP includes fewer decisions, therefore many people will find
it easier to use.
You see this in other situations. What is easier? Digging a ditch or
planning the drainage in the first place. Digging the ditch is more grunt
work (i.e. PHP) but it's obvious what to do and therefore it's easy for
anyone to do the work. On the other hand, planning the drainage requires
much less labour (i.e. Perl), but ultimately it's a harder job for many
people because it involves making non-obvious decisions.
------------------------------
Date: Tue, 10 Feb 2004 13:41:38 +0000
From: Mb <bagneski@execpc.com>
Subject: Re: Why is Perl losing ground?
Message-Id: <3rci20dtln99bhs316kt9nb8enagbn5e6c@4ax.com>
On Mon, 09 Feb 2004 16:30:09 GMT, Kirk Strauser <kirk@strauser.com>
wrote:
>Yet, somehow, people seem to think PHP is easier. I just don't understand.
I hear ya! Two points:
Since PHP can be embedded so easily in HTML, many web designers find
it quite easy to inch their way into using it, since it sits right
there alongside code they already know.
Also, since PHP can be embedded so easily into HTML, some HTML
Development Apps, like Dreamweaver, have started to incorporate PHP
into their products, so web developers new to PHP can edit from a
familiar interface. I think there are also prefab blocks of PHP
available that they can plug in with no knowledge of how they actually
work.
Both of which make the learning curve practically non-existent, at
least initially. And once you start using a language, and the more
you use it, the more you're likely to keep using it. By the time
these PHP programmers get to the messy, clunky elements, they're
hooked.
Just some speculation here.
Mike
--
Mb / <-==0 @
/ A
/ C3==# / \
------------------------------
Date: Mon, 09 Feb 2004 19:45:05 GMT
From: Kirk Strauser <kirk@strauser.com>
Subject: Re: Why is Perl losing ground?
Message-Id: <87hdy0xcpm.fsf@strauser.com>
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 2004-02-09T19:22:28Z, Andy Baxter <news4@earthsong.null.free-online.co.u=
k> writes:
> I had a quick look at some PHP code a month or so ago, and some things
> about it seemed quite nice, like the way cgi variables are automatically
> turned into local variables in the script.
Note that this was considered a horrible security bug to the point that it's
no longer the default action.
For example, imagine this code snippet in a little-used auxiliary directory
in a widely-used bulletin board system:
$sql =3D 'select * from foo'
$result =3D mysql_query($sgl)
In other words, the author made a typo when he wrote "$sgl" on the second
line. A malicious party realizes the mistake and visits the page with the
query string "?sgl=3Dselect * from usertable". His new "$sgl" variable is
injected into the global namespace of the running script and the
mysql_query() function executes his code instead of the intended line.
Convenient, sure, but one of the more bone-headed language misfeatures I've
seen.
=2D --=20
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAJ+Jy5sRg+Y0CpvERAl5qAKCVhylGyhLNacGoPY7x1y/rvYtbDgCglIDi
iVh7MshDl6zFn3LXWsw+dLw=3D
=3D8Sa9
=2D----END PGP SIGNATURE-----
------------------------------
Date: Mon, 09 Feb 2004 21:28:23 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Why is Perl losing ground?
Message-Id: <Xns948AA792462A2dkwwashere@216.168.3.30>
Kirk Strauser <kirk@strauser.com> wrote:
> At 2004-02-09T19:22:28Z, Andy Baxter
> <news4@earthsong.null.free-online.co.uk> writes:
>
>> I had a quick look at some PHP code a month or so ago, and some things
>> about it seemed quite nice, like the way cgi variables are
>> automatically turned into local variables in the script.
>
> Note that this was considered a horrible security bug to the point that
> it's no longer the default action.
[snip]
> Convenient, sure, but one of the more bone-headed language misfeatures
> I've seen.
The SAS system (sas.com) does something similar. Someone in my first
training class for SAS web programming used a macro variable that was the
same as one of the form parameters. Instant bug and unexpected results.
Even the instructor was puzzled, at least for a few hours.
If you're offered a job using SAS to do web stuff for anything more
complicated than a few predefined queries, run away screaming.
(Side note: I took another SAS "web" class where the instructor
consistently referred to CSS as "cascading spread sheets". By the end of
the class I wanted to strangle her. (that wasn't the /only/ reason))
--
David Wall
------------------------------
Date: Mon, 09 Feb 2004 16:32:59 -0600
From: David Dyer-Bennet <dd-b@dd-b.net>
Subject: Re: Why is Perl losing ground?
Message-Id: <m2ekt3anok.fsf@gw.dd-b.net>
Dominic <roqetman@hotmail.com> writes:
> As a programmer who is addicted to Perl, I am curious as to why Perl
> is losing ground to another bunch of languages, namely: Python, PHP
> and Ruby. I'd like to hear your opinions. Is Perl just not "trendy"
> anymore? Does it still scare programmers who haven't used it? Or do
> the other languages have any major advantages over Perl? I haven't
> worked in these other languages, so I'm not qualified to have much of
> an opinion here. What do you think?
PHP out-performs Perl by a tremendous margin in a shared hosting
environment, which is where most sites are implemented. mod_perl
doesn't isolate the various users enough to be very safe in a shared
hosting environment, and you need mod_perl to get performance.
--
David Dyer-Bennet, <mailto:dd-b@dd-b.net>, <http://www.dd-b.net/dd-b/>
RKBA: <http://noguns-nomoney.com> <http://www.dd-b.net/carry/>
Photos: <dd-b.lighthunters.net> Snapshots: <www.dd-b.net/dd-b/SnapshotAlbum/>
Dragaera/Steven Brust: <http://dragaera.info/>
------------------------------
Date: Mon, 09 Feb 2004 22:35:28 GMT
From: "Ian.H" <ian@WINDOZEdigiserv.net>
Subject: Re: Why is Perl losing ground?
Message-Id: <pan.2004.02.09.22.35.27.567778@hybris.digiserv.net>
On Mon, 09 Feb 2004 19:45:05 +0000, Kirk Strauser wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> At 2004-02-09T19:22:28Z, Andy Baxter
> <news4@earthsong.null.free-online.co.uk> writes:
>
>> I had a quick look at some PHP code a month or so ago, and some things
>> about it seemed quite nice, like the way cgi variables are automatically
>> turned into local variables in the script.
>
> Note that this was considered a horrible security bug to the point that
> it's no longer the default action.
>
> For example, imagine this code snippet in a little-used auxiliary
> directory in a widely-used bulletin board system:
>
> $sql = 'select * from foo'
> $result = mysql_query($sgl)
>
> In other words, the author made a typo when he wrote "$sgl" on the second
> line. A malicious party realizes the mistake and visits the page with the
> query string "?sgl=select * from usertable". His new "$sgl" variable is
> injected into the global namespace of the running script and the
> mysql_query() function executes his code instead of the intended line.
>
> Convenient, sure, but one of the more bone-headed language misfeatures
> I've seen.
This was fixed as a "default setting" since 4.2.0 under the
'register_globals' setting. "SuperGlobals" now have to be accessed instead:
$_GET['foo']
$_POST['foo']
$_SESSION['foo']
$_COOKIE['foo']
$_FILES['foo']
$_SERVER['foo']
etc. This prevents the example you provide above for the very reasons you
give.
It did have an old method for the same ($HTTP_GET_VARS['foo'] etc) but the
most common method was just to use '$foo'.
I found PHP much easier than Perl for Web development, but I had only been
looking at Perl on and off for about 6 months at the time (didn't know
about CPAN etc at the time.. and think cgi_lib.pl was still "the
standard"). I still develop in PHP for the Web, but anything system-wise
is always coded in Perl (I don't know C / C++ to any lengths, so Perl
often replaces things that C might for other coders) and writing another
Perl/Tk app "for fun". I like both languages for different tasks.
PHP is horribly flawed in many things but it serves it's purpose well (as
an "easy Web scripting language").. even if it is a bit "kludgy" for some
things =)
Regards,
Ian
--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
------------------------------
Date: Mon, 09 Feb 2004 22:41:46 GMT
From: "Ian.H" <ian@WINDOZEdigiserv.net>
Subject: Re: Why is Perl losing ground?
Message-Id: <pan.2004.02.09.22.41.45.672308@hybris.digiserv.net>
On Tue, 10 Feb 2004 13:41:38 +0000, Mb wrote:
> And once you start using a language, and the more you use it,
> the more you're likely to keep using it. By the time these PHP
> programmers get to the messy, clunky elements, they're hooked.
>
> Just some speculation here.
Heh.. I can back this theory up =)
About 6 years ago I started to try and learn Perl (was initially trying to
write my own guestbook.. woohoo!). I stumbled across PHP... I don't
remember how and tried it out. It was _much_ easier with many built in
functions already (I wasn't really aware of the great CPAN resource back
then).
To this day, 99.99% of my Web development work is coded in PHP (and Smarty
for a templating engine where applicable) much because as you "speculate",
I got hooked. I could code simple PHP "applications" with easy with a
small learning curve. This escalated pretty quickly and now involve such
things as content management systems etc. I guess had I not found PHP when
I did, I'd be doing the self same thing in Perl right now (I played with
ASP too, but was quickly dismissed as a bad joke).
PHP will never overtake my usage of Perl for system scripting or the few
GUIs I have coded with Perl/(G)Tk.. but I fell into the PHP track fro the
Web side of things a long time ago. Maybe I'll change that some day, there
are many things I prefer about Perl, and many things I prefer about PHP..
I tend to see it as "the right tool for the right job for me at the time".
Regards,
Ian
--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
------------------------------
Date: 09 Feb 2004 22:52:38 +0000
From: lesley.b@zen.co.yuk
Subject: Re: Why is Perl losing ground?
Message-Id: <m3bro7n9vt.fsf@linux.local>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:
> Kirk Strauser (kirk@strauser.com) wrote:
> : =2D----BEGIN PGP SIGNED MESSAGE-----
> : Hash: SHA1
>
> : At 2004-02-09T17:07:32Z, Ben Morrow <usenet@morrow.me.uk> writes:
>
> : > PHP is great for what it was designed for: a simple way to put a small
> : > amount of scripting into a basically static HTML page.
>
> : Having used both, though, I honestly don't see what's easier or simpler
> : about PHP's syntax. It comes with syntax for embedding logic inside
> : presentation, granted, but any number of Perl modules do the same thing.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> That's at least half the problem. Unlike Java (JSP) or ASP (and what ever
> language it uses) or PHP, perl has no _standard_ way to create web pages
> in this sort of manner.
>
> Making decisions is a large part of any project.
>
> Working with PHP includes fewer decisions, therefore many people will find
> it easier to use.
>
> You see this in other situations. What is easier? Digging a ditch or
> planning the drainage in the first place. Digging the ditch is more grunt
> work (i.e. PHP) but it's obvious what to do and therefore it's easy for
> anyone to do the work. On the other hand, planning the drainage requires
> much less labour (i.e. Perl), but ultimately it's a harder job for many
> people because it involves making non-obvious decisions.
Best argument I have heard yet.
I am not 'up' on PHP at all but I've just bought a book on PHP and web
development and delved into parts of the first chapter.
To me, PHP looks like a scripting version of Perl in the same way ASP
is a scripting version of VB. This is obvioulsy a huge generalisation
and I'll freely admit, would probably hold less water than a colander
if put seriously to the test.
Lesley
---
email is munged: please reply to group
------------------------------
Date: 9 Feb 2004 21:45:21 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Why references??
Message-Id: <c08v1h$p3l$1@canopus.cc.umanitoba.ca>
In article <c08eug$ml5$3@wisteria.csv.warwick.ac.uk>,
Ben Morrow <usenet@morrow.me.uk> wrote:
:roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
:> perl, though, implicitly passes a reference if possible, and
:> otherwise passes by value.
:Eh what? Perl always passes aliases into @_, and the standard idiom
:of
:my ($a, $b) = @_;
:then makes copies. What's implicit about that?
It is implicit compared to (say) Pascal's "VAR" notation, or even
compared to C's (type *) notation. The closest, I guess, would
be FORTRAN's behaviour.
I've had a number of practically untracable bugs, with values
used in one subroutine suddenly reappearing in the next subroutine
down -- even though the calling routine has the right value for
the parameter. I eventually decided it was happening mostly in places
I was using the (shift) idiom, and re-wrote all of those.
[I -think- I also had it happen a few times where I used my $var = $_[0]
but I'm not positive about that.] Looking back over the documentation
of shift, it seems to me that it must be the case that shift preserves
the property of being an alias, and that for my $var = shift
that $var ends up an alias to the parameter passed down. That's
certainly not explicit behaviour.
--
"Mathematics? I speak it like a native." -- Spike Milligan
------------------------------
Date: 9 Feb 2004 14:14:33 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Why references??
Message-Id: <40280649@news.victoria.tc.ca>
Thomas Deschepper (thomas.deschepper.ecol@sintjozefscollege.be) wrote:
: I've been reading Beginning Per & Programming Perl from O'Reilly for some time
: now and I'm getting used to references and how to grow them..
: But why would someone use a reference if they can use a normal variable? Yeah, I
: know, with references you can grow complex data structures, but in simple
: programs, why would you use them (=references)?
Style. (?)
I suspect that someone who uses a lot of references feels comfortable
with the syntax and may use them even when they are not needed.
I prefer
$my_hash{$item}
but someone else might prefer
$my_hash->{$item}
It makes no difference to the interpreter, so use which ever style you
prefer (they are different of course, it just doesn't _make_ any
difference).
If the program has other references (that are needed) that using
references everywhere might also make the program more consistent,
stylisticly.
$myhash1->{$item}
$myhash2->{$item}
$myhash3{$item} # huh, why is this different?
------------------------------
Date: Mon, 9 Feb 2004 22:24:12 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Why references??
Message-Id: <c091ac$6db$1@wisteria.csv.warwick.ac.uk>
roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
> In article <c08eug$ml5$3@wisteria.csv.warwick.ac.uk>,
> Ben Morrow <usenet@morrow.me.uk> wrote:
>
> :roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
> :> perl, though, implicitly passes a reference if possible, and
> :> otherwise passes by value.
>
> :Eh what? Perl always passes aliases into @_, and the standard idiom
> :of
>
> :my ($a, $b) = @_;
>
> :then makes copies. What's implicit about that?
>
> It is implicit compared to (say) Pascal's "VAR" notation, or even
> compared to C's (type *) notation. The closest, I guess, would
> be FORTRAN's behaviour.
>
> I've had a number of practically untracable bugs, with values
> used in one subroutine suddenly reappearing in the next subroutine
> down -- even though the calling routine has the right value for
> the parameter. I eventually decided it was happening mostly in places
> I was using the (shift) idiom, and re-wrote all of those.
> [I -think- I also had it happen a few times where I used my $var = $_[0]
> but I'm not positive about that.] Looking back over the documentation
> of shift, it seems to me that it must be the case that shift preserves
> the property of being an alias, and that for my $var = shift
> that $var ends up an alias to the parameter passed down. That's
> certainly not explicit behaviour.
No, you've got something wrong somewhere, or you're calling subs with
&.
perl -le'sub a { my $x = shift; $x++ } my $y = 1; a $y; print $y'
1
perl -le'sub a { my $x = $_[0]; $x++ } my $y = 1; a $y; print $y'
1
perl -le'sub a { $_[0]++ } my $y = 1; a $y; print $y'
2
You only get aliasing if you explicitly manipulate $_[n]. Even so, I
agree it's rarely useful now we have prototypes. Perl6 will make @_
contain *readonly* aliases by default, so $_[0]++ will give a run-time
error.
Ben
--
"If a book is worth reading when you are six, * ben@morrow.me.uk
it is worth reading when you are sixty." - C.S.Lewis
------------------------------
Date: Mon, 9 Feb 2004 17:25:36 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Why references??
Message-Id: <Pine.A41.4.58.0402091714030.29592@ginger.libs.uga.edu>
On Mon, 9 Feb 2004, Walter Roberson wrote:
> Looking back over the documentation of shift, it seems to me that it
> must be the case that shift preserves the property of being an alias,
> and that for my $var = shift that $var ends up an alias to the parameter
> passed down. That's certainly not explicit behaviour.
That's also not what it does. :-) It says the opposite in the first line
of the documentation:
shift ARRAY
shift
Shifts the first value of the array off and returns it, ...
This is fairly easy to verify:
sub by_ref { \$_[0] }
sub by_assign1 { my( $x ) = @_; \$x; }
sub by_assign2 { my $x = $_[0]; \$x; }
sub by_shift { my $x = shift; \$x; }
my $y = 'test';
print "itself: ",\$y,"\n\n";
print "by_ref: @{[by_ref ( $y )]}\n";
print "by_assign1: @{[by_assign1( $y )]}\n";
print "by_assign2: @{[by_assign2( $y )]}\n";
print "by_shift: @{[by_shift ( $y )]}\n";
__END__
itself: SCALAR(0x106480)
by_ref: SCALAR(0x106480)
by_assign1: SCALAR(0x106540)
by_assign2: SCALAR(0x126f5c)
by_shift: SCALAR(0x126e90)
So you can see that with shift, the variable doesn't end up as an alias
any more than with any of the other assignments. They all copy values--and
pretty explicitly, it seems to me.
Regards,
Brad
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V10 Issue 6102
***************************************