[13088] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 498 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 06:07:13 1999

Date: Fri, 13 Aug 1999 03:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 13 Aug 1999     Volume: 9 Number: 498

Today's topics:
    Re: A CGI/Perl Question (elephant)
    Re: A CGI/Perl Question <pat4b@hongkong.com>
    Re: A CGI/Perl Question (Andreas Fehr)
    Re: Fastest form of an 'if' <andrewf@beausys.freeserve.co.uk>
    Re: HELP apache,perl and win98 <rhrh@hotmail.com>
        HELP, I need a script. dodli@my-deja.com
    Re: HTML editing (elephant)
    Re: Looking for a solution to the problem localtime and <cassell@mail.cor.epa.gov>
    Re: Looking for a solution to the problem localtime and (I.J. Garlick)
    Re: My attempt at perl poetry <cassell@mail.cor.epa.gov>
        Network Socket Programming. <steve@ladram.demon.co.uk>
    Re: Network Socket Programming. <carvdawg@patriot.net>
        Omaha Perl Mongers - Next Meeting <ptimmins@itd.sterling.com>
        Please help, DBI : statement handler amita_rohatgi@my-deja.com
    Re: Problem Connecting To a remote database <nikos@biznet.com.gr>
    Re: Starnge DBI behavior <rhrh@hotmail.com>
    Re: suggestions for CRAP silver_@bellsouth.net
        tree structure <m.masouras@on-board-info.com>
    Re: Why use Perl when we've got Python?! <I.Clarke@NOSPAM.strs.co.uk>
    Re: Why use Perl when we've got Python?! <I.Clarke@NOSPAM.strs.co.uk>
    Re: Why use Perl when we've got Python?! <I.Clarke@NOSPAM.strs.co.uk>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 13 Aug 1999 17:03:50 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: A CGI/Perl Question
Message-Id: <MPG.121e6e63344e9f81989c20@news-server>

Abigail writes ..
>Patrick (pat4b@hongkong.com) wrote on MMCLXXIII September MCMXCIII in
><URL:news:7p07ps$3li$1@imsp009a.netvigator.com>:
>## What command should I use to get the variable , which store the URL from
>## which I came from?  (from where,th URL , to the CGI script)
>
>
>I'd use pen and paper, and write down the URL before you leave.

I hope I'm not the only one who reads Abigail's responses just to make 
themselves giggle .. this one's a classic

you're in fine form today Abigail

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Fri, 13 Aug 1999 17:07:09 +0800
From: "Patrick" <pat4b@hongkong.com>
Subject: Re: A CGI/Perl Question
Message-Id: <7p0nic$qmn$1@imsp009a.netvigator.com>

Can Jody Fedor send message to my email box, because my computer cannot open
your message , thanks.
dbs2pat@netvigator.com
Patrick




------------------------------

Date: Fri, 13 Aug 1999 10:01:58 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: A CGI/Perl Question
Message-Id: <37b3ec99.16750876@news.uniplus.ch>

On Fri, 13 Aug 1999 17:03:50 +1000, elephant@squirrelgroup.com
(elephant) wrote:

>>
>>I'd use pen and paper, and write down the URL before you leave.
>
>I hope I'm not the only one who reads Abigail's responses just to make 
>themselves giggle .. this one's a classic
>
>you're in fine form today Abigail

Yes, but I think the best one is the Dutch/German/English Signature.

Andreas


------------------------------

Date: Fri, 13 Aug 1999 10:24:35 +0100
From: Andrew Fry <andrewf@beausys.freeserve.co.uk>
Subject: Re: Fastest form of an 'if'
Message-Id: <+onwfJATR+s3EwAu@beausys.freeserve.co.uk>

In article <slrn7r79p4.e7v.abigail@alexandra.delanet.com>, Abigail
<abigail@delanet.com> writes
>Andrew Fry (andrewf@beausys.freeserve.co.uk) wrote on MMCLXXI September
>MCMXCIII in <URL:news:gIL3XCAjNes3EwAE@beausys.freeserve.co.uk>:
>{} Which of these 3 forms of 'if a then b' is faster ?...
>{} 1.  if (a) { b; }
>{} 2.  b if (a);
>{} 3.  a && b;
>{} ... or isnt there enough in it to worry about ?
>
>If you are kept awake at nights worrying about such things, consider
>removing Perl from your system, and start using C, or perhaps assembler.
>
>Abigail

