[12224] in Perl-Users-Digest
Perl-Users Digest, Issue: 5824 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 28 23:07:17 1999
Date: Fri, 28 May 99 20:00:17 -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 Fri, 28 May 1999 Volume: 8 Number: 5824
Today's topics:
Re: ? form with binary attachment ? (David Efflandt)
Add Unix User function <zsoris@IHATESPAM.post.uwstout.edu>
Re: Dealer Locator (Benjamin Franz)
Re: Decrypting Passwords (David Efflandt)
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Ilya Zakharevich)
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Ilya Zakharevich)
form date to text file write <mail@cfitmarketing.com>
Re: How do I prevent a CGI timeout? (David Efflandt)
How to launch Perl from NoteTab <pleduc_your_finger@home.com>
Re: how to upload file from the form? (David Efflandt)
Re: HTTP Upload using CGI.pm (David Efflandt)
Re: killing exec()ed process - how? (David Efflandt)
Re: lwp - getting images <ebohlman@netcom.com>
Re: Moving tags via regexp <ebohlman@netcom.com>
Re: Perl "constructors" (Kevin Reid)
Re: PERLFUNC: wantarray - get list vs array context of (Kevin Reid)
Re: read html source from other servers? <bill@fccj.org>
Regexp problem confusing me (Jed Parsons)
SiliconValley.PM June Monthly Event fxia@yahoo.com
Re: workarounds for prototypes (Damian Conway)
Re: Y2K infected Perl code (Ilya Zakharevich)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 May 1999 01:09:01 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: ? form with binary attachment ?
Message-Id: <slrn7kufdv.n0.efflandt@efflandt.xnet.com>
On Thu, 27 May 1999 09:55:49 +0200, Paolo
<PrinsPaul@DELETETHIShotmail.com> wrote:
>Hi,
>
>My ISP provides me a script I can use to create(send) forms.
>But I can't let people send binary attachments with these provided scripts.
>Can someone tell me where I can find a script with which I can do this ?
>Xcuse my English but I hope the question is clear.
>Can someone give me a clear or rather satisfying answer ?
>
>Thanx in advance.
>Paolo
CGI.pm to generate and process the form (including file upload).
MIME::Lite for sending the e-mail with attached file.
You might need to get MIME::Lite from a CPAN mirror at
http://www.perl.com/
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Fri, 28 May 1999 19:03:02 -0500
From: "Chilly" <zsoris@IHATESPAM.post.uwstout.edu>
Subject: Add Unix User function
Message-Id: <7inal1$l10@newsops.execpc.com>
Hi,
I've been looking through past posts because I know my question must have
been asked before, but haven't found anything yet. If anyone has any past
posts, web sites, or printed material on the following problem, could you
please direct me to it?
Here's the scenario:
At the University I go to, we'll soon be giving all students and faculty web
accounts automatically upon enrollment/hire. I have pursuaded my boss to
switch to Unix for the student web server, and one is already being used for
the primary server. What I need to be able to do is add a user in Unix from
a Perl or shell script (I know this isn't a forum for shell scripting, but
since I only know Perl as of now, this would be a good place to start). I
know I can add a user to the passwd file and have it set the password to
NULL automatically, but for security purposes, we're going to need to set
their first password for them (to their ss#). I tried using crypt on their
number and saving that into the file, but it didn't seem to work. Should
crypt be working? If not, any ideas on how I can set their password?
A quick Unix question (cause it's somewhat related): To delete a user, can I
simply delete their entry in the passwd file and rmdir their home directory?
--
Scott Allen Zsori
------------------------------------------------------
zsoris@post.uwstout.NOeduSPAM
Assistant Webmaster
University of Wisconsin- Stout
------------------------------------------------------
SCOTT.A.ZSORI@a1wi.ameritech.NOcomSPAM
Intern Webmaster and Developer
Ameritech Reliability Center (Networking)
------------------------------------------------------
"Just try explaining the value of statistical summaries to the widow of
the man who drowned crossing a stream with an average depth of four feet."
------------------------------
Date: Sat, 29 May 1999 00:19:52 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Dealer Locator
Message-Id: <IoG33.2411$kd5.266216@typhoon-sf.snfc21.pbi.net>
In article <7in2r0$p5n$6@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <374F11AD.82CF8977@coastalpet.com>,
> Webmaster <webmaster@coastalpet.com> writes:
>: Does anyone know how to build a dealer locator? I've seen a quite a few
>: web sites running them. I need the user to be able to input their zip
>: code in a form and for that zip code to be compared to a text file on
>: the server. The script will find the zip code on the text file that is
>: closests to the zip code that was input by the user. In a nutshell I
>: need to give the website user the ability to type in there zip code and
>: find the nearest dealer in their area. I've seen this done but I'm not
>: real sure how to go about doing it. Any help would be greatly
>: appreciated.
>
>Maybe you didn't see this the first time around:
[big snip]
MJD is a little too pessimistic. It *IS* possible to make geographic searches
usefully on things like _ZIPCode_. In my case, on telephone area code and
local exchange. You buy the _coordinate based_ database from the appropriate
people and _translate_ the numbers to the correct coordinates. Then you
return a list of 25 or so closest locations according to Cartesian geometry.
Try <URL:http://www.sterlingvyds.com/home/guest_services/dealer_locator/>
See?
You have to keep your databases current (non-trivial), but all in all, quite
satisfactory. Yes - area codes and prefixes are also parochial - but then
what are the odds that you have encoded 'Osaka-ken' in the correct kanji in
your database? 'City and State' are just as parochial of concepts as ZIPCodes.
You tailor your system to your audience. ;)
--
Benjamin Franz
------------------------------
Date: 29 May 1999 01:13:00 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Decrypting Passwords
Message-Id: <slrn7kufle.n0.efflandt@efflandt.xnet.com>
On 28 May 1999 17:39:49 GMT, Dennis Mercer <dmercer@Glue.umd.edu> wrote:
>I'm working on a system for changing the password of a user on a site, and
>I need a way to decrypt the password that is in the htpasswd file. Any
>thoughts on how to go about decrypting this? I just want to verify that
>the user knows his password and then ask for a new password, all on one
>page. Thanks.
>
>Dennis
You cannot decrypt passwords (otherwise they would not be very secure
would they?). What you can do is crypt the password the user gives you
using the existing crypted password as the salt. The result should match
the stored crypted password. Then you could crypt the new password and
store that (possibly using new random salt).
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 29 May 1999 00:00:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7inank$1fo$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <374dc4b4@cs.colorado.edu>:
> :I see no point in formalizing the current mish-mash. What I see a
> :point in is
> :
> : a) design pragmas which simplify API a lot (no dwim);
>
> That is not what Perl is. Please write yourself your own language.
If you do not like the way Perl developments goes now, write yourself
your own language.
> For the umpteenth time, I post something that you continue to fail
> to process.
If you think that repeating an argument again and again makes it more
relevant, please continue to post this snippet.
> Perl is supposed to be DWIM. You cannot remove that and still have Perl.
Please remove 'use strict' from all your scripts from this moment on.
Perl is supposed to be freehand. You cannot remove that and still
have Perl.
> Face it Ilya, you hate Perl. You will never succeed in castrating Perl.
What I did succeed in is making Perl into what it is now. Together
with other people dedicated to make Perl a good place to live in. I
may have more luck or less luck in continuing to go this way. We will see.
Hope this helps,
Ilya
------------------------------
Date: 29 May 1999 00:03:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7inasq$1hi$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.11b77aca813cd52989b16@nntp.hpl.hp.com>:
> > :I see no point in formalizing the current mish-mash.
>
> <BIG SNIP>
>
> > Perl is supposed to be DWIM.
>
> The DWIMming can be, should be, and -- thanks largely to your efforts --
> *is* documented quite thoroughly, on the whole.
All I can say that you are greately mistaken - and in more ways than one.
Due to enormous work of many people - including Tom - some sides of
Perl's nuisances are documented now. But much more than than remains
undocumented.
Ilya
------------------------------
Date: Fri, 28 May 1999 16:43:17 -0700
From: "Roy McClean" <mail@cfitmarketing.com>
Subject: form date to text file write
Message-Id: <AbG33.239$mN1.30843@newsgate.direct.ca>
I am having problems having my script write data submitted from a form to
text file the same way it was written in the form. It won't hold spaces,
replaces them with black boxes. This error is explained here
www.intergate.bc.ca/personal/spidrweb/codehelp.html Please, if anyone can
see what my error is, please let me know.
Tanx
Robert
------------------------------
Date: 29 May 1999 01:23:09 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How do I prevent a CGI timeout?
Message-Id: <slrn7kug8e.n0.efflandt@efflandt.xnet.com>
On Fri, 28 May 1999 15:48:05 +0100, Dr Marcus Phillips
<m.j.phillips@shef.ac.uk> wrote:
>To anyone who can help...
>
>How do I prevent a perl CGI from timing out and the browser saying "Document
>contains no data"? I have a data analysis program which on some of the more
>complicated analysis slows down sufficiently to give this problem. I try to
>output data regularly via "print" but this does not seem to work. The
>process itself continues even after the browser gives up!
>
>Thanks in advance
>
>Marcus
Even if you turn off buffering in perl, the server may be buffered or will
wait until is receives a large enough chunk before it sends anything.
Also some browsers do not display anything until they get the full page
text. So this may be a combination of server and browser issues, but has
nothing to do with perl (as long as you end lines with \n or perl
buffering is disabled).
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Sat, 29 May 1999 01:05:44 GMT
From: Paul Leduc <pleduc_your_finger@home.com>
Subject: How to launch Perl from NoteTab
Message-Id: <374F3D68.F240679C@home.com>
At a recent course, they had configured NoteTab text editor to launch
Perl to run the program we were creating in NoteTab. This was done by
adding the Launch Icon to the tool bar, and configuring it to run a PIF
file to open a dos window, and keep it open so we could see the results
of the program run. Essentially, the PIF file was just a copy of a dos
PIF, with the check box to close the window left unchecked.
I can't seem to get this running on my system. It gets as far a
launching the dos window, but my program never runs. Does anyone have
specific instructions on how to do this, or another method of achieving
the save thing? I am using WinNT.
Please copy me on your reply, at pleduc@home.com.
thanks!
--
Paul Leduc - pleduc@home.com
(remove YOUR FINGER from my address when replying)
------------------------------
Date: 29 May 1999 01:24:20 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: how to upload file from the form?
Message-Id: <slrn7kugam.n0.efflandt@efflandt.xnet.com>
On Fri, 28 May 1999 04:53:52 +0300, Gleb Ekker <globus@infonet.ee> wrote:
>Hi everybody,
>
>please, help is needed. I want to upload to the server a file from the
>form.
>I use <input name='data' TYPE='file'> in the form and Perl script get
>from it only path to a file and file name.
>How can script get the file from a local machine for the futher
>processing?
>
>Thanks,
>Gleb globus@infonet.ee
perldoc CGI
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 29 May 1999 01:44:26 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: HTTP Upload using CGI.pm
Message-Id: <slrn7kuhg8.n0.efflandt@efflandt.xnet.com>
On Wed, 26 May 1999 16:59:53 -0600, Neal Barney <nbarney@csd.sdl.usu.edu> wrote:
> I have written a CGI script in Perl that uses CGI.pm. So far I am very
>pleased with the results. However, there are still a couple of things
>that are lacking.
> When my script is run, an upload file field is created along with a
>browse button. Upon clicking the browse button, the files on the local
>machine are displayed. However, the default browse filter is '*.html'.
>Which leads me to the following questions:
>
>1. Does CGI.pm have the capability to change the default filter from
>'*.html' to '*'?
That is a browser issue. In most cases any suggested name is ignored by
the browser since you may not have a clue what the OS or file structure
is.
>2. Is there anyway using CGI.pm (or any other perl module) to create a
>file upload progress box, similar to the browser download progress box?
>Or must I use JavaScript to accomplish this?
>
>I have read the perldoc for CGI.pm and haven't really found anything
>related to this.
That would be nice. Not sure.
>P.S. I am using version 2.49 of CGI.pm though I believe the docs are
>from version 2.36.
You would be wise to check. Depending upon your @INC you may be able to
use more or less features than you are. The latest CGI.pm I recently
found (from a year ago) is 2.42. Since I ran across one server with 2.36,
I include this snippet near the beginning of the script:
$cgiver = 2.42;
if ($CGI::VERSION < $cgiver) {
print "Content-type: text/html\n\n",
"<html><head><title>Old CGI.pm</title><head><body>\n",
"<h1>CGI.pm Version $cgiver Required</h1><hr>\n",
"<p>This server is using CGI.pm version $CGI::VERSION\n",
"and this script requires version $cgiver or later.\n",
"<p>For a newer CGI.pm module, please see a CPAN mirror site\n",
'or <a href="http://www.perl.com/">www.perl.com</a>',
"\n<h3>Current Perl Module Search Paths:</h3>\n";
foreach $key (@INC) { print "<p>$key\n"; }
print "<p></body></html>\n";
exit;
}
I know I could have used a here doc, but this formats somewhat nicer. And
I didn't use the CGI.pm routines for this since version was unknown.
Since I did not have root access to the server with the old CGI.pm, I had
to put it in site_perl and use a 'no lib' and 'use lib' combo to move
site_perl up in @INC.
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 29 May 1999 02:36:15 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: killing exec()ed process - how?
Message-Id: <slrn7kukhe.n0.efflandt@efflandt.xnet.com>
On Fri, 28 May 1999 04:12:24 GMT, Otis Gospodnetic <otis@my-deja.com> wrote:
>Hello,
>
>I was wondering if it is possible to get the PID of a 'command' executed
>by exec() so that the 'command' can be killed directly (killing the
>process that called the exec() doesn't kill the 'command' - the
>'command' keeps running)
Perhaps misunderstand exec() and should read 'perldoc -f exec'. Nothing
is returned from exec() unless it fails. So as soon as a script (or fork)
does an exec(), that script (or fork) is terminated and only the exec'd
command remains (it has no parent).
>In particular, my script forks a few processes and each of those
>processes does exec("command")
>Later, I need to kill everything: my script, all forked processes, as
>well as all commands that were exec()ed.
The forks are already dead as soon as they exec(), so there is no
relation between the original script and the commands exec'd from the
forks.
>In code:
>unless ($childPID = fork)
>{
> exec ("sleep 30");
>}
>wait;
Just curious why you are forking and exec'ing a shell command, when that
whole routine could likely be replaced with the simple perl command:
sleep 30;
>While this code is running I need to be able to kill it, as well as the
>forked process and the 'sleep 30' command that the formed process
>called.
>Is this possible?
Yes, if you use system() or backticks instead of exec().
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Sat, 29 May 1999 01:53:29 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: lwp - getting images
Message-Id: <ebohlmanFCH195.F45@netcom.com>
MORRIS LEE <morlee@s277-4.CS.Berkeley.EDU> wrote:
: How do I retrieve an image using http and the LWP module? I've tried the
: following code on Windows 95, ActivePerl version 5.005_02.
: $ua = new LWP::UserAgent;
: $req = new HTTP::Request 'Get' => $URL;
: $req->header('Accept' => 'image/jpg');
: $res = $ua->request($req, "temp.jpg");
: I get back '501 Method Not Implemented'.
That means that the server doesn't implement the "Get" method, which is
not all that surprising since it isn't a standard method. The "GET"
method, on the other hand, should be implemented by every HTTP server you
can imagine. The moral of the story is "watch your case."
------------------------------
Date: Sat, 29 May 1999 01:55:55 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Moving tags via regexp
Message-Id: <ebohlmanFCH1D7.FI4@netcom.com>
Ethan Straffin <drumz@best.com> wrote:
: I'm wondering if there are any regular expression wizards out there who
: could help me with an interesting challenge. I'm working on an SGML->HTML
: parser in Perl. The HTML is going to contain a number of <A NAME> anchors
: that will serve as targets for cross-references. The challenge is, I need
: to move all of these anchors *back* by n characters (where n is a
: constant, let's say 100) from the point where they are originally placed.
: (The goal is to make the beginning of the text to which the
: cross-reference refers appear slightly below the top of the browser
: window, rather than exactly at the top.) Furthermore, the regexp must not
: allow the anchor to be placed within another HTML tag (<...>), or within a
: second kind of tag that we use for dynamic markup ([[...]]). Ideally, the
: count of n characters should not include characters within tags, though
: I'm willing to drop this restriction if it makes the problem
: easier/possible to solve.
Your best bet is to use one of the HTML:: series modules to parse your
HTML into a tree and then perform some tree surgery (assuming you don't
faint at the sight of sap). Trying to do it with regexes alone should be
listed in the Hitch-Hiker's Guide to the Galaxy under "Recreational
Impossibilities."
------------------------------
Date: Fri, 28 May 1999 21:01:27 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Perl "constructors"
Message-Id: <1dsds6p.yt3doz1ri91naN@[192.168.0.1]>
<zenin@bawdycaste.org> wrote:
> A __DIE__ handler will always die(), unless it exit()s (in which
> case you simply throw out the code that did that and promptly fire
> the person that wrote it).
>From perlfunc (asterisks mine):
When a __DIE__ hook routine returns, the exception processing
continues as it would have in the absence of the hook, unless the hook
routine itself exits via a **goto, a loop exit,** or a die().
Apparently, however, both of those methods produce warnings:
(goto) Unbalanced scopes: -2 more ENTERs than LEAVEs.
(last) Exiting subroutine via last.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Fri, 28 May 1999 21:01:28 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: PERLFUNC: wantarray - get list vs array context of current subroutine call
Message-Id: <1dsdu65.x6hvvnurs340N@[192.168.0.1]>
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> NAME
> wantarray - get list vs array context of current subroutine call
^^^^^
scalar
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Fri, 28 May 1999 21:46:50 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: read html source from other servers?
Message-Id: <374f471a.0@usenet.fccj.cc.fl.us>
In article <374DE08C.A2A5180B@sprynet.com>, Balazs Rauznitz
<prauz@sprynet.com> wrote:
> novaya@my-deja.com wrote:
>
>> does anyone know how to make a cgi script to read source codes of any
>> html pages in other servers, not my server?
>> it would be appreciated if anyone answers me.
>
> Using LWP::Simple class is the easiest.
>
> B
>
PMFJI:
Note that you will ONLY get html source available on
another WWW server, not the mod_perl source, c source,
perl source, etc...
/^HTH$/
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Need to get started in Perl? See http://jacksonville.pm.org/Letter.cgi
------------------------------
Date: 29 May 1999 02:09:48 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: Regexp problem confusing me
Message-Id: <7ini9c$9bd$1@agate.berkeley.edu>
Hi ho.
I'm trying to get some data from my university's library system using
Net::Telnet. The Telnet session works fine, but I'm having some trouble
doing regex comparisons on the output. For example, say I want to get
data from the Telnet session up to the string '==='. I can use this
code (where $t is my Net::Telnet object)
do{
($prematch, undef) = $t -> waitfor ('/===/');
# etc
} while ($prematch =~ /CONTINUED/);
Say that $prematch returns lots of lines starting with digits (inventory
records). For some reason, the following code gets nothing:
do {
($prematch, undef) = $t -> waitfor ('/===/');
foreach $line (split "\n", $prematch) {
print $line."\n" if $line =~ /^\d/;
}
} while ($prematch =~ /CONTINUED/);
If I get rid of the ^ in the re, however, I do get every line with a
digit in it. Can someone explain to me what's going on here?
Huge thanks,
Jed
--
Jed Parsons (Yet another Plautus hack?) jed@socrates.berkeley.edu
http://www.ocf.berkeley.edu/~jparsons/
( ``We supermonsters bruise easily, you know.'' -- Supergrover )
------------------------------
Date: Sat, 29 May 1999 02:27:05 GMT
From: fxia@yahoo.com
Subject: SiliconValley.PM June Monthly Event
Message-Id: <7inj9p$ie0$1@nnrp1.deja.com>
Silicon Valley Perl Mongers
http://www.rf.net/~sv-pm-org
Meet monthly to lecture/discuss/heckle Perl issues,
like
Charter mod_perl, CGI, DBI, LDAP, I18N, security, etc. under
auspices of the Perl Mongers
Organizers James and Fred
Netscape Bldg 22, Sputnik Room (Cafeteria Bldg), 468
Location Ellis St. near East Middlefield, Mountain View, CA
Directions to Netscape
Next Meeting Tuesday, June 1, 1999 7:00 pm
Speaker: James
Topic: Professional Perl Programming: writing custom
Speaker modules, scoping issues, performance, reliability and
security.
Level: Intermediate (prerequisite: Learning Perl,
O'Reilly)
Monday May 3
Randal Schwartz, Topic "Advanced Web Programming with
Perl"
Previous Speaker Although Randal needs no introduction, here's one
anyway: he is the author of Learning Perl, co-author
of
Programming Perl, and one of the leading Perl
trainers.
He also writes a column for Web Review Magazine.
Special
appearance by Larry "Skippy" Wall. 27 attendees.
Sponsors Thanks to Netscape for the meeting room and RF.net for
web hosting
Join Mailing ListYour Email Address:
Community sv.pm.org Forums (Jobs, Advice, more)!
Humor Why there used to be no sv.pm.org
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 29 May 1999 02:38:07 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: workarounds for prototypes
Message-Id: <7injuf$te9$1@towncrier.cc.monash.edu.au>
Gareth Rees <garethr@cre.canon.co.uk> writes:
>Tom Christiansen <tchrist@mox.perl.com> wrote:
>> And at this stage, it may remain an open topic whether
>> Class::Multimethods pertains more to the solution set than it does
>> to the problem set. :-)
>I'm intrigued as to what you mean by this. Do you mean that
>Class::Multimethods is a poor implementation of generic functions
>(lacking as it does any equivalents of the CLOS features
>define-method-combination, :around, :most-specific-last or
>call-next-method)
I think "poor" is an unfair characterization of the current state
of Class::Multimethods (even if it's only a hypothetical one :-).
CLOS generic functions are much more powerful than the type of
multimethod that Class::Multimethods provides. But I'm yet to be
convinced that their extra features warrant the commensurate increase
in complexity. I wonder what fraction of CLOS users actually make use
of that extra functionality.
Let me address the specific deficiencies listed above:
define-method-combination
Not relevant to "non-combinable" multimethods.
Raises the larger questions:
* should "combinability" be added (would anyone use it)?
* could it be added without further stomping performance?
* could it be added at all? (without lexical scoping
method combination is nigh on useless)
:before/:after/:around
"Wrapper" methods could be added if there were a demand for them.
Though providing them with lexical scoping would also be a bear :-(
call-next-method
I have two approaches to this functionality in my current alpha:
1. redispatch():
A subroutine that throws a
"Class::Multimethods::REDISPATCH" exception. This
exception is caught in the dispatcher and causes
the next most specific variant to be executed as
well. Doesn't return to the original variant, of
course, so we also need:
2. superclass():
Can be used to "cast" one or more multimethod
arguments which can then be used a nested call.
A manual (and more selective) approach to
redispatch.
:most-specific-first/:most-specific-last
Still working on this. Can be simulated with late/early nested
multimethod calls -- using superclass() -- but currently m-s-l
can't be achieved when using redispatch().
This last point (and define-method-combination) actually raises the
larger issue of variant selection. Currently Class::Multimethods
always selects breadth-first, most-specific-first. I'm not sure
whether it ought to provide hooks for other dispatch orders (or
who would use those hooks if they were provided). I'm also not sure
what the effect on dispatch performance would be, though I am currently
exploring that.
All in all, Class::Multimethods was designed to meet my own needs, and
is currently being extended to meet the expressed needs of others.
No-one has asked for the full power of CLOS multimethods, and until
they do, Class::Multimethods will remain as simple as I can make it.
For the sake of Tom's blood-pressure, if nothing else :-)
Damian
------------------------------
Date: 29 May 1999 00:10:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Y2K infected Perl code
Message-Id: <7inb92$1lk$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.11b8a67be8966326989b27@nntp.hpl.hp.com>:
> > In your infinite wisdom you may be interested to know that 5.00558 may
> > contain code not *that* dissimilar to the above suggestion.
>
> As history has shown you to be incapable of humor, Ilya,
Sorry to see you in the camp of the people who need smilies to
recognize humourous posts.
> I must take you seriously.
> I thought that DWIMming was based on syntactic analysis. Applying it to
> the contents of string literals takes it to new heights (depths?).
>
> s?printf '...19%d...', ..., $year, ...;
>
> will be next, I presume?
This is not "next". This is exactly what the next version of Perl may
detect (given that $year comes from localtime()).
Ilya
------------------------------
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 5824
**************************************