[12455] in Perl-Users-Digest
Perl-Users Digest, Issue: 6054 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 19 11:33:31 1999
Date: Sat, 19 Jun 99 00:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 19 Jun 1999 Volume: 8 Number: 6054
Today's topics:
Re: Afraid to ask about Y2K! (Abigail)
Re: Database Management Problem (Abigail)
Re: deleting part of a string (Abigail)
Re: deleting part of a string (Abigail)
Re: e-mail client <Ch1ckEn@hotmail.com>
Email owner <keerthireddy@email.msn.com>
Re: Email owner <rootbeer@redcat.com>
Re: Hex to Decimal?? (Abigail)
Re: Hex to Decimal?? (Lee)
Re: Is Perl4 Y2K compliant? (Abigail)
Re: Multi-screen Perl Script <rootbeer@redcat.com>
Re: Multi-screen Perl Script (Eric Bohlman)
newbie - NT <xxkcrompton@compuhelp.net>
Re: newbie - NT <rootbeer@redcat.com>
Newbie need help <farell@startrekmail.com>
Re: Newbie need help <rootbeer@redcat.com>
Re: newbie (Abigail)
Re: Perl "constructors" armchair@my-deja.com
Re: Perl "constructors" armchair@my-deja.com
Re: Perl and artificial intelligence. <dgris@moiraine.dimensional.com>
Re: problems with eval (Abigail)
Re: Random Index?.... (Abigail)
Re: Simple question (David Efflandt)
Re: sleeping vs stopping and restarting <dgris@moiraine.dimensional.com>
Re: Using ^M within backquotes possible? (David Efflandt)
Re: Using perl to run system commands (David Efflandt)
Re: Writing RTF with Perl joey_kangaroo@my-deja.com
Re: Writing RTF with Perl (Lee)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Jun 1999 19:40:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <slrn7mlpmq.gnv.abigail@alexandra.delanet.com>
Lee (rlb@intrinsix.ca) wrote on MMCXVII September MCMXCIII in
<URL:news:B38FE5FE966887F4F6@0.0.0.0>:
\\
\\ >No wonder there weren't any pictures on his web page (when it was up).
\\ >BTW, both he (on clp.misc) and his pages seemed to have dropped from
\\ >sight.
For the past few years, each and every usenet posting contains the URL
of my homepage. And that hasn't changed. As for pictures, there's only
one graphic on my site, the logo of the Perl republic. But that will be
gone whenever I decide it's time to update that page.
\\ She was gone for a bit (or her posts weren't making their way to my sorry
\\ excuse for a news feed) but she's been posting here regularly this week.
I was in the hospital for 25 days, hence my lack of postings in the
month of May.
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 18 Jun 1999 19:50:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Database Management Problem
Message-Id: <slrn7mlqal.gnv.abigail@alexandra.delanet.com>
Matt (splinter@monmouth.com) wrote on MMCXVII September MCMXCIII in
<URL:news:7kecsh$fp$1@news.monmouth.com>:
'' Hi,
''
'' I'm using a plain old text file delimited by colons :::: and certain
'' routines just aren't working out. Here's some of my code and an
'' explanation.
''
'' THIS ROUTINE ADDS A RECORD TO THE DATABASE
''
'' sub AddCarToDatabase
'' {
'' open (DBW, ">> $cardatabase") || print "Content-type: text/html\n\n Can't
'' write to $cardatabase ($!)";
Why do you continue of the open() failed?
Why don't you flock the file?
'' $newrecord =
'' $id."::".$make."::".$model."::".$year."::".$miles."::".$price."::".$etc."::"
'' .$image."\n";
'' print DBW $newrecord;
'' close(DBW);
''
'' &DisplayCars;
'' }
''
'' The above routine will make the text file look like this (as an example):
''
'' 1300::ford::mondeo::1119::342322::255252::pw/pw CD/AM/FM!::ford0002.jpg
'' 1301::ford::mondeo::1119::342322::255252::pw/pw CD/AM/FM!::ford0002.jpg
'' 1302::ford::mondeo::1119::342322::255252::pw/pw CD/AM/FM!::ford0002.jpg
''
'' Now, the adding of cars works great! Until I try to delete or sort
'' one...here's the code for delete:
'' Note: on the matching I used :+ so that it would work with any combination
'' of delimitation by colons.
''
'' sub DeleteCarFromDatabase
'' {
'' open (DB, "<$cardatabase") || print "Content-type: text/html\n\n Can't read
'' $cardatabase ($!)";
'' while (<DB>)
'' {
'' $db .= $_;
'' }
'' $db =~ s/$id:+.*:+.*:+.*:+.*:+.*:+.*:+.*\n//; # in ActiveState this
'' WORKS!!! In UNIX it seems not to!!!!
'' close(DB);
Why not:
while (<DB>) {
$db .= $_ unless /^$id:/;
}
''
'' open (DBW, ">$cardatabase") || print "Content-type: text/html\n\n Can't
'' write to $cardatabase ($!)";
'' print DBW $db;
'' close(DBW);
''
'' &DisplayCars;
'' }
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 18 Jun 1999 19:51:42 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: deleting part of a string
Message-Id: <slrn7mlqcq.gnv.abigail@alexandra.delanet.com>
JQ (pigs_can_fly@mindless.com) wrote on MMCXVII September MCMXCIII in
<URL:news:376a79fc.62397051@news.cyberway.com.sg>:
//
// I need to delete whatever follows the LAST occurence of /, including
// the last /
s{/[^/]*$}{};
Abigail
--
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 18 Jun 1999 19:55:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: deleting part of a string
Message-Id: <slrn7mlqk0.gnv.abigail@alexandra.delanet.com>
evil Japh (jeffp@crusoe.net) wrote on MMCXVII September MCMXCIII in
<URL:news:Pine.GSO.3.96.990618132108.3119B-100000@crusoe.crusoe.net>:
!! OR:
!!
!! a substr like this:
!!
!! substr($string,rindex($string,"/")) = "";
OR:
1 until '/' eq chop $string; # Assuming the string contains at least one /.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 19 Jun 1999 08:54:09 +0200
From: GiN <Ch1ckEn@hotmail.com>
Subject: Re: e-mail client
Message-Id: <376B3E91.888831D@hotmail.com>
I used RFC 821 ( SMTP) to implement the protocol
and it just wont work but it works when i did the same steps with telnet
and i dont want to use a module because i am a beginner so i want to write
it myself just for practising
so can you check this for me??
i am not going to use it to send spam. i HATE spam!!!
------------------------------
Date: Sat, 19 Jun 1999 02:31:35 -0700
From: "keerthi arutla" <keerthireddy@email.msn.com>
Subject: Email owner
Message-Id: <ucbOEshu#GA.293@cpmsnbbsa05>
Hi everybody,
I am trying to find out the name of the person given his email id. Is there
anyway to do it in perl. Any piece of suggestion is appreciated. Thank You.
Keerthi K Arutla
------------------------------
Date: Fri, 18 Jun 1999 23:58:01 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Email owner
Message-Id: <Pine.GSO.4.02A.9906182341360.15039-100000@user2.teleport.com>
On Sat, 19 Jun 1999, keerthi arutla wrote:
> I am trying to find out the name of the person given his email id.
Didn't you ask this just the other day?
What you're really asking has two parts. This first part is: "Is there any
algorithm which, given an e-mail address, will discover the name of the
human associated with it?" And the answer is, you're making a faulty
assumption. Not every address has one human associated with it. Some have
zero, some have hundreds. (For that matter, some humans have more than one
name. And what would you do about the e-mail address of The Artist
Formerly Known as Prince? :-)
Of course, whether there is or isn't such an algorithm (there isn't) has
nothing to do with Perl. This kind of question should take you to the
docs, FAQs, and newsgroups about e-mail.
> Is there anyway to do it in perl.
This is the second part. "Can that algorithm be implemented in Perl?"
The best I've heard of is to write a program which sends mail to that
address saying something like "Please, tell me who you are". If you get
mail back saying "I'm Bart Simpson, who the hell are you?", there's your
answer.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1999 19:59:22 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Hex to Decimal??
Message-Id: <slrn7mlqr7.gnv.abigail@alexandra.delanet.com>
that's my address' Newton (nospam.newton@gmx.net) wrote on MMCXVII
September MCMXCIII in <URL:news:376aa746.50938254@news.nikoma.de>:
:: On 18 Jun 1999 10:16:22 -0600, Daniel Grisinger
:: <dgris@moiraine.dimensional.com> wrote:
::
:: >You're weak! Weak, I say! Real men don't use brain-sucking,
:: >hand-holding, sissy programs like vi or emacs to program.
:: >Real men use cat.
::
:: _Real_ real men use cat for binaries, too...
Real _women_ use magnets.
(But only on those newly fangled systems. Real women prefer front panels.)
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 19 Jun 1999 00:54:51 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Hex to Decimal??
Message-Id: <B3909ADB9668164B58@204.112.166.88>
ebohlman@netcom.com (Eric Bohlman) wrote:
>Philip 'Yes, that's my address' Newton (nospam.newton@gmx.net) wrote:
>:
>: Daniel Grisinger wrote:
>:
>: >You're weak! Weak, I say! Real men don't use brain-sucking,
>: >hand-holding, sissy programs like vi or emacs to program.
>: >Real men use cat.
>:
>: _Real_ real men use cat for binaries, too...
>
>*_Real_* _real_ real men use the front-panel switches.
!*_Real_*! *_Real_* _real_ real men ride horses, rassle cows, and don't
know or care how these stupid machines work.
Lee
------------------------------
Date: 18 Jun 1999 20:04:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Is Perl4 Y2K compliant?
Message-Id: <slrn7mlr5j.gnv.abigail@alexandra.delanet.com>
bachrach V2.0 (bachrach@*God-I-hate-spam*bigfoot.com) wrote on MMCXVII
September MCMXCIII in <URL:news:xGza3.766$yE1.54201@monger.newsread.com>:
''
'' Okay, maybe there's just something I'm missing, but how can a programming
'' language itself by Y2K compliant? I mean, when you make a program that has
'' some sort of a date feature, you store it as either a 2 or 4 digit number.
Doesn't this answer your question? If you can make programs with some sort
of date features, one surely can make programming languages with date
"features", now can you? A programming language can have a 'date' type
(like SQL), or perhaps a function that returns the current time! (I've
heard rumour that things like that are possible in Perl).
Now, I can easily image that such date features aren't Y2K compliant
[1]. But if they were, wouldn't you say the programming language *is*
Y2K compliant?
[1] And I don't mean the implementation, I mean the specification.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 18 Jun 1999 22:06:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Multi-screen Perl Script
Message-Id: <Pine.GSO.4.02A.9906182201020.5420-100000@user2.teleport.com>
On Sat, 19 Jun 1999, John wrote:
> I know this is a bit off topic, but the PERL/CGI newsgroups were
> mostly in other languages that I could'nt understand (not English).
What's a PERL/CGI newsgroup? I know of several newsgroups about Perl,
but none is about the Common Gateway Interface. And there are some about
CGI programming, but none is specifically about Perl. But maybe you're
talking about fj.perl-and-cgi or some such.
> Is there a more efficient way then the if-else structures?
It sounds as if you want the FAQ's entry about case/switch in section
seven. But I don't see what's multi-screen about this. Oh, well.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 19 Jun 1999 05:10:22 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Multi-screen Perl Script
Message-Id: <ebohlmanFDK6DB.FxH@netcom.com>
John (maddog2030@hotmail.com) wrote:
: I know this is a bit off topic, but the PERL/CGI newsgroups were mostly in
: other languages that I could'nt understand (not English). Anyway, I am
Actually, this is on-topic because it's about a purely Perl issue
(function dispatching) rather than about the vagaries of protocols.
: writing a multi-screen CGI script. I know the standard if-elsif-else
: structure method, but I am passing the name of functions in a hidden form
: field (name = action, value = name of subfunction to activate without the
: '&'). Is there a more efficient way then the if-else structures? I also know
: the method like the following:
:
: %subroutines =
: (
: 'add_user' => \&add_user(),
: 'add_user_screen' => \&add_user_screen(),
: ............
: );
:
: if(%subroutines{"$INPUT{'action'}"})
if (defined $subroutines{$INPUT{action}})
: {
: $subroutines{"$INPUT{'action'}"}->();
None of the quote marks are necessary.
: }
: else
: {
: login_screen();
: }
:
: but wondered if I could avoid making the hash at all in a similar method
: (because of the fact you just have to add a '&' in front of the value of the
: $INPUT{'action'} variable in order to get the correct function call).
You could, but you *do* *not* *want* *to*. You do *not* want to let
someone else send you what really amounts to executable code (a parameter
that can result in the execution of an arbitrary subroutine within your
program). Remember than anyone can just telnet in to your HTTP port and
set whatever parameters they want to.
The scheme you've chosen is the correct one, because it keeps your
external-interface namespace (the actions a form can request) separate
from your internal-implementation namespace (the subroutines that make up
your program). A CGI program (or any other program that takes input from
untrusted sources) should *never* provide the Outside World with access to
the latter namespace.
------------------------------
Date: Sat, 19 Jun 1999 06:00:13 GMT
From: "Kim Crompton" <xxkcrompton@compuhelp.net>
Subject: newbie - NT
Message-Id: <NlGa3.885$yE1.72513@monger.newsread.com>
I have purchased several books on Perl 5 and cannot figure out how to
execute a perl script from the command line of my browser. I receive the
error:
%1 is not a valid Windows NT application.
I can run perl scripts from the command line. I'm fairly certain that Perl
is installed correctly. All of the documentation that I have found is for
UNIX or Apache. I don't even know what the shebang line should look like or
if I even need one. I have tried #!perl and #!d:/Perl/bin/perl.exe. I get
the same results for both.
I am trying to interface to the UPS online system. The sample code they
have given is in written in Perl. I've tried using PerlScript with active
server pages but it doesn't work (it doesn't give me an error either). So,
as a last resort I need to use either a .pl file or a .cgi file. Can anyone
help me?
I am running windows NT server, IIS 4.0, and Perl build 5.15.
Please email me at kcrompton@compuhelp.net
Thanks
------------------------------
Date: Fri, 18 Jun 1999 23:40:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: newbie - NT
Message-Id: <Pine.GSO.4.02A.9906182337250.15039-100000@user2.teleport.com>
On Sat, 19 Jun 1999, Kim Crompton wrote:
> Subject: newbie - NT
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I have purchased several books on Perl 5 and cannot figure out how to
> execute a perl script from the command line of my browser.
Maybe your browser doesn't support Perl. But you could check with the
docs, FAQs, and newsgroups about browsers and other web-related issues for
more information.
> I am trying to interface to the UPS online system. The sample code they
> have given is in written in Perl.
Someone posted some of that the other day. You should use LWP instead. So
should they, for that matter. You can find LWP on CPAN.
> I've tried using PerlScript with active server pages but it doesn't
> work (it doesn't give me an error either).
Maybe you should check the docs, FAQs, and newsgroups about servers, as
well.
> Please email me at kcrompton@compuhelp.net
Put that in your headers, and I'll be glad to. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 18 Jun 1999 22:25:33 -0700
From: "nightcom" <farell@startrekmail.com>
Subject: Newbie need help
Message-Id: <pRFa3.94$Oi2.20577@news2.randori.com>
Hi,
can somebody help me?
How do I configure Personal Web Server
to run cgi scripts?
I'm running win98 and recently downloaded
ActivePerl Build 517, though I have no idea how to run
the demo cgi(s) included.
I tried creating a virtual dir. and selected all three permission for
this dir. but I still can't run any cgi(s).
Even tried searching on activeperl's website but not much info
there about PWS.
Any help is most appreciated.
Thanks.
regards,
nightcom
------------------------------
Date: Fri, 18 Jun 1999 23:00:10 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newbie need help
Message-Id: <Pine.GSO.4.02A.9906182259290.15039-100000@user2.teleport.com>
On Fri, 18 Jun 1999, nightcom wrote:
> Subject: Newbie need help
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> How do I configure Personal Web Server to run cgi scripts?
Check the docs, FAQs, and newsgroups about servers. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1999 20:08:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: newbie
Message-Id: <slrn7mlrci.gnv.abigail@alexandra.delanet.com>
Tad McClellan (tadmc@metronet.com) wrote on MMCXVII September MCMXCIII in
<URL:news:oaedk7.03m.ln@magna.metronet.com>:
//
// Naw, I like cats.
//
// You just have to remember to baste them frequently during preparation.
//
// <ducking...>
I agree. Ducks are tasty.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 19 Jun 1999 05:19:58 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7kf99o$jou$1@nnrp1.deja.com>
In article <7k5qup$oo6$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7k5bgh$j3d$1@nnrp1.deja.com>,
> armchair@my-deja.com wrote:
> > In article <7k3d72$u1n$1@nnrp1.deja.com>,
> > John Porter <jdporter@min.net> wrote:
> > > Or rather, it's only relevant to fellows who lack the background
> > > and/or cognitive abilities to recognize the equivalence of the
two.
> >
> > Would that background include a tour as a Moonie?
>
> No, it would not.
Would it include standing in line for Star Wars tickets for over 24
hours?
>
>
> > First Perl strings were different than C++ strings,
> > and now it is easy
> > to write a C++ string that does the same thing.
>
> Now, then, and always.
Great, then we can throw out Perl's string as a feature that makes it a
higher level language. I am surprised that you raised this issue then
since you so emphatically deny a difference now.
>
> > Are you suggesting
> > that no current C++ string class does what a Perl string does?
>
> No.
Great, then we can throw out Perl's string as a feature that makes it a
higher level language. I am surprised that you raised this issue then
since you so emphatically deny a difference now.
>
> > And what
> > does a Perl string do that is keeping you from specifying it?
>
> Nothing is keeping me from specifying it, other than the fact
> that I have better things to do with my time.
> If you want a functional description, read perldata, perlop,
> and perlfunc.
I certainly do realize you have better things with you time than
specifying Perls string. You have to try and come up with some way that
C source code is merely "portable assember". As always, good luck.
>
> > Help me out - explain this phrase "how the language implementation
> > supports the creation of classes and objects".
>
> I'm refering to the capabilities of the compiler in all its parts --
> the lexer, the parser, the semantic processor, the symbol table
> manager, and the run-time components added by the back-end --
> which support the OO features of the language. In concrete terms,
> the things that make
>
> class Foo {
> private:
> int x;
> protected:
> int y;
> int size();
> public:
> Foo() { }
> };
>
> a legal and meaningful thing to write.
> I was specifically NOT referring to the source of classes themselves,
> e.g. Foo in the above example.
Well then get back to the subject. We are talking about source code.
>
> > And we were comparing C++ and Perl source code,
>
> Not at the time the subject of the complexity of C++ came up.
Yes we were. That's what was always being discussed - C++ versus Perl
source code. Nothing more, nothing less. You happened to make some
statements regarding C++ source code that you couldn't back up, so you
have desperately started talking about lexing and parsing and "real
machines" versus "virtual machines".
>
> And in fact I was never talking about "source code".
> That seems to be your bailiwick.
You were talking about it, until you made some statements you couldn't
back up. I notice one fellow is impressed by your babbling on about how
tough a C++ compiler must be to write, so it hasn't been all in vain I
would guess.
>
> > > Hmm. The simplest "class definition" in Perl consists of no code
> > > at all. This does not stop you from having instances
> > > of the class,
> > > however.
> > >
> > > $foo = bless {}, 'Foo'; # make an object of class Foo.
> >
> > C++ is a little more flexible with it's simplest
> > definition of a class
> > not requiring you to create an instance of the object:
> >
> > class Foo {};
>
> It's true that objects have primacy over classes in Perl, which is
> the opposite of C++.
I don't know what this means. Can you give an example to illustrate the
point you are trying to make?
>
> > It certainly does show how much more complex the Perl class
> > implementation is.
>
> Actually it's only possible because of the simple, dynamic
> implementation of classes in Perl.
How are Perl's classes more dynamic than C++'s?
>
> And it shows that Perl is more powerful than C++ in this one
> specific respect at least.
I have forgotten what the respect was. Above I see
$foo = bless {}, 'Foo';
You are going to put this "class" up as an example of Perl's power?
>
> > > Make undefined method calls do something useful:
> > >
> > > sub Foo::AUTOLOAD {
> > > my $self = shift;
> > > my $name = $Foo::AUTOLOAD;
> > > $name =~ s/.*:://; # strip the qualification
> > > $self->{'contained_object'}->$name( @_ );
> > > }
> >
> > Don't know what this is doing, but it again appears that
> > Perl objects
> > have a lot of complexity to them versus the much simpler C++.
>
> It only appears complex to you *because* you don't know what's
> going on. It's really not bad at all.
> And it is a powerful, useful feature which C++ programmers could
> only dream of.
So what does it do that you couldn't do in C++. Explain your benefit.
>
> > > > End of story.
> > >
> > > Stories, like newsgroup threads, don't end just because someone
> > > declares them ended.
> >
> > Didn't say the story ended,
>
> You are a liar.
"End of story" means "let's put an end to your story about why you can't
write the assembler equivalent to a C nested for loop, even though you
repeatedly contend that C is merely portable assember". By your own
inability to match a tiny snippet of C code in assembler you tell a sad
story of a man unable to justify his outrageous claims. And that's no
lie, I'm afraid.
>
> > > It's unfortunate that the benefits of C++ come at such a high
> > > cost in complexity. This was, of course, one of the motivating
> > > factors in the creation of Java.
> >
> > You were supposed to demonstrate how C++ classes were more complex
> > than
> > Perl's,
>
> "Supposed to"? Think again.
Well, you're correct, you have proven that you will repeatedly make
claims, and not back them up with proof, but I did give you the benefit
of the doubt, once again.
>
> > and you somehow forgot to show the C++ classes at all, far from
> > proving C++ to be complex.
>
> The C++ machinery for supporting OOP is far more complex than that
> of Perl, but it would require some understanding of both for one to
> realize it. But the point, originally, was that C++ was so much
> more complex than C because of this extra machinery. Not sure why
> you find it so hard to believe.
class a {
private:
int m_number;
public:
void SetNumber(int number) { m_number = number; }
int GetNumber(void) { return m_number; }
}
That's why.
>
> > Maybe you can get the Java creators to help
> > you demonstrate the complexity of creating classes in C++.
>
> They would be more than happy to; simply go make this request
> for info in comp.lang.java.
>
> (My apologies to the clj guys in advance.)
No doubt because you intend to trail along and chime in that "Perl
classes are much less complex than Java classes" and to prove it you
will show Perl code and no Java code, and then say that Perl is a higher
level language, while C/C++ and Java are low level languages.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 19 Jun 1999 05:40:57 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7kfah8$k3b$1@nnrp1.deja.com>
In article <86vhcp8isk.fsf@research.johnson.cornell.edu>,
Doug Elias <dme7@cornell.edu> wrote:
>
> Mr. Chair ...
>
> From the Merriam-Webster on-line dictionary (www.m-w.com):
> Main Entry: equivalent
> Pronunciation: -l&nt
> Function: adjective
> Etymology: Middle English, from Middle French or Late Latin;
> Middle French, from Late Latin <I>aequivalent-,
aequivalens,
> present participle of aequivalEre to have equal power,
from
> Latin aequi- + valEre to be strong -- more at "wield"
> Date: 15th century
> 1: equal in force, amount, or value; also: equal in area or volume but
> not admitting of superposition <a square equivalent to a triangle>
> 2a: like in signification or import
> b: having logical equivalence <equivalent statements>
> 3: corresponding or virtually identical especially in effect or
> function
> 4 (obsolete): equal in might or authority
> 5: having the same chemical combining capacity<equivalent quantities
> of two elements>
> 6a: having the same solution set <equivalent equations>
> b: capable of being placed in one-to-one correspondence <equivalent
> sets>
> c: related by an equivalence relation
>
> My guess is that Mr. Porter is using definition-3; which definition do
> you subscribe to? If it is not listed here, please provide it, and a
> reference for its common usage.
Since we are talking about C source code versus Assembler source code,
definition 3 works fine for me (but not for Mr. Porter as you brutally
point out), and also most of the others work as well (but not for Mr.
Porter as you brutally point out).
>
> As to your never-ending "give me the equivalent assembler code for the
> following", please accept this, again in the spirit of definition-3
> above, produced on a Sun Enterprise 10000 using gcc-2.7.2.3 and the
> command-line "gcc -S forprint.c -o forprint.s" --
Let me see if I am clear now, you feel that this "Assembler source code"
you are presenting is equivalent to the C nested for loop in my
examples per "corresponding or virtually identical especially in effect
or function".
Perhaps you need to see my example once again, right next to your code,
and then see if you still content they are equivalent:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
Now take your time looking that over, and then peruse the lines you
gave below as equivalent.
>
> ----------------------------------------------------------------------
> .file "forprint.c"
> gcc2_compiled.:
> .section ".rodata"
> .align 8
> .LLC0:
> .asciz "i/j %d/%d\n"
> .section ".text"
> .align 4
> .global main
> .type main,#function
> .proc 04
> main:
> !#PROLOGUE# 0
> save %sp,-120,%sp
> !#PROLOGUE# 1
> st %g0,[%fp-20]
> st %g0,[%fp-24]
> .LL2:
> ld [%fp-20],%o0
> cmp %o0,9
> ble .LL5
> nop
> b .LL3
> nop
> .LL5:
> nop
> .LL6:
> ld [%fp-24],%o0
> cmp %o0,9
> ble .LL9
> nop
> b .LL7
> nop
> .LL9:
> sethi %hi(.LLC0),%o1
> or %o1,%lo(.LLC0),%o0
> ld [%fp-20],%o1
> ld [%fp-24],%o2
> call printf,0
> nop
> .LL8:
> ld [%fp-24],%o1
> add %o1,1,%o0
> mov %o0,%o1
> st %o1,[%fp-24]
> b .LL6
> nop
> .LL7:
> .LL4:
> ld [%fp-20],%o1
> add %o1,1,%o0
> mov %o0,%o1
> st %o1,[%fp-20]
> b .LL2
> nop
> .LL3:
> .LL1:
> ret
> restore
> .LLfe1:
> .size main,.LLfe1-main
> .ident "GCC: (GNU) 2.7.2.3"
> ----------------------------------------------------------------------
>
> Mr. Porter, your patience is awe-inspiring.
Indeed it is, but sadly it must be. You are well aware of Mr. Porter's
efforts last year to paint his uncle Jedidiah's fence that encloses a
400 acre farm. Although his uncle offered his mobile air compressor and
spray gun, Mr. Porter insisted on using a 3 inch brush, claiming that it
was equivalent. After 1 month, you graciously joined him and the project
was completed 2 months later just a hair before the harvest. I hear it
got ugly when Jedidiah refused to pay you by the hour, and hope you took
with good humour his refusal to drive you to the airport saying "once
you boys have made the walk, you'll see it's equivalent to me driving
you." And I'm sure to you two, it most certainly was.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 19 Jun 1999 00:49:44 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Perl and artificial intelligence.
Message-Id: <m3674kofav.fsf@moiraine.dimensional.com>
ktb <xyf@inetnebr.com> writes:
> I'm new to programming but I thought it would be fun to mess around
> with this. If anyone knows of any A.I. programs written in Perl or
> links on the topic I'd love to know about it.
There's a perl-ai mailing list, its webpage is at-
http://www.netizen.com.au/resources/lists/perl-ai/
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 18 Jun 1999 20:11:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: problems with eval
Message-Id: <slrn7mlrie.gnv.abigail@alexandra.delanet.com>
Christopher Grau (ScgrauP@Aucsd.eduM) wrote on MMCXVII September MCMXCIII
in <URL:news:376ab719.959956380@news>:
:: I have had some difficulty using the eval function. Imagine that I
:: have a fairly complex perl script (with luck, this doesn't matter, and
:: I don't have to go into it). Basically, I am trying to execute code
:: that looks like this:
::
:: eval "\$foo = \"bar\"";
::
:: However, this doesn't work in my complex script, $foo is never
:: assigned anything. Although it seems to work beautifully in a program
:: in which it is the only statement.
::
:: Now, if I execute it in this manner:
::
:: eval "\$foo = \"bar\"";
:: print "$foo\n";
::
:: It works just fine, $foo is assigned the string "bar" and the script
:: is happy.
I don't get it. Is there a difference between the 2 eval statements?
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 18 Jun 1999 20:12:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Random Index?....
Message-Id: <slrn7mlrk7.gnv.abigail@alexandra.delanet.com>
jennifer01@vei.net (jennifer01@vei.net) wrote on MMCXVII September
MCMXCIII in <URL:news:929734963.817.103@news.remarQ.com>:
-- Hi! I was wondering if anyone knew of a script(someone told me there
-- was a perl one)that would allow me to have random index pages load.
-- Meaning when the person hits reload, a whole new different index page
-- would load. I saw it at http://starwars.com/episode-i/ and just am
-- dying to know how they do that! Ive tried in vain for a javascript
-- for it but am not too sure on some of the details about it. So i
-- figured id try here as well since i was told it was more then likely a
-- perl script. Any help would be greatly appreciated! Thanks!
Did you try mailing webmaster@starwars.com?
What you are asking isn't a Perl question.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 19 Jun 1999 06:51:31 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Simple question
Message-Id: <slrn7mmfbe.1mq.efflandt@efflandt.xnet.com>
On 19 Jun 1999 02:11:30 GMT, Taswar Bhatti <taswar@DONTSPAMcs.ualberta.ca>
wrote:
>All I want to do is get the user domain name. When
>I use $ENV{'REMOTE_HOST'} what it returns to me
>is a NULL string but I could get the IP address
>of the user from $ENV{'REMOTE_ADDR'}...
This subroutine will set REMOTE_HOST if it is not set or equals
REMOTE_ADDR. However, some IP's will not resolve (they have no name):
sub remhost {
return if ($ENV{REMOTE_HOST}
&& $ENV{REMOTE_ADDR} ne $ENV{REMOTE_HOST});
my $ip_num = pack("C4", split(/\./, $ENV{REMOTE_ADDR}));
$ENV{REMOTE_HOST} = scalar gethostbyaddr($ip_num, 2);
}
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 19 Jun 1999 00:41:21 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: sleeping vs stopping and restarting
Message-Id: <m3btecofou.fsf@moiraine.dimensional.com>
snow@biostat.washington.edu (Gregory Snow) writes:
> What type of resources does a sleeping perl script consume?
This is system dependent, but on most (all?) unix-like systems a
sleeping process won't consume any resources other than the minimal
kernel data structures associated with each process, including the
memory allocated.
If the program is eating huge amounts of memory you'll probably want
to exit so that the system gets it back.
> My search of deja and the docs didn't turn up an answer.
You were probably looking at Perl docs instead of Unix docs. :-)
> I sometimes use perl to control some long but low priority simulations,
> and the program that perl calls to do the work is a real memory hog,
> so I want the script to run just at night. One approach is to check
> the time each iteration and if it is after 5:00am, save the current
> state of everything, set up "at" or "chron" to restart the script that
> night and exit. The other option is to call sleep and sleep for
> several hours, this would be simpler, but I don't want to do it if it
> is consuming a significant amount of system resources. So what does
> my script do while it is sleeping?
You could do this with sleep(), but you really don't want to. It
would be False Laziness-- avoiding lots of work now in favor of lots
of work later. :-)
It seems that the main reason you want to use sleep is to avoid having
to write code to handle saving your application's state and
reinstantiating it later. I don't blame you, checkpointing and
persistence are hard problems that most people don't really
understand.
But you've only traded one set of tough problems for another. Instead
of worrying about saving application state you're going to have to
worry about the pitfalls of a long-running application. A memory
leak isn't a big deal in a program that exits after 3 seconds. A program
that exits after 3 months is a different matter entirely.
But you don't actually get out of having to be able serialize your
application. sleep() will return if a signal is delivered, your box
can crash, or any of a million other things can go wrong. If you
don't have your application state cached on disk you'll have lost the
work you've done. Not something you want when you are running for
weeks on end. Thus, you'll need to serialize your app anyway.
So, you probably need to do persistence either way, but not using
sleep will let you avoid thinking about memory issues, too.
All in all, if it won't be amazingly difficult to make your app start
and stop every day, I'd say use cron. If it will be amazingly
difficult to start and stop the app I'd rethink the design.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 19 Jun 1999 06:22:27 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Using ^M within backquotes possible?
Message-Id: <slrn7mmdku.1mq.efflandt@efflandt.xnet.com>
On Fri, 18 Jun 1999 13:26:08 -0500, Burton Kent <burton@lucent.com> wrote:
>I need to call a program from a shell. To bypass a prompt, I have to echo "y^M"
>to the program:
>
>print `cd $ROOT; echo "y\^M" | setnode g=$GENERIC node=$ROOT >/dev/nul
>l 2>&1`;
>
>
>This is what I get, instead of having the program ("setnode") run properly:
>
>" | setnode g=$GENERIC node=$ROOT >/dev/null 2>&1
That is understandable since you are not running a program, you are merely
printing a string that contains a carriage return (^M), and what follows
that overwrites the part of the string up to, and including, the ^M.
>I have tried escaping the double quotes, escaping the ^M, and both. No luck.
>Any suggestions!? Should I be using an entirely different approach?
In your shell type: perldoc -f open
You probably want something like:
chdir $ROOT;
then some sort of open() [probably open2() or open3()]. But I don't have
a clue what setmode is or what it expects for input and output.
>Burton
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 19 Jun 1999 06:27:31 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Using perl to run system commands
Message-Id: <slrn7mmduf.1mq.efflandt@efflandt.xnet.com>
On Fri, 18 Jun 1999 04:46:31 GMT, R.Joseph <streaking_pyro@my-deja.com> wrote:
>I would like to use a Perl script to run the command "htpasswd."
>However, I want to do this using CGI because my web server does not
>allow Telnet. Because htpasswd prompts you for a password twice after
>running it, would this script be possible to be used over a CGI-type
>interface, or am I totally delusional? Thanks in advance!!
You don't need htpasswd at all. You can do it all in Perl. I have an
example at http://www.xnet.com/~efflandt/pub/
However, it was just something I cobbled up some time ago and you should
probably see 'perldoc -f srand' to make that statement more random.
>--
>R.Joseph
>http://www.24-7design.com
>http://bowdown.to
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Sat, 19 Jun 1999 04:44:04 GMT
From: joey_kangaroo@my-deja.com
Subject: Re: Writing RTF with Perl
Message-Id: <7kf76i$j83$1@nnrp1.deja.com>
In article <B390693B9668AA291@0.0.0.0>,
rlb@intrinsix.ca (Lee) wrote:
> Would those be RTFM files or RTF-FAQ files? I thought that Microsoft
had
> some new, improved notion for an industry-standard universally
portable
> format. Do you suppose they'll invent a round wheel one day, and then
stop?
No, I mean to make Rich Text Format files. Say I had a resume-making
CGI program where person enters stuff and after pressing submit,
creates a Rich Text Format File for the user to download.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 19 Jun 1999 01:45:34 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Writing RTF with Perl
Message-Id: <B390A6BE9668191635@204.112.166.88>
In article <7kf76i$j83$1@nnrp1.deja.com>,
joey_kangaroo@my-deja.com wrote:
>No, I mean to make Rich Text Format files. Say I had a resume-making
>CGI program where person enters stuff and after pressing submit,
>creates a Rich Text Format File for the user to download.
I know. I was being snarky and sarcastic, and venting just a wee bit of the
seemingly inexhastible supply of anti-Microsoft spleen that I have built up
over the years. And I don't even know for certain that RTF is their fault.
The other part of what I said was true, and meant to be helpful. I don't
think you're asking in the right place. Try using deja.com to search Usenet
for RTF questions and answers. You'll probably find the answer already, and
if not you'll certainly find a more likely place to find an answer.
And, if RTF specs are public, any search engine will find them somewhere on
that great horkin WWWeb thingie.
Lee
------------------------------
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 6054
**************************************