What a bloody stupid remark. Up to your usual standard.

I was just curious, that's all.

---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).


------------------------------

Date: Fri, 13 Aug 1999 08:54:59 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: HELP apache,perl and win98
Message-Id: <37B3CF53.8CB1B5F9@hotmail.com>

joe lee wrote:
> 
> Hi all
> 
> complete beginner, please excuse my lack of know how.
> 
> i've been trying to install apache/activestate perl
> to start learning about cgi from the file at :
> http://www.egovision.com/htmlresources/articles/apache_win32.html
> 
> however i can't seem to get the thing to work !
> 
> ive followed it word for word and can execute the perl interpreter
> successfully with a script from the prompt
> (i.e perl C:\apache\cgi-bin\test.pl)
> , but can't seem to print it out to a html page. everytime i do try
> it runs a window and flashes by me in a window ?!?!

whereabouts??

ie what sort of window, browser or DOS prompt?
maybe remove the association on your PC for the .pl file and associate
 .pl files with wordpad or something? so you can run your scripts from
the command prompt only

<snip>

> Joe Lee - Bromley, Kent
> please delete the REMOV from the addy to respond
> joelee@softhome.netREMOV

You have put the script in the cgi-bin that apache provides??

and you are trying to access it through your browser and not by double
clicking on the icon in explorer??

HTH

Richard H


------------------------------

Date: Fri, 13 Aug 1999 08:49:44 GMT
From: dodli@my-deja.com
Subject: HELP, I need a script.
Message-Id: <7p0m77$ipe$1@nnrp1.deja.com>

Hello, I am looking for a free perl script that
allows a user to make text updates to an existing
portion of an html page.
Thanks


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Fri, 13 Aug 1999 17:06:51 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: HTML editing
Message-Id: <MPG.121e6f18cd257c24989c21@news-server>

xbruno8778@my-deja.com writes ..
>Hy, my name is Bruno Lucas and I work with
>electronic publishing.
>I am working in a program in PERL to search for
>determined tags in a HTML file and insert a block
>of text bellow the line where the tag is placed.
>this block is in another html file.
>I have done an program that find and insert or
>find and pull out tags from a line, but I am
>having a hard time to find a tag and insert a
>whole file bellow it. If you need to take a look
>on my old programs, send me an e-mail and I will
>send it to you.

do you have a question ? .. or have you mistaken this forum for a 
personal introduction service and think that having trouble with your 
Perl code is an attractive asset ?

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Fri, 13 Aug 1999 00:17:45 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <37B3C699.AC3A38E8@mail.cor.epa.gov>

Jack Alexander wrote:
> 
> Hi all,
>     I use Perl 5.0 42 on Windows NT and UNIX. I'm looking for a solution to
> the problem of localtime only returning a year value (99) and not a century
> value (19 -or- 20).
> 
> Can anyone help?

Yes.  Almost *anyone* can help on this one.  If you look in 
the Perl FAQ, or the perlfunc section, or the archives of this
newsgroup, or a bunch of other places, you would see that
localtime() returns not a year at all, but an offset from
1900.  So, whatever number you get, you add 1900 to it and
get a year value.  Just like the C struct tm.

BTW, you *did* notice that the year is not the only variable
returned by localtime which is an offset instead of a count?

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Fri, 13 Aug 1999 09:17:46 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <FGECHM.3DH@csc.liv.ac.uk>

In article <slrn7r7fjq.e7v.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) writes:
> Yeah. Bummer. localtime is so broken. It doesn't return centuries, so
> it will fail after Jan 1, and its months have been off by 1 as well.
> 
> I use:
> 
>      my $century = $year > 50 ? 19 : 20;

That's evil abigail. Poor bum will never get 20 in front of any current
date. The more I think about that one the more evil I think it is. :-)

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Real Users hate Real Programmers.



------------------------------

Date: Fri, 13 Aug 1999 00:11:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: My attempt at perl poetry
Message-Id: <37B3C529.2BF30A9A@mail.cor.epa.gov>

