[9791] in Perl-Users-Digest
Perl-Users Digest, Issue: 3384 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 22:06:52 1998
Date: Thu, 6 Aug 98 19:00:18 -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 Thu, 6 Aug 1998 Volume: 8 Number: 3384
Today's topics:
Re: <BASE HREF= ...> and "access disallowed from script <rootbeer@teleport.com>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Marek Jedlinski)
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Abigail)
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in <tchrist@mox.perl.com>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Abigail)
Re: C extensions (Tye McQueen)
Re: c.l.p.moderated: not much traffic? (John Moreno)
Re: comp.lang.perl.announce redux <tchrist@mox.perl.com>
Re: comp.lang.perl.announce redux (Abigail)
Re: comp.lang.perl.announce redux <rra@stanford.edu>
How do I link a simple C function to a perl program in <dennis51@jps.net>
Re: Intriguing coderef question <metcher@spider.herston.uq.edu.au>
Re: password and DOS (Super-User)
Re: Perl Docs.. forget the original post (John Moreno)
Re: PERLDOC for Win32 ?? (Marek Jedlinski)
Re: re first language <corey@virtual-impact.com>
Re: reading passwords (Super-User)
Re: subroutine name (Super-User)
Re: Teaching Perl <metcher@spider.herston.uq.edu.au>
Re: variable indirection <tchrist@mox.perl.com>
Re: wildcards don't work with link function? <rootbeer@teleport.com>
Re: X-file (?=...), case postponed. (Abigail)
Re: X-file (?=...), case postponed. (Ilya Zakharevich)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 Aug 1998 01:43:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: <BASE HREF= ...> and "access disallowed from scripts ..."
Message-Id: <Pine.GSO.4.02.9808061841300.74-100000@user2.teleport.com>
On Thu, 6 Aug 1998, Joe Halbrook wrote:
> "JavaScript Error: http://www.my-domain.com/cgi-bin/first-script.pl,
This looks a lot like a JavaScript error, rather than a Perl error. It
seems as if your Perl code is fine, but it may not be doing what your
browser or server wants. The docs, FAQs, and newsgroups about JavaScript
and related topics may be able to give you better and more complete
answers about this than we can here. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 07 Aug 1998 00:58:51 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <35cd4984.18397799@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
"Joel Noble" <jnoble@mediaone.com> wrote:
>> Content-Type: text/plain
>> Content-Encoding: x-gzip
>
<snip>
>However, on reading the HTTP 1.1 draft release 3
>(http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-rev-03.txt),
>I have to say that the Content-Type is not the issue. Apparently, the
>content-type of text-plain, being what you get after you undo the
>Content-Encoding, is reasonable and correct.
Correct, but suboptimal, since it asks the browser to decode before
displaying the contents, which isn't always desirable.
Plus, as you did mention, RFC2068 gives "gzip", not "x-gzip" (but I don't
expect that would make a difference in this case).
>Not that I don't doubt that some browsers may look at the Content-Type and
>ignore the Content-Encoding. :(
<snip>
Netscape certainly honors content-encoding (in other cases) when it knows
how to handle it. Since windoze systems don't normally know about gzip,
Netscape cannot but display it as plain text. However, if Content-*Type*
was set to something like "compressed/gzip" then Netscape would ask how to
handle it, and I could point it to gzip.exe on my disk.
Suggested solution: since gzip is unix-centric anyway, please provide a
.zip archive version as well.
Suggested solution #2: for win95 people, get a free http & ftp downloader
app from
http://www.kulichki.com/~vampire/
It will save web documents to your disk (with restart), including the
http://language.perl.com/info/PerlDoc-5.005_02.txt.gz
Worked for me :)
.marek
--
General Frenetics, Discorporated: http://www.lodz.pdi.net/~eristic/
"The war isn't the war between the blacks and the whites, the liberals
and the conservatives, or the Federation and the Romulans. It's between
the clueful and the clueless." (an anonymous poster on Cypherpunks list)
------------------------------
Date: 7 Aug 1998 01:29:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qdl9g$ahn$3@client3.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCI September
MCMXCIII in <URL: news:6qd7lc$i8p$1@csnews.cs.colorado.edu>:
++ [courtesy cc of this posting sent to cited author via email]
++
++ In comp.lang.perl.misc,
++ "Joel Noble" <jnoble@mediaone.com> writes:
++ :Tom, Brian's right. The server's sending it as text/plain. That is wrong.
++ :The browser is free to assume it can change line-endings, etc., since it was
++ :TOLD by the server that it was text.
++
++ Then why does it work for me with Netscape or with LWP?
Perhaps you are on a different platform?
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: 7 Aug 1998 01:20:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qdkpd$6iv$1@csnews.cs.colorado.edu>
Keywords: If you're happy and you know it, clunk your chains.
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
cicho@polbox.com (Marek Jedlinski) writes:
:Suggested solution: since gzip is unix-centric anyway, please provide a
:.zip archive version as well.
No, sir. CPAN is in .tar.gz format. You're talking about four thousand,
one hundred and ninety-two files to duplicate. If the Windows folks
want to play on the net, then they need to cope with the norms here.
--tom
--
"A journey of a thousand miles continues with the second step." --Larry Wall
------------------------------
Date: 7 Aug 1998 01:46:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qdma7$aoj$1@client3.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCI September
MCMXCIII in <URL: news:6qd7s3$i8p$2@csnews.cs.colorado.edu>:
++ [courtesy cc of this posting sent to cited author via email]
++
++ In comp.lang.perl.misc,
++ "Joel Noble" <jnoble@mediaone.com> writes:
++ :Tom, Brian's right. The server's sending it as text/plain. That is wrong.
++ :The browser is free to assume it can change line-endings, etc., since it was
++ :TOLD by the server that it was text.
++ :
++ :Microsoft is plenty blameworthy in general. But not in this case.
++
++ Hold on.
++
++ 200 OK
++ Connection: close
++ Date: Thu, 06 Aug 1998 21:38:09 GMT
++ Accept-Ranges: bytes
++ Server: Apache/1.2.6 mod_perl/1.11
++ Content-Encoding: x-gzip
++ Content-Length: 963743
++ Content-Type: text/plain
++ ETag: "7107-eb49f-35c5fe60"
++ Last-Modified: Mon, 03 Aug 1998 18:16:00 GMT
++ Client-Date: Thu, 06 Aug 1998 21:38:09 GMT
++ Client-Peer: 208.201.239.48:80
++
++
++ The content-encoding is indeed x-gzip. Are you saying it should
++ be x-gtar instead?
The Content-Type is wrong. Even after unzipping, it's still *not*
text/plain. Poking around in RFC 2068 learns the Content-Encoding
is wrong as well. It should be "gzip", not "x-gzip".
++ I have never seen a problem with this once a Unix box.
To complicate matters even more:
19.4.1 Conversion to Canonical Form
MIME requires that an Internet mail entity be converted to canonical
form prior to being transferred. Section 3.7.1 of this document
describes the forms allowed for subtypes of the "text" media type
when transmitted over HTTP. MIME requires that content with a type of
"text" represent line breaks as CRLF and forbids the use of CR or LF
outside of line break sequences. HTTP allows CRLF, bare CR, and bare
LF to indicate a line break within text content when a message is
transmitted over HTTP.
Where it is possible, a proxy or gateway from HTTP to a strict MIME
environment SHOULD translate all line breaks within the text media
types described in section 3.7.1 of this document to the MIME
canonical form of CRLF. Note, however, that this may be complicated
by the presence of a Content-Encoding and by the fact that HTTP
allows the use of some character sets which do not use octets 13 and
10 to represent CR and LF, as is the case for some multi-byte
character sets.
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: 6 Aug 1998 19:15:08 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: C extensions
Message-Id: <6qdguc$kj0@fumnix.metronet.com>
Dan Nguyen <nguyend7@msu.edu> writes:
) I'm been messing around with writing C extensions for perl. My
) problem is I want my function to use $_ when there isn't an argument
) passed to it. I can do it in perl, but I'm not sure of the C code to
) place in my XS file.
Then do it in Perl. I _hate_ perl code written in XS. Make
your XS routine simple to write in C and do the stuff that
is simple in Perl by having a Perl routine that calls the
XS routine.
The two routines will need different names. For some cases, it
is a good idea to just put a "_" in front of the XS routine name
(which by convention means the routine is for "internal use" only,
ie. to be used by the module itself, not by scripts that use the
module).
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Thu, 6 Aug 1998 20:32:28 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <1ddcwv8.1bwysx21xh8r6wN@roxboro0-053.dyn.interpath.net>
Craig Berry <cberry@cinenet.net> wrote:
> Matt Knecht (hex@voicenet.com) wrote:
> :
> : I'm enjoying clpm just for the lurk value. Not many threads, but most
> : of them have been interesting, and content rich. Definitly a great
> : group.
>
> You've just illustrated one of my least favorite things about
> clp.moderated -- it raised from 2 to 3 the clp*m* ambiguity count.
Someone else reads comp.lang.pascal.mac? Cool.
--
John Moreno
------------------------------
Date: 7 Aug 1998 00:05:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6qdgbr$3r7$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, sitaram@diac.com (Sitaram Chamarty) writes:
:If it is automatic, can you give us an outline of how you go about
:it? Thanks.
Well, I once tried Markov chains, but my algorithm was too duncely
to do the job in reasonable time.
--tom
--
I think it's a new feature. Don't tell anyone it was an accident. :-)
--Larry Wall on s/foo/bar/eieio in <10911@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 7 Aug 1998 01:25:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6qdl2u$ahn$1@client3.news.psi.net>
Russ Allbery (rra@stanford.edu) wrote on MDCCCI September MCMXCIII in
<URL: news:m3yat1n7tv.fsf@windlord.Stanford.EDU>:
++ Abigail <abigail@fnx.com> writes:
++ > Russ Allbery (rra@stanford.edu) wrote on MDCCCI September MCMXCIII:
++
++ >> I don't know if anyone has pointed this out yet, but....
++
++ >> de.comp.lang.perl
++ >> fj.comp.lang.perl
++ >> fr.comp.lang.perl
++ >> han.comp.lang.perl
++ >> it.comp.lang.perl
++ >> no.it.programmering.perl
++ >> relcom.comp.lang.perl
++
++ >> would seem to be the appropriate places to post articles about Perl in
++ >> German, Japanese, French, Korean, Italian, Norwegian, and Russian.
++
++ > Actually, I would expect them to be appropriate places to post articles
++ > about Perl in Germany, Japan, France, Korea, Italy, Norway and Russia. A
++ > small, but essential difference.
++
++ Yes, but you're wrong. None of those hierarchies with the possible
++ exception of relcom.* are regional hierarchies. They're all world-wide
++ *language* hierarchies.
That would still leave many languages without their own hierarchie.
Dutch for instance. Sure, there's an nl.* hierarchie, but those nl stand
for the Netherlands. There's no du.* hierarchie that I know about.
I wonder what the uk.* hierarchie is about - postings in English? ;)
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: 06 Aug 1998 18:35:42 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: comp.lang.perl.announce redux
Message-Id: <m3ww8lfua9.fsf@windlord.Stanford.EDU>
Abigail <abigail@fnx.com> writes:
> That would still leave many languages without their own hierarchie.
> Dutch for instance. Sure, there's an nl.* hierarchie, but those nl stand
> for the Netherlands. There's no du.* hierarchie that I know about.
Granted. There was a similar situation with Spanish until recently, when
the esp.* hierarchy was created. (es.* is regional to Spain.)
> I wonder what the uk.* hierarchie is about - postings in English? ;)
Regional to the United Kingdom.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Thu, 06 Aug 1998 17:29:40 -0700
From: Dennis Yelle <dennis51@jps.net>
Subject: How do I link a simple C function to a perl program in WIN95 ?
Message-Id: <35CA4A74.8F1477CD@jps.net>
I was looking at
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
#Where_can_I_learn_about_linking_
Where I saw this:
Where can I learn about linking C with Perl? [h2xs, xsubpp]
If you want to call C from Perl, start with the perlxstut manpage,
moving on to the perlxs manpage, the xsubpp
manpage, and the perlguts manpage.
If you want to call Perl from C, then read the perlembed manpage,
the perlcall manpage, and the perlguts manpage.
Don't forget that you can learn a lot from looking at how the
authors of existing
extension modules wrote their code and solved their problems.
Well, OK, that doesn't look right.
Here it is again:
<HR>
<H2><A NAME="Where_can_I_learn_about_linking_">
Where can I learn about linking C with Perl? [h2xs, xsubpp]
</A></H2>
If you want to call C from Perl, start with
<A HREF="perlxstut.html">the perlxstut manpage</A>,
moving on to <A HREF="perlxs.html">the perlxs manpage</A>,
<A HREF="../utils/xsubpp.html">the xsubpp manpage</A>, and
<A HREF="perlguts.html">the perlguts manpage</A>.
If you want to call Perl from C, then read
<A HREF="perlembed.html">the perlembed manpage</A>,
<A HREF="perlcall.html">the perlcall manpage</A>, and
<A HREF="perlguts.html">the perlguts manpage</A>.
Don't forget that you can learn a lot from looking at how the authors
of
existing extension modules wrote their code and solved their problems.
<P><P><HR>
But all of those links were broken, or, at least,
none of them worked for me using Netscape 4.05.
So, how can I link a simple C function to my perl program?
I am running from the DOS command line in WIN95.
Is this an easy thing to do, or do I have to read 3 books to
learn how to do it?
Dennis
------------------------------
Date: Fri, 07 Aug 1998 11:15:37 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Intriguing coderef question
Message-Id: <35CA5539.8C11B19F@spider.herston.uq.edu.au>
When you say the code is dynamically generated, surely you mean the perl
source is dynamically generated? And then compiled in an eval or
require or some such? In which case, your program already knows the
code source, n'est ce pas?
Aravind Subramanian wrote:
>
> If $coderef is a reference to an anonymous subroutine as:
>
> $coderef = sub { print "Boink!\n"; };
>
> To execute the subroutine the statement would be:
>
> &$coderef;
>
> and the result would be:
>
> Boink!
>
> Question: how do I print the contents of the subroutine? In other words
> how do I print (or assign to a scalar var) the statments in the
> subroutine as opposed to the results from these as:
>
> sub { print "Boink!\n"; }
>
> The need for this is that the code in the anon subroutine is dynamically
> generated and I'd like the users to see the results of the code as well
> as the code itself.
>
> I'd appreciate any suggestions.
>
> Thanks
>
> aravind
------------------------------
Date: 7 Aug 1998 00:19:42 GMT
From: root@comdyn.com.au (Super-User)
Subject: Re: password and DOS
Message-Id: <6qdh6u$8bt$2@nswpull.telstra.net>
In article <6q73u3$9bo$1@nnrp1.dejanews.com>,
b_redeker@hotmail.com writes:
> Does anyone know how to solve this?
This is the THIRD copy of this post of yours.
See my other answer: Read perlfaq8
# perldoc perlfaq8
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Thu, 6 Aug 1998 20:41:23 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <1ddcxbn.hh9lc6eymphcN@roxboro0-053.dyn.interpath.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> In comp.lang.perl.misc, jdporter@min.net writes:
>
> :> I'm sorry that this is a shock, but perl is a unix tool.
>
> :Ok. And it's a Windows tool; and a OS/2 tool, and a Mac tool, and
> :a VMS tool...
>
> If one were to run vi or emacs under OS/2, would that act ipso facto
> make them `OS/2 tools'? I'm not sure I agree.
No, but it means it's no longer a 'unix only tool'. Getting and
installing MacPerl was as simple as downloading a file (well there was
some problem with the pod reader, but that went away in a latter
release). This is as easy as it is to install it on many unixes.
--
John Moreno
------------------------------
Date: Fri, 07 Aug 1998 00:58:37 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: PERLDOC for Win32 ??
Message-Id: <35ce4d51.19371129@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
Charles Maier <maierc@chesco.com> wrote:
>> Get the GS binary dist:
>>
>> http://www.perl.com/CPAN-local/ports/win32/Standard/x86/perl5.00402-bindist04-bc
>> .tar.gz
>
>
>LOL... a "tar.gz" binary release for a Win32 executable?
I know what you mean :) There's also a zip archive of the same dist:
http://www.perl.com/CPAN/authors/id/GSAR/perl5.00402-bindist04-bc.zip
but the .gz file is smaller by a meg!
.marek
--
General Frenetics, Discorporated: http://www.lodz.pdi.net/~eristic/
"The war isn't the war between the blacks and the whites, the liberals
and the conservatives, or the Federation and the Romulans. It's between
the clueful and the clueless." (an anonymous poster on Cypherpunks list)
------------------------------
Date: Fri, 07 Aug 1998 00:54:10 GMT
From: Corey <corey@virtual-impact.com>
Subject: Re: re first language
Message-Id: <Pine.LNX.3.95.980806174730.6520K-100000@rainier.virtual-impact.com>
On Thu, 6 Aug 1998, Steve Palincsar wrote:
> >
> > Also, I would like to mention, that if I could be a cook, I would be
> > very happy.
>
> Learning perl won't hely you with cooking either. ;-)
>
Yes, but through Perl he may perhaps gain insight into the
Three Great Virtues - which may very well apply to cooking
as it does to programming ...
Beers,
Corey
corey@virtual-impact.com
"We tend to scoff at the beliefs of the ancients, but we
can't scoff to them personally, to thier faces - and this
is what really annoys me."
-- Jack Handy
------------------------------
Date: 7 Aug 1998 00:17:46 GMT
From: root@comdyn.com.au (Super-User)
Subject: Re: reading passwords
Message-Id: <6qdh3a$8bt$1@nswpull.telstra.net>
[No reason to post this twice]
In article <6q73ie$8cr$1@nnrp1.dejanews.com>,
b_redeker@my-dejanews.com writes:
> hi,
>
> does anyone know how in DOS/Win you can read a password from STDIN without
> showing it to the user (and, more importantly, everyone looking over his
> shoulder?)
# perldoc perlfaq8
How do I ask the user for a password?
[snip]
You can also do this for most systems using the
Term::ReadKey module from CPAN, which is easier to use and
in theory more portable.
If you use the GS port for perl, it should be included, I think.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 7 Aug 1998 00:35:27 GMT
From: root@comdyn.com.au (Super-User)
Subject: Re: subroutine name
Message-Id: <6qdi4f$a2q$1@nswpull.telstra.net>
In article <35C76123.87C45F55@nortel.ca>,
Bob Lockie <bjlockie@nortel.ca> writes:
> How can I get the name of the currently running subroutine?
>
> I can use the function "caller" to get the package, file, line.
and more
> I want to log the executing subroutine.
# perldoc -f caller
[snip]
With EXPR, it returns some extra information that the debugger uses to
print a stack trace. The value of EXPR indicates how many call frames
to go back before the current one.
($package, $filename, $line, $subroutine,
$hasargs, $wantarray, $evaltext, $is_require) = caller($i);
[snip]
Use the EXPR 0 to get info about the current sub, and (you might guess
it) 1 to get info about the sub that called this one.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Fri, 07 Aug 1998 11:05:39 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Teaching Perl
Message-Id: <35CA52E3.FADA4097@spider.herston.uq.edu.au>
John Porter wrote:
>
> Tom Christiansen wrote:
> >
> > [courtesy cc of this posting sent to cited author via email]
> >
> > I think a reasonable argument could be made the other way:
> > that more people need data munging, massaging, and verifying
> > than those who need complex data structures or OOOP.
>
> Good point. But in my experience, the vast majority of my
> programs use gobs of complex data structures (not necessarily
> OO), and a mere smattering of simple regexes.
> So naturally I teach people to write the way I write.
>
>From an advocacy point of view (if we're trying to "sell" perl as well
as teach it), regexes are vital. Complex data structures are always
going to look complex. Something like:
while (<>) {
print if /something/;
}
is just breathtaking (particularly to PoBs not raised on awk and sed) -
lots of people can see immediately how that's going to make their life
easier.
Another example - find the username on Win32 the quick and dirty way:
`net config` =~ /User name\s*(\S*)\n/; $username = $1;
The amount of code, money and desk space (have you seen the Win32 API
docs?) I save every time I do that is staggering. It's not good enough
for saleable programs, but for "get the job done right now" sysadms -
well, people's eyes light up when they see this kind of thing.
--
Jaime Metcher (deeply appreciative of all the people who *do* take the
time to write robust software).
------------------------------
Date: 7 Aug 1998 00:48:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: variable indirection
Message-Id: <6qdita$5gm$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, ioioio@my-dejanews.com writes:
:I have a newbie question about variable indirection (if that is the right way
:of saying it). Anyway, say
:
:$a='good';
:$b='a';
:
:Is it possible to make $b to evaluate to 'good' through its own value?
:I was thinking ${$b} would do the trick. Obviously, it doesn't.
Yes, it does, actually. Unless $a is a lexical rather than a dynamic,
in which case you can't bounce through the package symbol table hash.
But why don't you just use your own hash? It's so much easier?
my (%names;
$names{"a"} = 'good';
my $b = 'a';
print $var{$b};
So while you could do this if they're dynamics:
$\ = "\n";
$where = 'boulder';
$boulder = 'colorado';
$colorado = 'usa';
$usa = 'earth';
print $where; # boulder
print $$where; # colorado
print $$$where; # usa
print $$$$where; # earth
You really should do this:
$\ = "\n";
my $where = 'boulder';
my %in = (
boulder => 'colorado',
colorado => 'usa',
usa => 'earth',
);
print $where; # boulder
print $in{$where}; # colorado
print $in{ $in{$where} }; # usa
print $in{ $in{ $in{$where} } }; # earth
Or even:
my $where = 'boulder';
my %in = (
boulder => 'colorado',
colorado => 'usa',
usa => 'earth',
);
do { print "$where\n" } while $where = $in{$where};
--tom
--
Someone who truly understands UNIX not only understands why "rm *"
screws you, but understands why IT HAS TO BE THAT WAY.
------------------------------
Date: Fri, 07 Aug 1998 01:46:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: wildcards don't work with link function?
Message-Id: <Pine.GSO.4.02.9808061843590.74-100000@user2.teleport.com>
On Thu, 6 Aug 1998, Brett Goldstock wrote:
> It looks like the link function will accept neither wildcards nor
> directories (without a file) as arguments. Is there a way around this?
You can't make arbitrary hard link to a fileglob or a directory on a Unix
type filesystem. Maybe you want to make a symbolic link? But I'm not sure
why you'd want a symlink to (or from?) a fileglob.
> Alternatively, is there some code lying around somewhere to take a
> wildcard filename and return the real filenames?
It sounds as if you want the glob function. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 7 Aug 1998 01:27:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qdl67$ahn$2@client3.news.psi.net>
Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCCI September
MCMXCIII in <URL: news:6qd3vc$5n2$1@mathserv.mps.ohio-state.edu>:
++
++ [ Do not ask why with /(?=.*)/ the frog restarts at the same place as
++ the previous time, but returns a different result - it is a smart
++ frog. ]
That's a documented feature.
Abigail
--
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
for (s;s;s;s;s;s;s;s;s;s;s;s)
{s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
------------------------------
Date: 7 Aug 1998 01:42:02 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qdm1a$97h$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6qdl67$ahn$2@client3.news.psi.net>:
> Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCCI September
> MCMXCIII in <URL: news:6qd3vc$5n2$1@mathserv.mps.ohio-state.edu>:
> ++
> ++ [ Do not ask why with /(?=.*)/ the frog restarts at the same place as
> ++ the previous time, but returns a different result - it is a smart
> ++ frog. ]
> That's a documented feature.
Good! So it is a smart documented frog!
Ilya
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3384
**************************************