[25968] in Perl-Users-Digest
Perl-Users Digest, Issue: 8187 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 19 21:05:20 2005
Date: Sun, 19 Jun 2005 18:05:04 -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 Sun, 19 Jun 2005 Volume: 10 Number: 8187
Today's topics:
Can't locate object method "first" via package "attempt <Admin@GoMonitor.com>
Re: Can't locate object method "first" via package "att <1usa@llenroc.ude.invalid>
Re: Can't locate object method "first" via package "att <tadmc@augustmail.com>
Re: Can't locate object method "first" via package "att <sherm@dot-app.org>
Re: FAQ 6.18 Why does using $&, $`, or $' slow my progr (Anno Siegel)
Q for the old-timers: antecedents to the ST? <socyl@987jk.com.invalid>
Re: Q for the old-timers: antecedents to the ST? (Anno Siegel)
Re: Q for the old-timers: antecedents to the ST? <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 19 Jun 2005 14:56:26 -0400
From: "GMI" <Admin@GoMonitor.com>
Subject: Can't locate object method "first" via package "attempt" (perhaps you forgot to load "attempt"?) at ....
Message-Id: <11bbgp4iovmsdb@corp.supernews.com>
"Can't locate object method "first" via package "attempt" (perhaps you
forgot to load "attempt"?) at E:\Inetpub\....\N_Clt_prf.pl line 38."I get
this error on a perl program that prints & processed a form.Program was
working until I made a simple (cosmetic) change. Could not find any
reference to this error.Could anyone our there help?Thanks.
------------------------------
Date: Sun, 19 Jun 2005 19:23:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can't locate object method "first" via package "attempt" (perhaps you forgot to load "attempt"?) at ....
Message-Id: <Xns967A9C982FC1Dasu1cornelledu@127.0.0.1>
"GMI" <Admin@GoMonitor.com> wrote in
news:11bbgp4iovmsdb@corp.supernews.com:
> "Can't locate object method "first" via package "attempt" (perhaps you
> forgot to load "attempt"?) at E:\Inetpub\....\N_Clt_prf.pl line 38."I
> get this error on a perl program that prints & processed a
> form.Program was working until I made a simple (cosmetic) change.
> Could not find any reference to this error.Could anyone our there
> help?
Yes. There is an error in your program. perl has told you the location of
the error. Go ahead and fix it.
If you really do want others to be able to help you, you'll need to
provide a minimal script that others can run without any effort that still
exhibits the problem.
For more information on how you can help yourself, and help others help
you, please read the posting guidelines for this group.
Sinan.
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 19 Jun 2005 17:44:20 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Can't locate object method "first" via package "attempt" (perhaps you forgot to load "attempt"?) at ....
Message-Id: <slrndbbta4.ig1.tadmc@magna.augustmail.com>
GMI <Admin@GoMonitor.com> wrote:
> "Can't locate object method "first" via package "attempt" (perhaps you
> working until I made a simple (cosmetic) change.
If it broke stuff, then it was NOT cosmetic, though that may have
been your intention.
(did you leave a comment #marker# off of a comment that said "first attempt"?)
> Could not find any
> reference to this error.
Did you look it up in the manual?
perldoc perldiag
> Could anyone our there help?
We cannot debug Perl code when we have been shown no Perl code.
If you are the only one who can see the code, then you are the one
who will have to fix it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 19 Jun 2005 17:08:39 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: Can't locate object method "first" via package "attempt" (perhaps you forgot to load "attempt"?) at ....
Message-Id: <87ll565a20.fsf@dot-app.org>
"GMI" <Admin@GoMonitor.com> writes:
> "Can't locate object method "first" via package "attempt" (perhaps you
> forgot to load "attempt"?) at E:\Inetpub\....\N_Clt_prf.pl line 38."I get
> this error on a perl program that prints & processed a form.Program was
> working until I made a simple (cosmetic) change. Could not find any
> reference to this error.Could anyone our there help?Thanks.
It's impossible to give concrete help without seeing code.
But, as a general guideline, if a program is working, then stops working
when you make a change, then logic dictates that the change you made is the
most likely cause of the problem.
Try reversing your "simple cosmetic" alteration. Does the problem go away?
sherm--
------------------------------
Date: 19 Jun 2005 22:43:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ 6.18 Why does using $&, $`, or $' slow my program down?
Message-Id: <d94se2$eld$1@mamenchi.zrz.TU-Berlin.DE>
Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
> PerlFAQ Server wrote:
> >
> > 6.18: Why does using $&, $`, or $' slow my program down?
> >
> > (contributed by Anno Siegel)
> >
> > Once Perl sees that you need one of these variables anywhere in the
> > program, it provides them on each and every pattern match. That means
> > that on every pattern match the entire string will be copied, part of it
> > to $`, part to $&, and part to $'. Thus the penalty is most severe with
> > long strings and patterns that match often. Avoid $&, $', and $` if you
> > can, but if you can't, once you've used them at all, use them at will
> > because you've already paid the price. Remember that some algorithms
> > really appreciate them. As of the 5.005 release, the $& variable is no
> > longer "expensive" the way the other two are.
>
> IMHO this FAQ should also mention that the new special variables @- and
> @+ allow you to get most of the beniefits of $` and $' without the cost.
I think you're right.
> I can't recall when these variables were introduced - I thought it was
> after 5.5 but I can't find any mention in perl*delta.
Nor can I. perl570delta mentions @+ and @- as if they had been around
forever, but they're not in _Programming Perl_ second edition, so they
weren't in Perl 5 from the start. Mysterious.
I am appending an amended version of the FAQ (since it is posted with my
name attached, I kinda feel responsible :) I'll try to find out the perl
version that introduced @- and @+ and replace "modern Perl" with something
more precise, but not now. Maybe someone else remembers.
Anno
Once Perl sees that you need one of these variables anywhere in the
program, it provides them on each and every pattern match. That means
that on every pattern match the entire string will be copied, part of it
to $`, part to $&, and part to $'. Thus the penalty is most severe with
long strings and patterns that match often. Avoid $&, $', and $` if you
can, but if you can't, once you've used them at all, use them at will
because you've already paid the price. Remember that some algorithms
really appreciate them. As of the 5.005 release, the $& variable is no
longer "expensive" the way the other two are.
With modern Perl the special variables @- and @+ can functionally replace
$`, $& and $'. These arrays contain pointers to the beginning and end
of each match (see perlvar for the full story), so they give you
essentially the same information, but without excessive string copying.
------------------------------
Date: Sun, 19 Jun 2005 18:47:03 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: Q for the old-timers: antecedents to the ST?
Message-Id: <d94ej7$1de$1@reader1.panix.com>
This question is not about Perl per se, but about computer science
history.
In the Perl world, the term "Schwartzian Transform" (named after
Perl guru Randal Schwartz, author of the popular book Learning
Perl, among others, and numerous articles and internet postings)
is used to denote the tag-sort-untag strategy illustrated here:
my @sorted =
map $_->[0],
sort {$a->[1] cmp $b->[1]}
map [$_, expensive_function($_)],
@unsorted;
Now, I realize that Mr. Schwartz did not name this procedure after
himself, but rather someone else did. Still, I find it hard to
believe that he was the first person to make public the use of this
technique. After all, there is a very similar technique, which
I've seen referred to as "tag shuffling", for randomly shuffling
a list. In Perl it would be rendered like this:
my @shuffled =
map $_->[0],
sort {$a->[1] <=> $b->[1]}
map [$_, rand()],
@array;
This is basically an ST in which "expensive_function" is replaced
by rand().
I've seen mentions of this shuffling technique in sources much
older than Perl (maybe older than Mr. Schwartz). Given the similarity
of this technique with the general ST, I suspect that the credit
for inventing goes to some prior author. Can anyone confirm this
suspicion?
BTW, I have nothing but respect, admiration, and gratitude for
Randal Schwartz. From his writings and postings I know that he is
easily sharp and creative enough to have invented this technique
independently on his own, even if it had been invented earlier.
Moreover, as I've already pointed out, he did not give his own name
to the technique.
Nonetheless, I am intrigued by its origins.
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
------------------------------
Date: 19 Jun 2005 22:05:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Q for the old-timers: antecedents to the ST?
Message-Id: <d94q7t$d5n$1@mamenchi.zrz.TU-Berlin.DE>
[posted to clpm and Cc'd to Randal Schwartz]
kj <socyl@987jk.com.invalid> wrote in comp.lang.perl.misc:
>
>
>
> This question is not about Perl per se, but about computer science
> history.
>
> In the Perl world, the term "Schwartzian Transform" (named after
> Perl guru Randal Schwartz, author of the popular book Learning
> Perl, among others, and numerous articles and internet postings)
> is used to denote the tag-sort-untag strategy illustrated here:
>
> my @sorted =
> map $_->[0],
> sort {$a->[1] cmp $b->[1]}
> map [$_, expensive_function($_)],
> @unsorted;
>
> Now, I realize that Mr. Schwartz did not name this procedure after
> himself, but rather someone else did. Still, I find it hard to
> believe that he was the first person to make public the use of this
> technique. After all, there is a very similar technique, which
> I've seen referred to as "tag shuffling", for randomly shuffling
> a list. In Perl it would be rendered like this:
>
> my @shuffled =
> map $_->[0],
> sort {$a->[1] <=> $b->[1]}
> map [$_, rand()],
> @array;
>
> This is basically an ST in which "expensive_function" is replaced
> by rand().
It's not a very good algorithm as far a shuffling goes. An array can be
shuffled in linear time, sorting takes n*log n.
> I've seen mentions of this shuffling technique in sources much
> older than Perl (maybe older than Mr. Schwartz). Given the similarity
> of this technique with the general ST, I suspect that the credit
> for inventing goes to some prior author. Can anyone confirm this
> suspicion?
>
> BTW, I have nothing but respect, admiration, and gratitude for
> Randal Schwartz. From his writings and postings I know that he is
> easily sharp and creative enough to have invented this technique
> independently on his own, even if it had been invented earlier.
> Moreover, as I've already pointed out, he did not give his own name
> to the technique.
>
>
> Nonetheless, I am intrigued by its origins.
It's very simple. When Randal's method was discussed, it reminded someone
of the way Fourier- and Laplace transformations are used, for instance
in the area of solving differential equations: Transform the problem
into a space where the solution is easier, solve it there, then transform
back to arrive at a solution in the original space. So whoever it was,
half-jokingly called it "Schwartz Transform" and the name stuck. These
days it is used in all earnest to mean the sorting method in Perl that
was first described by Randal.
In my mind there is no claim involved to having invented the algorithm.
"Schwartz Transform" is only used in a Perl context, and it means a
particularly elegant way of sort-key caching that is possible in Perl,
no more no less.
I'm Cc-ing this reply to Randal, in case he wants to comment himself.
Anno
------------------------------
Date: Sun, 19 Jun 2005 17:59:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Q for the old-timers: antecedents to the ST?
Message-Id: <slrndbbu70.il6.tadmc@magna.augustmail.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> So whoever it was,
Tom Christiansen, I'm pretty sure.
> half-jokingly called it "Schwartz Transform" and the name stuck.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 8187
***************************************