Ct60 wrote:
> 
> Dan-
> 
> The poetry is not exactly T.S. Elliot,

Neither is T.S. Eliot [one 'l'].

Another Tom with eclectic tastes and a flair for the pedantic.
Hmmmm...

>                                        but it is extremely amusing
 
I liked it too.

David, who asks: "Dare I eat a peach?"
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Fri, 13 Aug 1999 08:35:34 +0100
From: "Steve Horseman" <steve@ladram.demon.co.uk>
Subject: Network Socket Programming.
Message-Id: <37b3ca8f.0@nnrp1.news.uk.psi.net>

Hi All,

    I am wrting a Client in Perl to read data that is sent back from a
server.
    the data is in the following format...

    2 bytes message_type
    2 bytes message_length
    X bytes message_data.

    the message_length variable contains the length of the message_data.

    The problem i appear to have is that the a read to the socket, only
reads up to the first
    OA byte.  I am obviously doing some sort of  "blocked read".

    I can find no way of doing an "unblocked" read, that will read the
complete data,
    index up the data with message length.....

Sample of the code

#
# include the socket package
#
use IO::Socket;
#
# open the socket
#
$socket = IO::Socket::INET->new(Proto=>"tcp",
PeerAddr=>$hostname, PeerPort=>$control_port, Reuse=>1)
    or die "Can't open socket on $hostname\n";
#
# Send some data
#
$command = pack("nnnn",$msg_type,$msg_len);    # create command to be sent
print $reflector $command;


 Anybody got any clues..... !!!!!


Steve






------------------------------

Date: Fri, 13 Aug 1999 05:35:05 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Network Socket Programming.
Message-Id: <37B3E6C9.163EE653@patriot.net>

Two things to consider, Steve...

1.  Below, what is "$reflector"?

2.  You're trying to manipulate sockets on a Win32 os...

Steve Horseman wrote:

> Hi All,
>
>     I am wrting a Client in Perl to read data that is sent back from a
> server.
>     the data is in the following format...
>
>     2 bytes message_type
>     2 bytes message_length
>     X bytes message_data.
>
>     the message_length variable contains the length of the message_data.
>
>     The problem i appear to have is that the a read to the socket, only
> reads up to the first
>     OA byte.  I am obviously doing some sort of  "blocked read".
>
>     I can find no way of doing an "unblocked" read, that will read the
> complete data,
>     index up the data with message length.....
>
> Sample of the code
>
> #
> # include the socket package
> #
> use IO::Socket;
> #
> # open the socket
> #
> $socket = IO::Socket::INET->new(Proto=>"tcp",
> PeerAddr=>$hostname, PeerPort=>$control_port, Reuse=>1)
>     or die "Can't open socket on $hostname\n";
> #
> # Send some data
> #
> $command = pack("nnnn",$msg_type,$msg_len);    # create command to be sent
> print $reflector $command;
>
>  Anybody got any clues..... !!!!!
>
> Steve



------------------------------

Date: Fri, 13 Aug 1999 08:48:09 GMT
From: Patrick Timmins <ptimmins@itd.sterling.com>
Subject: Omaha Perl Mongers - Next Meeting
Message-Id: <7p0m48$ip6$1@nnrp1.deja.com>

The Omaha Perl Mongers will have their next meeting
at 6:30 pm on Monday, August 16, 1999 at CSG Systems
near 117th and Blondo. Matt Payne will be giving a
presentation on the CGI.pm module.

See http://omaha.pm.org/ and
http://www.novia.net/~payne/pm/ for more details.

Come on and geek-out!

Pat
--
$monger{Omaha}[0]
Patrick Timmins
ptimmins@itd.sterling.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Fri, 13 Aug 1999 09:13:37 GMT
From: amita_rohatgi@my-deja.com
To: amitar@ampercorp.com
Subject: Please help, DBI : statement handler
Message-Id: <7p0nju$jod$1@nnrp1.deja.com>

Hi,

I am executing the following piece of code which is a part of my
program accessing the Oracle database.
This code fetches only one id from the table though there are five ids
it should fetch.


$sth3 = $dbh->prepare(q(select id from table where (name = ?)))  || die
$dbh->errstr;

