[8304] in Perl-Users-Digest
Perl-Users Digest, Issue: 1921 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 17 12:07:36 1998
Date: Tue, 17 Feb 98 09:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 17 Feb 1998 Volume: 8 Number: 1921
Today's topics:
Re: A Pubilc Apology. <*@qz.to>
Re: A Pubilc Apology. (John Moreno)
Re: A Pubilc Apology. <Paul.Makepeace@POBox.com>
Creating a socket and retrieving a file. <jaeguy@hotmail.com>
Re: Creating a socket and retrieving a file. <xxTony.Curtis@vcpc.univie.ac.at>
Re: Creating a socket and retrieving a file. <tchrist@mox.perl.com>
Re: File question <jduche@creighton.edu>
How to handle "..." in an XSUB? (Maestro)
Re: HUMOR: Userspeak vs Hackerspeak <jdporter@min.net>
Re: MS Visual Perl (A Satire!) <jdporter@min.net>
Re: New Perl module makes some functions run faster (Tony Bass)
Re: New perl programmer requesting comments (Andy Lester)
PerlShop (Scott)
Re: PerlShop <tchrist@mox.perl.com>
Please consider me for your project. <rickryan@datrixnet.com>
Re: Please consider me for your project. (Andy Lester)
Question on multipart/mixed. Pls Help! (stevenchan)
Re: Quick Reg Expression help (Jonathan Feinberg)
Re: RFC about ``Matt's Script Archive'' <rra@stanford.edu>
Re: some thoughts on RTFM/FAQ/newbies/moderated (Jonathan Feinberg)
Sort and packages <zkessin@lhr-sys.dhl.com>
Re: Stripping HTML tags in 5.004 (Abigail)
Re: Stripping HTML tags in 5.004 (Andy Lester)
Re: subroutine localtime <scp@cadcentre.co.uk>
Re: The Young Man and the Beach (Peter Samuelson)
use of conditional op in striphtml (by tchrist) (James Dudley)
Re: What does this mean? <barnett@houston.Geco-Prakla.slb.com>
Re: What does this mean? (Jonathan Feinberg)
Re: what is exaclty the "_" Variable ?!?! <juha@viisa.dna.fi>
Re: Year 2000 Compliance: Lawyers, Liars, and Perl (Steve Summit)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Feb 1998 15:07:21 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: A Pubilc Apology.
Message-Id: <eli$9802171002@qz.little-neck.ny.us>
Paul Makepeace <Paul.Makepeace@POBox.com> wrote:
> Eli the Bearded <*@qz.to> wrote in message ...
> >Leslie Mikesell <les@MCS.COM> wrote:
> >> but how do you make trn notice that there is a new article
> >> and the parent is 'yours'?
> >I autoselect anything with one of my message IDs in the References:
> >header. To get this to work right, I hacked Pnews to generate the
> >message IDs for me.
> >There are other ways to do it, but this seems to be the fastest.
> Quicker than (Outlook Express) View->Current View->Replies to my post? :-)
> That alone was enough to make me switch...
You come in from a weekend without reading news and there are 500
new messages. How long does it take your killfile to process them?
A single fixed string pattern match on an overview record header is
by far the fastest type of autoprocessing. I consider the day to
day time involved to be worth a lot more than the hour or so I spent
setting this up.
Elijah
------
most of the time was spent writing a general message ID generator
------------------------------
Date: Tue, 17 Feb 1998 10:30:46 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: A Pubilc Apology.
Message-Id: <A9F4E727B1FF7CBD.7298E9377187D94F.4BF7D1B7B3FE3647@library-proxy.airnews.net>
In comp.lang.perl.misc Paul Makepeace <Paul.Makepeace@POBox.com> wrote:
> Eli the Bearded <*@qz.to> wrote in message ...
> >Leslie Mikesell <les@MCS.COM> wrote:
> >> I know how to track followups after finding the parent article,
> >> but how do you make trn notice that there is a new article
> >> and the parent is 'yours'?
> >
> >I autoselect anything with one of my message IDs in the References:
> >header. To get this to work right, I hacked Pnews to generate the
> >message IDs for me.
> >
> >There are other ways to do it, but this seems to be the fastest.
>
> Quicker than (Outlook Express) View->Current View->Replies to my post? :-)
> That alone was enough to make me switch...
Switch to the Mac and get MacSOUP - you can turn it off for individual
subthreads, but it's the default and there's no way of turning it off in
general. And it's not just any message with one of your message ids in
the references, it's any message that follows in a unbroken chain - so
if somebody replies with references of just the immediate precursor and
it is in the chain then it get's marked.
--
John Moreno
------------------------------
Date: Tue, 17 Feb 1998 14:58:27 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: A Pubilc Apology.
Message-Id: <6cc8kd$nr7$1@rockcake.bt.net>
Eli the Bearded <*@qz.to> wrote in message ...
>Leslie Mikesell <les@MCS.COM> wrote:
>> I know how to track followups after finding the parent article,
>> but how do you make trn notice that there is a new article
>> and the parent is 'yours'?
>
>I autoselect anything with one of my message IDs in the References:
>header. To get this to work right, I hacked Pnews to generate the
>message IDs for me.
>
>There are other ways to do it, but this seems to be the fastest.
Quicker than (Outlook Express) View->Current View->Replies to my post? :-)
That alone was enough to make me switch...
PM
------------------------------
Date: Tue, 17 Feb 1998 15:36:37 -0000
From: "jaeguy" <jaeguy@hotmail.com>
Subject: Creating a socket and retrieving a file.
Message-Id: <6ccanv$oha$1@rockcake.bt.net>
I am trying to retrieve the header section of an html file from a given web
page. But NOT using the command line (eventually using $ENV{'QUERY_STRING'}
but that is unnessary at this time ($site = "http://web.server.com/file.txt)
will do!)
unfortuanatly I am a little new to perl but I am not new to the programming
world so I have a fair idea of what to mess with and what not to.
would anyone be able to give me some code to achieve this?
I will most certainly credit your work!
jae Young
Jaeguy@hotmail.com
------------------------------
Date: 17 Feb 1998 16:44:21 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Creating a socket and retrieving a file.
Message-Id: <7x4t1yqlre.fsf@beavis.vcpc.univie.ac.at>
Re: Creating a socket and retrieving a file., jaeguy
<jaeguy@hotmail.com> said:
jaeguy> html file from a given web page. But NOT using the
jaeguy> command line (eventually using $ENV{'QUERY_STRING'}
jaeguy> but that is unnessary at this time ($site =
jaeguy> "http://web.server.com/file.txt) will do!)
perldoc LWP
look on CPAN if you don't have it installed.
tony
------------------------------
Date: 17 Feb 1998 15:58:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Creating a socket and retrieving a file.
Message-Id: <6ccc31$st9$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"jaeguy" <jaeguy@hotmail.com> writes:
:I am trying to retrieve the header section of an html file from a given web
:page. But NOT using the command line (eventually using $ENV{'QUERY_STRING'}
:but that is unnessary at this time ($site = "http://web.server.com/file.txt)
:will do!)
:unfortuanatly I am a little new to perl but I am not new to the programming
:world so I have a fair idea of what to mess with and what not to.
:
:would anyone be able to give me some code to achieve this?
:I will most certainly credit your work!
This is covered in the standard perlfaq9 and perlipc manpages as shipped
with every version of perl a partir de 5.004. Please read them. They
are on your system. They have your answer.
Meanwhile, you really read these:
The CGI Newsgroup (NOT THIS ONE):
comp.infosystems.www.authoring.cgi
CPAN's Web-related modules in Perl:
http://www.perl.com/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/
The Idiot's Guide to solving Perl/CGI problems
http://www.perl.com/perl/faq/idiots-guide.html
Perl FAQs
http://www.perl.com/CPAN/doc/FAQs/
Perl Manpages (old)
http://www.perl.com/CPAN/doc/manual/html/
CGI FAQ
http://www.webthing.com/page.cgi/cgifaq
WWW Security FAQ
www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
Web FAQ
http://www.boutell.com/faq/
HTTP Spec
http://www.w3.org/TR/REC-html40/
http://www.w3.org/pub/WWW/Protocols/HTTP/
HTML Spec
http://www.w3.org/pub/WWW/MarkUp/
CGI Spec
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
_doprnt(pat, args, &fakebuf); /* what a kludge */
--Larry Wall, from util.c in the v5.0 perl distribution
------------------------------
Date: Tue, 17 Feb 1998 09:22:27 -0600
From: Virtual Joe <jduche@creighton.edu>
To: Gil Steiner <orange19@rocketmail.com>
Subject: Re: File question
Message-Id: <34E9AB33.F070A476@creighton.edu>
I'm not sure what you mean by "processing it", but if you merely wish to do
inline substitutions, you might try this from the command line:
# perl -pi -e 's/targetstring/newstring/' filename
Wildcard characters can be used to process multiple files. (I got this out of my
old perl4 camel book.)
Gil Steiner wrote:
> Hi
>
> I must have quite a big missunderstanding here, but I am new, so forgive
> me...
>
> How do I open a file, read each line, process it, and return it to the same
> file ?
> what I do now is open the file, read the lines and write them to a different
> file.
>
> Please POST the reply here.
>
> Thanks,
>
> +Gil
------------------------------
Date: 17 Feb 1998 15:45:26 GMT
From: thalerj@wwa.com (Maestro)
Subject: How to handle "..." in an XSUB?
Message-Id: <6ccbam$bcu$1@hirame.wwa.com>
I'm trying to write an XSUB interface to a library function that behaves
like fprintf. It takes a destination, format, and variable number of
arguments of any type. In this case, it belongs to HP's SICL library,
and sends a formatted string over an HPIB bus, but that's not important.
My .xs file contains the following:
int
iprintf(id,fmt,...)
INST id
char *fmt
The problem is this..
iprintf($rfgenerator, "FR 150.5 MZ"); # Works
iprintf($rfgenerator, "FR %3.4lf MZ", 150.5); # Function call passes with no
# errors, but does set the
# value in the instrument
It doesn't appear to pass in the optional arguments correctly. For fixed
strings with no additional arguments, it works great. Is there something
I'm missing? Am I supposed to handle the arguments myself in the XSUB and
call the library function? If so, how do I determine how to convert the
arguments, if I don't know ahead of time what type they are?
Thanks for your help,
-Jay Thaler
------------------------------
Date: Tue, 17 Feb 1998 09:44:17 -0500
From: John Porter <jdporter@min.net>
Subject: Re: HUMOR: Userspeak vs Hackerspeak
Message-Id: <34E9A241.7B7E@min.net>
Earl Hood wrote:
>
> Piers Cawley <pdcawley@bofh.org.uk> wrote:
> >> C:\ root#
> > ^^^^^
> >Oops, Tom just failed the sysadmin test. YM, '$', HTH, HAND.
>
> Depends on shell and how the root account is configured.
Uh, yah, I have my luser account prompt = root#, just to
freak people out.
John Porter
------------------------------
Date: Tue, 17 Feb 1998 10:13:07 -0500
From: John Porter <jdporter@min.net>
Subject: Re: MS Visual Perl (A Satire!)
Message-Id: <34E9A903.5481@min.net>
Chris Adams wrote:
>
> That would then be MS Visual PPP, or just PPP (to be confused with the
> Point-to-Point Protocol PPP). Didn't you see that last week, Bill Gates
> invented DNS, the Digital Nervous System? I think there must be a
> division at Microsoft that looks up acronyms in common use and thinks up
> new things for them to stand for.
Yeah, the other day I read a M$ marketing brochure in which
Baal Gates was quoted as using the phrase
Trusted Client Profile / Integrity Policy
Aack!
John Porter
------------------------------
Date: 17 Feb 1998 15:26:38 -0000
From: aeb@brains.cartoon.bt.co.uk (Tony Bass)
Subject: Re: New Perl module makes some functions run faster
Message-Id: <6cca7e$27a$1@brains.cartoon.bt.co.uk>
>From article <6cbd72$crs$1@monet.op.net>, by mjd-perl-memoize@plover.com:
> My new `Memoize' module may make some Perl functions faster. It does
> this by invisibly attaching a cache to the front of the function. If
> you call the function twice with the same arguments, the result is
> looked up in the cache and returned immediately, instead of being
> computed all over again.
> Full details, documentation, and distribution:
> http://www.plover.com/~mjd/perl/Memoize/
[...]
I enjoyed reading this. I have a few comments, I hope constructive,
quoting from view source code in the given URL.
=head1 OPTIONS
There are some optional options you can pass to C<memoize> to change
the way it behaves a little. To supply options, invoke C<memoize>
like this:
memoize(function, { TODISK => filename,
NORMALIZER => function,
INSTALL => newname
});
...
memoize('fib', INSTALL => 'fastfib')
These two confused me whether memoize expected any number of extra
pairs of parameters (which stylistically I would prefer) or an optional
second parameter a ref to hash. The source code
sub memoize {
my $fn = shift;
my $options = shift || {};
is evidently the latter, so the example should be
memoize('fib', +{INSTALL => 'fastfib'})
to correspond. Having a test suite and quoting examples from it can
help to catch this sort of thing.
=head1 CAVEATS
I am in two minds about how much is needed here, as any thoughtful
person will realise that there must be inherent restrictions to
memoizing, but it seems worth noting that the list given is by no means
exhaustive. For instance, use when a function argument references
mutable data
my $x = [42];
my $y1 = f($x);
$x->[0]++;
my $y2 = f($x);
is not sensible, and general binary strings
my $x = "a$;b";
my $y = f($x, $x);
can give trouble with the default normalizer. It might be better just
to replace a long list of caveats by an indication of relevant
implementation details and a warning to think about what one is doing.
no strict;
$cref = *{$name}{CODE}; # Magic
did not work when tested in isolation on my perl 5.001,
#! /usr/local/bin/perl -w
sub f {
print "f $_[0]\n";
}
my $name = 'main::f';
my $cref = *{$name}{CODE}; # Magic
&$cref(42);
with output
Can't use subscript on ref-to-glob cast at ./try2 line 8, near "{CODE}"
Execution of ./try2 aborted due to compilation errors.
Can one not more simply use \&,
#! /usr/local/bin/perl -w
use strict;
sub f {
print "f $_[0]\n";
}
my $name = 'main::f';
my $cref = \&$name;
&$cref(42);
with output
f 42
which worked even strictly? Though I expect some of the other uses of
{CODE} are unavoidable.
Tony Bass
--
# A E Bass Tel: (01473) 645305
# MLB 3/19, BT Laboratories e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE DO NOT e-mail to From: line
# Opinions are my own
------------------------------
Date: 17 Feb 1998 16:06:30 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: New perl programmer requesting comments
Message-Id: <6ccci6$egj$1@usenet49.supernews.com>
: $systime = `date`;
There are intrinsic ways in Perl to get the date, rather than having to
make an external call.
: $num_users = length(@who1)+1;
Get a copy of Camel II and read the 2nd paragraph on the length()
function. It's the one that says "Do not try to use length to find the
size of an array or hash."
: print "Content-type: text/html\n\n";
Take a look at the CGI.pm module that takes care of these things for you.
: if (@who1[0]) {
: for ($i; $i<=length(@who)+1; $i++) {
Again, length(@who) probably returns "1" or "2" or maybe even "3", not the
number of elements of @who.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Tue, 17 Feb 1998 15:18:18 GMT
From: njscott@snip.net (Scott)
Subject: PerlShop
Message-Id: <34eaaa29.902831@news.snip.net>
Anybody out there willing to help someone I know with a perlshop
shopping cart program?
He needs it installed to the server, customized for his individual use
in relation to the forms he's writing for a product he will be
selling.
Please email me back and I will forward your info on to him, thanx.
njscott@snip.net (Scott)
The Truth Is Out There" The X-Files
------------------------------
Date: 17 Feb 1998 15:55:47 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PerlShop
Message-Id: <6ccbu3$st9$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, njscott@snip.net writes:
:Anybody out there willing to help someone I know with a perlshop
:shopping cart program?
Perhaps someone on the CGI newsgroup.
The CGI Newsgroup (NOT THIS ONE):
comp.infosystems.www.authoring.cgi
CPAN's Web-related modules in Perl:
http://www.perl.com/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/
The Idiot's Guide to solving Perl/CGI problems
http://www.perl.com/perl/faq/idiots-guide.html
Perl FAQs
http://www.perl.com/CPAN/doc/FAQs/
Perl Manpages (old)
http://www.perl.com/CPAN/doc/manual/html/
CGI FAQ
http://www.webthing.com/page.cgi/cgifaq
WWW Security FAQ
www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
Web FAQ
http://www.boutell.com/faq/
HTTP Spec
http://www.w3.org/TR/REC-html40/
http://www.w3.org/pub/WWW/Protocols/HTTP/
HTML Spec
http://www.w3.org/pub/WWW/MarkUp/
CGI Spec
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
if (*name == '+' && len > 1 && name[len-1] != '|') { /* scary */
--Larry Wall, from doio.c in the v5.0 perl distribution
------------------------------
Date: Tue, 17 Feb 1998 09:58:30 -0600
From: "Rick Ryan" <rickryan@datrixnet.com>
Subject: Please consider me for your project.
Message-Id: <6ccb9q$o71@camel19.mindspring.com>
Please consider me for your project. My info follows:
--
Rick Ryan Web page : www.datrixnet.com
Datrix Voice : 615-822-7829
P.O. Box 2975 FAX : 615-824-0943
Hendersonville, TN 37077 E-mail : rickryan@datrixnet.com
------------------------------
Date: 17 Feb 1998 16:14:07 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Please consider me for your project.
Message-Id: <6ccd0f$egj$3@usenet49.supernews.com>
: Please consider me for your project. My info follows:
It's so refreshing to find someone who will deal with florists to prepare
for my wedding in June. That's a heck of a project I want nothing to do
with, and I appreciate your willingness. Let's talk privately about what
we want.
If that works, maybe you'd like to help with the "cleaning out the storage
space" project?
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Tue, 17 Feb 1998 15:26:45 GMT
From: stevenchan69@hotmail.com (stevenchan)
Subject: Question on multipart/mixed. Pls Help!
Message-Id: <34e9aa8e.8119702@208.149.121.250>
the result of the following program is "ok2" in the web browser,
but i am trying to get "okok2" in the web browser,
what's wrong with it?
pls help me,
thanks.
-----------------------------------------------------------
#!/usr/local/bin/perl
$|=1;
print "content-type: multipart/mixed ; boundary=end\n\n";
print "--end\n";
print "content-type: text/plain\n\n";
print "ok\n\n";
print "--end\n";
print "content-type: text/plain\n\n";
print "ok2\n\n";
print "--end--\n";
-----------------------------------------------------------
------------------------------
Date: Tue, 17 Feb 1998 09:53:25 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Quick Reg Expression help
Message-Id: <MPG.f536e6c24eff2309896ea@news.concentric.net>
dboorstein@shopcfn.com said...
: Jonathan Feinberg wrote:
: > "Whitespace" is not / /, it's /\s*/. If the difference is unclear to you,
:
: actually i believe it is more like /\s+/, except as you noted, it
: skips leading whitespace. try this example:
You're quite right; that was a thinko.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 17 Feb 1998 08:47:17 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: RFC about ``Matt's Script Archive''
Message-Id: <m3yaza6uwa.fsf@windlord.Stanford.EDU>
ssmieja <ssmieja@execpc.com> writes:
> I feel that there is an underlying current of hatred at old Perl 4 code
> by those who believe only in the OO model of Perl 5. Everyone screams
> rewrite but moving from a process orientation to an OO one ain't easy.
Perl 5 is not equivalent to "object oriented." I've written plenty of
Perl 5 code that has nary an object in sight. OO isn't the solution to
all of the world's problems, I agree, and Perl 5 doesn't force it on you.
> I use Perl 5 but code in Perl 4. Guess what, many of those wonderful
> CPAN modules don't build on a Windoze platform because the code isn't
> perl it is Un*x flavored C.
This also doesn't have anything to do with OO; this has to do with the
fact that pure Perl is *slow* for some things and quite simply can't do
other things. Many modules are written in C because that's the only way
to do what they do in a reasonable amount of time.
That being said, C is a cross-platform language that works just as well on
Windows as it does on Unix; if the C code is Unix-flavored, that's
probably due more to a lack of experience with non-Unix machines on the
part of the coder (along with crippled C support on some non-Unix
machines) than it has to do with C. If you report those as bugs to the
module developers, I'm sure they'll be happy to try to fix them for you.
> Stuff like MSA stay viable because they run, on any platform, with any
> version of perl. Something to think about that the next time you find
> yourself coding "require 5.004;"
I code require 5.004 quite a bit because I want the features that 5.004
offers. It's available for Windows, and is dramatically better and more
stable than 5.003 (let alone 4).
--
#!/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: Tue, 17 Feb 1998 10:21:18 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: some thoughts on RTFM/FAQ/newbies/moderated
Message-Id: <MPG.f5374fde08ed5a49896ec@news.concentric.net>
uri@sysarch.com said...
: say all postings
: could have a standard (for this group) header or string with a level of
: experience or question difficulty.
I'm sure that a detailed discussion of this notion could be a very long thread
on its own. I don't think it's possible to assign a number to most people's
expertise. For example, I have (what I think is) a good design sense, and
some ability to fashion good algorithms in code that's readable by other
humans, but must concentrate very hard to understand why <$fh[0]> is treated
like a glob and <$fh> isn't. So how "expert" am I? 5? 7.5? Maybe I should
add
X-PerlPurityTest: User
to my header.
: The mini FAQ should be sent out more often, maybe every other day since
: we get such a large number of newbies.
Hear, hear.
: so to end this quiet and long flame, please stop flaming newbies
: immediately.
I think a little fire is appropriate for someone who blunders in, doesn't lurk
for 5 minutes (which is all it would take in this group), doesn't read a FAQ,
and asks us to write a script to send mail from a web page.
On the other hand, there's a recent thread, "Quick Reg Expression help," that
featured several questions from an obvious beginner, who had read and
misunderstood sections of perlfunc, who lacked rudimentary understanding of
regexes, but who had at least *read a little of the docs*. That fellow got a
lot of help (and a lot of pointers to appropriate docs) from a lot of people,
some of whom are likely to be curt with the kinds of posts mentioned
immediately above.
: but most of all let's get this
: group back to a functional and useful state like it was when larry was
: still involved. i miss his daily wit and insight.
I've never had the pleasure. To me, it's like a myth of Shangri-La. But I
sure do enjoy having Tom around. I've learned a lot, fast.
--
#!/usr/bin/perl -w -- Just another Perl hacker,
(open 0),$_=<0>,s,.*-+ ,,,chop;for(split?@*?){($$_++or$}=$_,y,
y \,y,<STDIN>,,eval"sub $_ {print'$}'}"),y,} \,},>STDOUT,,&$_}
# Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 17 Feb 1998 15:57:47 +0000
From: Zachary Kessin <zkessin@lhr-sys.dhl.com>
Subject: Sort and packages
Message-Id: <m3pvkmi5qc.fsf@pc-hhu-52.lhr-sys.dhl.com>
I was working on some code the other day and I thought I would share
something I found, as I spent several hours figuring it out and it was
not clear from the Camel book:
If your are using a custom sort ordering method, and the method is not
in the same package as the place sort was called it causes a
problem. I was trying to sort a list. And to be reusable i figured to
make a module out of the thing. The problem when I called sort like
this
@sorted_list = sort myModule::sort_order @list;
and in sort_order "$a" and "$b" where not filled in. I moved
&sort_order into main and it worked fine. Perhaps I should have tried
"$main::a".
Just thought I would share that incase anyone ever runs into it again.
(I did get it to work eventaly)
--Zachary Kessin
------------------------------
Date: 17 Feb 1998 15:03:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Stripping HTML tags in 5.004
Message-Id: <6cc8rd$sq$1@client3.news.psi.net>
Russ Allbery (rra@stanford.edu) wrote on 1631 September 1993 in
<URL: news:m3u39y9y1n.fsf@windlord.Stanford.EDU>:
++ Abigail <abigail@fnx.com> writes:
++ > Russ Allbery (rra@stanford.edu) wrote:
++ >> Andrew Haylett <ajh@primag.co.uk> writes:
++
++ >>> "perldoc perlfaq9" yields the RE s/<(?:[^>'"]*|(['"]).*?\1)*>//gs,
++ >>> which works fine in 5.001 but bites the dust in 5.004 ("regexp *+
++ >>> operand could be empty").
++
++ >> At least by my eyeballing of it, s/<(?:[^>'"]+|(['"]).*?\1)*>//gs
++ >> should be equivalent and not have that problem.
++
++ > But it strips too much. 'a < b' is pure data.
++
++ I'm sorry, I don't see how either of these regexes would strip 'a < b'.
++ Could you explain further?
$ perl -w
$_ = "a < b implies b > a\n";
s/<(?:[^>'"]+|(['"]).*?\1)*>//gs;
print;
__END__
a a
$
The '<' in 'a < b' signifies "opening" a tag, and the regex will strip
out anything till the next '>' which isn't inside quotes. However,
'<' is only to be considered part of a tag if it's followed by a
character that can be part of a tag name.
Abigail
--
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;
print grep {$_{$_}} @_' < /usr/dict/words
------------------------------
Date: 17 Feb 1998 16:09:53 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Stripping HTML tags in 5.004
Message-Id: <6cccoh$egj$2@usenet49.supernews.com>
: Yes, I know I could go for HTML::Parse, which I assume works, but that
: is somewhat elaborate (and, I suspect, slow) for my quick-and-dirty
: requirements of munging a sentence or two, and I can't be sure that my
: ISP even has that module installed (this is for a CGI script, I should
: say).
If you have a quick'n'dirty requirement of "munging a sentence or two",
then why is HTML::Parse too slow?
It's a breeze. Really it is.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Tue, 17 Feb 1998 16:23:08 -0000
From: "S.Plant" <scp@cadcentre.co.uk>
Subject: Re: subroutine localtime
Message-Id: <6ccddq$eai$1@flex.news.pipex.net>
I think this is because you are passing the result of the
"$EventInfo->{TimeWritten}" process, when, when it has
worked it "0". Therefore, you are passing "0" to the localtime
functon.
Thus you are getting that date.
try :
$EventInfo->{TimeWritten};
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($EventInfo);
Thus passing the actual time, and not the result of the process
to localtime.
This could be wrong, of course ;)
Rgds
Simon Plant
Software Engineer
Cadcentre Ltd.
------------------------------
Date: 17 Feb 1998 10:27:43 -0600
From: psamuels@sampo.REMOVETHIS.creighton.edu (Peter Samuelson)
Subject: Re: The Young Man and the Beach
Message-Id: <6ccdpv$jv8$1@sampo.creighton.edu>
[John Bollenbacher <jhb@cts.com>, with lines properly M-q'd]
> I think that long-time participants in internet and computing in
> general forget how daunting it can all be to the neophyte. Try to
> cast your mind back to your first exposure to this all. Try
> imagining yourself as a university (or high school?) freshman who has
> just heard of the incredible information to be found in newsgroups.
> Without any other assistance, you discovered how to get your browser
> to show you the contents of comp.lang.perl.misc and you have never
> seen the letters FAQ before.
It's been said before: you don't just walk into a room and start
talking without first listening to what's going on. Why should a brand
new, scary, exciting medium like Usenet be different? This is what I
don't understand.
> Being inquisitive and a self-starter you post a question not even
> knowing where your questions will go or if anyone will actually see
> them.
That would seem kind of reckless to me. Usenet _was_ a little daunting
the first time I looked around ... so I was extra-careful to follow the
rules (i.e. netiquette) -- that is to say, _learn_ the rules -- and fit
in. I don't remember ever being flamed for lack of clue.
Tom C. keeps saying this and he's right: it's culturally different now.
When I got on it was with trn from Solaris. You had to know something
about what Usenet _was_ before you got very far. No more. Ever since
the news:// layer of abstraction, Usenet looks sorta like just one more
service probably broadcast by some company out to make a buck selling
banner ads -- which puts the end-user completely out of the give-back
mindset.
I really don't mean to sound elitist. I'm trying to say it isn't
completely the end-user's fault he sounds stupid and lazy. At least in
some cases. The whole idea of presenting Usenet through an integrated
web browser (gee, thanks, Netscape) and then allowing the popular media
to erase the distinction between "Internet" and "Web" -- perhaps some
people think of Usenet as an extension to the Web now. Who can blame
'em? Who ever heard of the netiquette of web surfing?
So what to do? About Them, of course? Dunno. I like the Christiansen
approach. I really do. That is to say, politely tell people they're
doing the wrong thing. Seek to educate, as opposed to spoon-feed.
Whoever gets offended by one of Tom's posts -- which I consider helpful
and/or humorous at least 97% of the time -- he/she ought to consider a
less interactive medium, perhaps. I can tell you this: if _my_ lines
wrapped funny, _I_'d want to be told it was a problem. If _my_ subject
lines too vague, _I_'d appreciate the tip. If _my_ question was
answered in the docs I didn't even realize I had (someone made a valid
point awhile back about "*.pod" being sort of non-obvious), getting
back not only an RTFM but the specific FM to R would be great.
Quit picking on Tom, everyone. He's doing the newusers a service.
Anyone who doesn't like that sort of service -- hey, go get your money
back.
> Now return your thoughts to the present. Doesn't it seem like having a
> canned reply that explains some of the basics of the net to send to
> this soul would go some distance to furthering that person's
> education while minimizing the net bandwidth dedicated to discussing
> topics like this?
There is one, at least for the basics of c.l.p.m., which is sent to
every non-munged address that hasn't posted before. If you want to do
more -- look on news.announce.newusers for some ideas of what to
include. Then go ahead.
--
Peter Samuelson
<sampo.creighton.edu ! psamuels>
------------------------------
Date: 17 Feb 1998 10:08:15 -0500
From: jdudley@access4.digex.net (James Dudley)
Subject: use of conditional op in striphtml (by tchrist)
Message-Id: <6cc94v$nld@access4.digex.net>
Hello, all.
I am planning to modify "striphtml," by Tom Christiansen, to
munge some html in a slightly different way. I am having trouble
understanding one line. The line is intended to strip out html
tags, and it looks like:
s{ < (?: [^>'"] | ".*?" | '.*?') + > }{}gsx;
My question is, what is the ?: doing here? There is a comment to
this part of the line, stating that this is a non-backreffing
grouping paren. So the ?: makes the parenthesis(es) non-back-
reffing? How?
FYI, what I will be trying to do with my modified script
is to take an html-ized Excel-run-through-Front-Page table,
de-htmlize it, (which puts it into what looks like a bunch of
short lists), then --the hard part-- join up SOME of the lines.
E.g., I have things that look like:
text1
text2
text3
and this line is really part
of text3 and somehow must be joined up
Eeeuw.
Thanks for the help.
Jane
(not James)
------------------------------
Date: Tue, 17 Feb 1998 08:11:18 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: What does this mean?
Message-Id: <34E99A86.5C36CEE9@houston.Geco-Prakla.slb.com>
James L. Taylor wrote:
>
> Hi All,
>
Hello.
> I'm reading the book "Learning Perl"
Good start.
> and I'm wondering if this chunk
> of code, is what causes the program to read my personal info off of my
> ISP or my system??
Depends. Where are you running the script? Your ISP's system: it
pulls info off the ISP's system. Your system: it pulls info off your
system.
>...It's the "hello world" program and after I
> inserted this section of code..I typed filename.pl and it said "Hello
> James Taylor"...is this section suppose to do that??
>
Well, not technically, no. Since there is no print statement, this
snippet is not performing what you asked about. All this section is
doing is as documented below:
> #!/usr/bin/perl
>
> &init_words;
Calls the init_words subroutine (not defined in this snippet)
> @password = getpwuid($<);
$< perl variable indicating your real userid (who you sign on as)
number
getpwuid read passwd file, looking for your userid number
= Assign results to
@password Array that receives the results of the getpwuid command
> $name = $password[6];
$password[x] Reference the xth member of array @password (0 based
array) In this example, x
= 6, which is the 7th member of the @password array.
= Assign that value to
$name Scalar variable 'name'
> $name =~ s/,.*//;
s/,.*//; Search through string for a comma, followed by ANY other
character (zero or more) and then
delete them.
=~ Search through, modify, and write changed information to
$name scalar variable 'name'
print "Hello $name\n";
would cause it to print "Hello James Taylor" followed by a new line, if
that is your real name. ;-)
Keep reading, and learning. At some point (in the near future?), you
will want the Blue Camel[1] as a reference guide, if nothing else. It
contains loads of wonderful stuff to say about the above.
>
> James L. Taylor
> www.bannerfx.com
> James L. Taylor
> www.bannerfx.com
[1] Programming Perl
Published by O'Reilly & Assosciates (http://www.ora.com)
Written by Larry Wall, Tom Christiansen & Randal L. Schwartz
ISBN: 1-56592-149-6
Hope that helps.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Tue, 17 Feb 1998 09:57:56 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: What does this mean?
Message-Id: <MPG.f536f83d646315d9896eb@news.concentric.net>
rra@stanford.edu said...
: passwd file. Traditionally, this includes your real name (in a field
: called GECOS for obscure reasons). It also includes your home directory,
http://www.netmeg.net/jargon/terms/g/gcos.html
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 17 Feb 1998 17:31:26 +0200
From: Juha Takala <juha@viisa.dna.fi>
Subject: Re: what is exaclty the "_" Variable ?!?!
Message-Id: <x7ra52gsdt.fsf@viisa.dna.fi>
Tom Christiansen <tchrist@mox.perl.com> writes:
> :That's because Perl doesn't have a special variable called "_"; it has
> :two completely different special variables, one called "$_" and another
> :called "@_".
>
> It also has a special identifier named "_", which is a filehandle.
But no %_ (yet :-). Any ideas of what (if any) it should be bound by
default to? In what context(s)?
-juha
------------------------------
Date: 17 Feb 1998 15:57:21 GMT
From: scs@eskimo.com (Steve Summit)
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6ccc11$a41$1@eskinews.eskimo.com>
In article <fl_aggie-1202981344090001@aggie.coaps.fsu.edu>, I R A Aggie writes:
> int tm_year; /* years since 1900 */
>
> That's fairly obvious that tm_year is an _offset_ from 1900, and that
> four_digit_year=1900+tm_year. If someone with any grasp of English can't
> deduce from that section of the man page that one has to _add_ 1900
> to the returned value tm_year, then perhaps they shouldn't be programming?
I have seen the equivalent of
tm.tm_hour = yyyy % 100;
in production code, and I've even had problems convincing the
maintainers of such code that it's anything to worry about.
You're right, there are programmers who probably shouldn't be,
but they are, and they just keep doing the most impossibly
boneheaded things. Working with 2-digit years seems to bring
the boneheadedness out in spades, which is why the y2k problem
is so pervasive...
Steve Summit
scs@eskimo.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 1921
**************************************