@arr = split(/,/,$scalar);
foreach $item(@arr){
  print"The cities are @arr\<BR\>";  //outputs the names of 5 cities
  $sth3->execute($item) || die $sth3->errstr;
  while( @id= $sth3->fetchrow()) {
     print "Channel ID is : @id\<BR\>";  //output only one id
  }
  sth3->finish();
}


die $sth3->errstr if $sth3->err;


But when I hardcode the values of  name in the array like this
@arr = ("Sanjose", "SantaClara", "Sunnyvale", "Fremont", "Cupertino");
I get all the five ids of the cities from the table. Please help.



Regards,
Amita




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Fri, 13 Aug 1999 10:11:48 +0300
From: Nikos Mavrogiannakis <nikos@biznet.com.gr>
Subject: Re: Problem Connecting To a remote database
Message-Id: <37B3C534.6C046548@biznet.com.gr>



David Cassell wrote:

> Without seeing a small, illustrative example of your code [no
> more than 30 lines], it is pretty hard to tell what is wrong.
>
> But my copy of the PSI::ESP module says.. umm...  Hmmm.  Are
> you trying to access your file via the web as if you were
> accessing a normal file in a local directory?  You have to
> use the HTTP protocol to get at files over an intranet, just
> like you do over the internet.
>
> David
> --
> David Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician

  The script is called after a form is submitted in an html page. So I use the
HTTP.
It seems to work as far as conncerns perl cuase I tried to connect to a local
MS Access database using the same same script and it worked. I still cannot
connect to a remote database only through World Wide Web.
Here is a small piece of my source code but I don't know if this would be
useful:

#Define database and SQL command
$dsn = "ministry.dsn";
$values[0]="21787";
$sql = "SELECT * FROM ydweb WHERE PROTOC_NO=$values[0]"; #WHERE
PAYEE_CD='$values[0]'   ORDER BY PAYEE_CD;";

print "\ndebug1\n";

#connect to database
   $db = new Win32::ODBC("dsn=ministry;UID=macweb;PWD=macweb");
 carp("Error !!") if ! $db;

print "\ndebug2\n";

   $db->Sql($sql);

print "\ndebug3\n";

   while ($db->FetchRow()) {
      $count = $count + 1;


      ($c_id, $protoc, $trn_no, $trn_dt, $name, $bank, $transf, $trn_amn,
$reas) =
   $db->Data("PAYEE_CD", "PROTOC_NO", "TRN_NO", "TRN_DT", "PAYEE_NM",
             "BANK_NM","TRANSF_NM", "TRN_AMN", "REAS_DSCR");

      if ($count == 1) {

   print"Όνομα Δικαιούχου  : <B>$name</B>.<p>";
         print"<table border=1 width=550>";
      print "<tr>\n";
    print "<td width=50><font face=\"Arial Greek\" size=\"-2\"><B>Αρ.
Πρωτ.</B></font></td>\n";
    print "<td width=60><font face=\"Arial Greek\" size=\"-2\"><B>Αρ.
Εντολής</B></font></td>\n";
   print "<td width=50><font face=\"Arial Greek\"
size=\"-2\"><B>Ημ/νία</B></font></td>\n";
         print "<td width=60><font face=\"Arial Greek\"
size=\"-2\"><B>Τράπεζα</B></font></td>\n";
   print "<td width=50><font face=\"Arial Greek\"
size=\"-2\"><B>Εκδοχέας</B></font></td>\n";
      print "<td width=60><font face=\"Arial Greek\"
size=\"-2\"><B>ΠΟΣΟΝ</B></font></td>\n";
      print "<td width=220><font face=\"Arial Greek\"
size=\"-2\"><B>Αιτιολογία</B></font></td></tr>\n";;
   }

      print "<tr>\n";
   print "<td valign=top nowrap><font face=\"Arial Greek\"
size=\"-2\">$protoc</font></td>\n";
   print "<td valign=top nowrap><font face=\"Arial Greek\"
size=\"-2\">$trn_no</font></td>\n";
   print "<td valign=top><font face=\"Arial Greek\"
size=\"-2\">$trn_dt</font></td>\n";
      print "<td valign=top><font face=\"Arial Greek\"
size=\"-2\">$bank</font></td>\n";
   print "<td valign=top><font face=\"Arial Greek\"
size=\"-2\">$transf</font></td>\n";
   print "<td valign=top nowrap><font face=\"Arial Greek\"
size=\"-2\"><B>$trn_amn</B></font></td>\n";
   print "<td valign=top><font face=\"Arial Greek\"
size=\"-2\">$reas</font></td></tr>\n";
   }

   $db->Close();




------------------------------

Date: Fri, 13 Aug 1999 08:48:19 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Starnge DBI behavior
Message-Id: <37B3CDC3.1A28C6C5@hotmail.com>

Eric Bohlman wrote:
> 
> Unless the documentation for a function that returns a reference states
> that it will return a unique reference on each call, you really can't
> assume that you can just squirrel away its return value.  You should make
> your own copy of what it references and store a reference to *that*.

sort of like?? :

while($aref = $sth->fetchrow_arrayref) {
    my @ary1 = @$aref;
    push (@array1, \@ary1);
}

but is there a more efficient way of doing the above??

thanks

Richard H


------------------------------

Date: Fri, 13 Aug 1999 02:06:32 -0500
From: silver_@bellsouth.net
Subject: Re: suggestions for CRAP
Message-Id: <37B3C3F7.9ABCC13E@bellsouth.net>

I have been "lurking" in this ng for close to two years. As a newbie, I have
found some very useful information here. I have also found some of the most
arrogant people that I have ever came across in my life. Publicly criticizing
someone else's work is "to have a room temp iq."
    When I first started trying to teach myself perl I used some of Matts
scripts as tools. I have also studied several modules in my attempt to learn. I
am not blessed to have my own server so I must use the "web hotels." What Dr.
Who wrote concerning the missing perl modules is true. I have resorted to
installing some of them locally in my own web space.
I learned how to install them by studying the post in this ng.
    This is my very first post to this ng. One reason is because I can search
DejaNews and find answers for 90% of my questions. The only problem with
searching this ng is sifting through all the useless replies. Lets say I am
searching for help using a module, I will have to read twenty replies to some
other poor souls question. Most of them go something like this:

RE: Newbie question about a module
>At 10:.........Dumb newbie wrote:
>Could someone PLEASE tell me what module I should use for bla bla bla
 .................
>I have been working on this script for two days and nights. My wife left me,
took the kids and told me that I can sleep >with my computer. I can't take it
any longer, if I don't find an answer to my question soon I am going to go buy
a gun and >start shooting people at random. PLEASE HELP
At 11:........Mr. Iknow Every Thing wrote:
Well you stupid dumb newbie if you would have read the 50000 pages of FAQs you
would know the answer.
This is comp.lang.perl.misc anyway this group has nothing to do with what you
are asking.
Go get on someone else's nerves

RE: RE: Newbie question about a module
>At 10:.........Dumb newbie wrote:
>Could someone PLEASE tell me what module I should use for bla bla bla
 .................
>I have been working on this script for two days and nights. My wife left me,
took the kids and told me that I can sleep
At 12:...........Iam A PerlMaster wrote:

What a cry baby why don't you get a life. We only use this ng for important
programming stuff not dumb questions from newbies like you.

>At 11:........Mr. Iknow Every Thing wrote:
>Well you stupid dumb newbie if you would have read the 50000 pages of FAQs you
would know the answer.
>This is comp.lang.perl.misc anyway this group has nothing to do with what you
are asking.
>Go get on someone elses nerves
I agree with you Mr. Iknow Every Thing what is this ng coming to? These newbies
never read the FAQs. One would think that the FAQs where full of all kinds of
technical jargon or something! Why do they just insist on WASTING the ngs time
on this crap! What about that ball game last night? Boy that was a great game
was it not? Well I better go now there has got to be some other newbie out
there that I can insult.

RE: RE: RE: Newbie question about a module
At 12:.........I Donthave Alife wrote:

Why are all the free cgi sites full of crappy code?
 These room temp I.Q, no-good don't know how to use a module, buck-teeth,
back-woods, bare-foot,  Donald Duck wana-be's keep getting more popular all the
time. I think we should start a web site to give away perl scripts that are
written with only perfect code. Look at this code, this non module user can do
things that I use a module for. He uses too many comments in some places then
in others he uses none. What's the world coming to when people don't comment
their code??????? I always comment mine, that's what makes GREAT code - modules
and comments! Oh yea, one must always check first for the existence of a file
before opening it. I ALWAYS DO THAT - that's what separates US from that bunch
of non-file-checkers! Well, that and OUR heads are REAL big. So lets set around
and talk about starting a web site to give away OUR FINE perl scripts. I bet
the general population could benefit from some good old module users like us.
That Matt has tons of people using his CRAP scripts and we are just setting
here FULL OF CRAP. Our CRAP is better than his CRAP - that non-module-useing,
non-file-checking, non-commenting, egg-sucking, full of crappy code, room temp
I.Q, non-cgi.pm using, lack of strict OR -w coding, initialized AND then
assigned variable writing, crap cgi parsing, lower case filehandle using, dumb
stuff doing, whole file slurping, potential loop writing, moron coding,
backwhacked, bare-foot, embarrassing perl writer has EVERYONE using his scripts

I Donthave Alife


Hi, it's me,
I bet you think I wasted system resources or something with that message. Well
that's nothing compared to the stuff that I have sifted through in the last
couple of years. Well I must say thanks for the help that I HAVE received from
this ng. THANKS. I will continue to try and learn better code as I lurk and
learn. I must also say thanks to Matt for all the help that I have received
from him through the use of his scripts. I will continue to sell my scripts for
what they will bring no matter how CRAPPY they are written, ha ha ha ha ha ha
ha ha.
I Write Crappy Perl Code For Money






    I am sure
matthew michael wright wrote:

> Abigail <abigail@delanet.com> wrote:
> : And although IANAL, I can easily imagine that if Matt Wright gets ticked
> : off, a bunch of lawyers will have a field day.
>
> Nah, it takes a lot to tick me off.  Even the oh-so-nice musings of purl
> on topics related to my name and sites don't upset me.
>
> I like the project's goal and think that it will be good for both users
> of my stuf--errr... CRAP, and myself.
>
> Matt
>
> --
> --------------------
> Matt Wright     (mmwright@students.uiuc.edu)     http://www.mattwright.com/





------------------------------

Date: Fri, 13 Aug 1999 10:13:40 +0100
From: "Michael Masouras" <m.masouras@on-board-info.com>
Subject: tree structure
Message-Id: <934535498.6244.0.nnrp-13.c29fdfa7@news.demon.co.uk>

I have a table that represents a tree structure. The table is dynamic and
there is no limit on the levels it can have.

It looks like this:

1    2
2    9
9    4

If I have this in an array, how can I get all the relevant parents of a
child?
(e.g. I have $x = 4, how can I get 1, 2,9, 4)?

Thanks

Michael




------------------------------

Date: Fri, 13 Aug 1999 09:09:22 +0100
From: Ian Clarke <I.Clarke@NOSPAM.strs.co.uk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B3D2B2.6ECBC1F2@NOSPAM.strs.co.uk>


> Part of the blame for that may go to your choice of Subject header.  It
> practically screams 'ADVOCACY TROLL', and primes the reader to expect an
> attack on Perl.  Something like 'Help me evaluate Perl from a Python
> perspective' might have been better.

Perhaps, it has been my experience with Usenet that understatement
rarely attracts attention.  In a way I did want people to defend Perl,
so that I could see what they perceived to be Perl's benefits.

Ian.


------------------------------

Date: Fri, 13 Aug 1999 09:12:58 +0100
From: Ian Clarke <I.Clarke@NOSPAM.strs.co.uk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B3D38A.571A6718@NOSPAM.strs.co.uk>

> This isn't the way to learn, you know.  You'll only get people
> disagreeing with you, and then you'll disagree back, and you'll
> never learn anything.  Conflict will not bring understanding.

I agree that conflict won't bring understanding, but I was hoping that
people familiar with the language could explain what is good about Perl,
without trying to start a conflict.  It is strange that you launch
straight into a nit-picking attack of Python's syntax, seemingly
designed to provoke exactly the type of debate that, by your own
admission, is of no benefit.  I will not rise to the bait, except to say
that I initially applied equal amounts of time to trying to learn Perl
and Python, but ended up getting nowhere with Perl, but becomming
increasingly fond of Python.  How many people can claim to have started
using Python, and then, of their own free will, migrated to Perl? (And
if you are such a person, could you please tell my why - as this would
be an answer to my initial question!).

> This smells very much of a Pascal programmer levelling criticism on a C
> programmer because C allows you to have unbounded pointers, type casts,
> and unchecked arrays.  The complaint was always "but think of how long
> it takes you debugging those core dumps!"

Perhaps, but just because this argument has been used before does not
render it incorrect.

Anyway, while I appreciate the list of pet-gripes that you have with
Python (none of which I ever had a problem with, but maybe that's just
me), you are missing the point of my post.  You have replied to my post
as if it were an attack on Perl, which was not my intention.  My
intention is to find out what features Perl has that Python doesn't, and
why I might want to use Perl when we have Python?

> When you hear non-Python programmers complaining of what they see in
> Python as stupid or wrong or ugly or backward-seeming, you will be quick
> to point out underlying reasons such as those listed above.  But I doubt,
> however, that you have yourself ever analysed how your *own* adverse
> reactions to C or Perl are elicited by the same unconscious prejudices and
> bigotries as irritate you when they are applied by others toward Python.

On the contrary, as you notice I have not bothered to respond to your
criticisms of Python - there are others who could do this much better
than I.  Perhaps I did find Perl's syntax unfriendly when I was first to
exposed to it, however I certainly wouldn't go so far as to describe
myself as prejudiced or a bigot!  You are clearly familiar with both
languages, so perhaps you could provide me with a useful comparison,
rather than participating in exactly the kind of nit-picking that you
seem to dislike.

Ian.


------------------------------

Date: Fri, 13 Aug 1999 09:49:06 +0100
From: Ian Clarke <I.Clarke@NOSPAM.strs.co.uk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B3DC02.C9DDB210@NOSPAM.strs.co.uk>

Well, I am glad that there are now two people [Tom/Michael] who are
truly capable of highlighting the advantages and disadvantages of both
languages (and keeping the other in check) contributing to this.  Both
of your comments have been most instructive, in that judging by the
obscurity of the examples that are required to demonstrate 'flaws' in
either language, it seems there isn't much difference between the two!

I have, however, noticed a difference in perspective, which probably
typifies a split in opinion going through most of computer science.  The
Python advocate is willing to tolerate limits placed on what they can do
and write if it means that it makes code more readable for others, and
other's code more readable to them (trusting Guido to make intelligent
decisions on their behalf).  The Perl advocate feels that if the
language could have a given feature, then it should. They have no time
for anyone to tell them what they should and shouldn't do while coding.

Allow me to launch into a nostalgia filled anecdote...

While at university we used a somewhat obscure functional language
called 'ml' which was originally designed for theorem proving.  If Perl
advocates think that Python is strict, they would have difficulty
believing that anyone would willingly program in ML!  Every statement
you give to ML is parsed, and carefully type-checked before the
interpreter will accept it.  When initially exposed to this seemingly
perverse language our entire year rebelled.  You could scarcely go near
the computer lab without hearing someone grumble about Ml and the
beastly lecturers who were making us learn it, just because it was
largely invented in our department (Dept of Comp Sci, Univ of Edinburgh,
Scotland).  After some months though you could see people's opinions
beginning to change.  People began to realise that there was a deep
logic behind the way Ml worked, a structure on the edge of what our
young undergraduate brains could understand, but Ml was forcing us to
stick to that structure, and in the long run it meant that our code was
better.  Any of us could look at some code written by another and see
exactly what was going on, and combining our code was trivial.

In the last year of university a large percentage of our year decided to
use Ml in their final year project, mostly the same people who grumbled
about why they couldn't do XYZ in Ml, and about the obscure error
messages it gave, when they were first introduced to the language in
second year.  If Ml had thought us anything, it was a little humility.

Because of my experience of Ml, I do not feel that limitations imposed
on the programmer by a language are nescessarily a bad thing, and maybe,
deep down, that is why I love Python.

Ian.


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 498
*************************************


home help back first fref pref prev next nref lref last post