[30264] in Perl-Users-Digest
Perl-Users Digest, Issue: 1507 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 3 21:09:46 2008
Date: Sat, 3 May 2008 18:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 3 May 2008 Volume: 11 Number: 1507
Today's topics:
Re: FAQ 3.23 Can I write useful Perl programs on the co <benkasminbullock@gmail.com>
Re: FAQ 3.23 Can I write useful Perl programs on the co <someone@example.com>
Re: FAQ 4.20 How do I unescape a string? <szrRE@szromanMO.comVE>
Re: Perl 6 <uri@stemsystems.com>
Re: Read 20 lines when pressing n for next <uri@stemsystems.com>
Re: Read 20 lines when pressing n for next <get@bentsys.com>
Re: Read 20 lines when pressing n for next <jurgenex@hotmail.com>
Re: Read 20 lines when pressing n for next <uri@stemsystems.com>
Re: Stuffing @users into $self->{'users'} <ben@morrow.me.uk>
Re: Stuffing @users into $self->{'users'} xhoster@gmail.com
weird issue with HTML::TokeParser and Fork arik@blue-linedesign.com
Re: weird issue with HTML::TokeParser and Fork <benkasminbullock@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 3 May 2008 23:55:50 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: FAQ 3.23 Can I write useful Perl programs on the command line?
Message-Id: <fviu26$f7m$1@ml.accsnet.ne.jp>
On Sat, 03 May 2008 12:03:02 -0700, PerlFAQ Server wrote:
> 3.23: Can I write useful Perl programs on the command line?
Has anybody ever, even once, asked this question, or even something
similar to it? I just can't imagine anybody asking that kind of question.
------------------------------
Date: Sun, 04 May 2008 00:28:41 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: FAQ 3.23 Can I write useful Perl programs on the command line?
Message-Id: <Zq7Tj.229$Yp.182@edtnps92>
Ben Bullock wrote:
> On Sat, 03 May 2008 12:03:02 -0700, PerlFAQ Server wrote:
>
>> 3.23: Can I write useful Perl programs on the command line?
>
> Has anybody ever, even once, asked this question, or even something
> similar to it? I just can't imagine anybody asking that kind of question.
Yes, but usually in comp.unix.shell or a group with *unix* in it.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Sat, 3 May 2008 12:22:43 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: FAQ 4.20 How do I unescape a string?
Message-Id: <fvie2302amq@news4.newsguy.com>
PerlFAQ Server wrote:
> This is an excerpt from the latest version perlfaq4.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
>
> --------------------------------------------------------------------
>
> 4.20: How do I unescape a string?
>
> It depends just what you mean by "escape". URL escapes are dealt
> with in perlfaq9. Shell escapes with the backslash ("\") character
> are removed with
>
> s/\\(.)/$1/g;
>
> This won't expand "\n" or "\t" or any other special escapes.
This will:
$ perl -Mstrict -e '
my $s=q{12\t3 \* 456 \n 789};
$s =~ s/\\(.)/"\"\\$1\""/gee;
print $s
'
12 3 * 456
789
:-)
--
szr
------------------------------
Date: Sat, 03 May 2008 19:02:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl 6
Message-Id: <x763tvb498.fsf@mail.sysarch.com>
>>>>> "SB" == Stephan Bour <sbour@niaid.nih.gov> writes:
SB> } you are declaring yourself to be a fool with that statement.
SB> No, it is you who continually make a fool of themselves.
nah, i only am a discontinous fool. i have sharp level jumps all over
the place.
SB> } please shut up before we drop the assumption of foolishness and label
SB> } it a fact.
SB> You sure like telling people to "shut up"... were you bullied a lot in
SB> primary school? Stop pretending you are king-of-Perl-land and pull your
SB> head out of your ass and stop defending things for the pure sake of
SB> defending and stop ignoring reality.
i am a one eyed king in the land of blind perl kiddies!
SB> } i know many of the perl6 developers personally and what you said is
SB> } insulting to them.
SB> If you cannot take basic criticism, then don't create anything. Move
SB> to Antarctica, as I'm sure you could code without fear of criticism from
SB> the penguins.
basic criticism? i hate basic. i am very critical of it.
SB> } also none of them are convicted murderers AFAIK.
SB> So what? Stop making all these bloody non-points, and please try to make
SB> some sense.
you obviously don't read slashdot or know about reiser. have some more
fun and read something else for a change.
i make enough sense to be understood by those i want to understand
me. works fine.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sat, 03 May 2008 18:59:22 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Read 20 lines when pressing n for next
Message-Id: <x7abj7b4dz.fsf@mail.sysarch.com>
>>>>> "GE" == Gordon Etly <get@bentsys.com> writes:
GE> Uri Guttman wrote:
>> Gordon Etly <get@bentsys.com> writes:
>> > Uri Guttman wrote:
>> > > but i don't attack your character as you have shown none. all you
>> > > have done is flame about how others post here.
>> >
>> > With all due respect, all I am guilty of is having opinions (which
>> > happens to be contrary to your own view in both cases.) If anyone
>> > did
>> > any "flaming", it was people like you that turned a simple point
>> > into a kill-the-heretic.
>> >
>> > You don't agree with someone, fine. But don't make it your personal
>> > vendetta.
>>
>> it isn't personal.
GE> You keep making it so. Every thread I make a comment or some point on
GE> something, instead of addressing it's merits or cons, you turn it into
GE> your own personal holy war. You did exactly that in the thread
GE> concerning the usage of "PERL" and you've been doing it again here.
you haven't made one TECHNICAL comment about perl code that i have
seen. that is the gist of this group. you have always commented on how
someone else posts or barely topical stuff like PERL vs perl. your
latest was how others (and i) judged a post as homework. and you
followed up to my post (one of several) which tags you as more obsessed
with me than even just the thread. try actually commenting on perl code
problems for a change.
>> you attacked first on my homework comment
GE> It wasn't an attack, it was a comment. By posting, you are inviting
GE> comments. If you cannot accept this, you should not be posting on UseNet
GE> (or any other public message forum.)
GE> If you bothered to actually check, my first reply was to A. Sinan Unur,
GE> not you. Yeah, you really don't have a personal agenda here, right?...
>> go away before i taunt you a further time. your mother was a
>> hampster. i fart in your general direction.
GE> "...than to open your mouth and remove all doubt."
you said and proved it. i have been helping with real perl issues here
(and elsewhere) for decades (about 1.5 of them). i have nothing to prove
to you. you have tons to prove here.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sat, 3 May 2008 12:45:31 -0700
From: "Gordon Etly" <get@bentsys.com>
Subject: Re: Read 20 lines when pressing n for next
Message-Id: <683tmsF2qp1rdU1@mid.individual.net>
Uri Guttman wrote:
> Gordon Etly <get@bentsys.com> writes:
> > Uri Guttman wrote:
> > > Gordon Etly <get@bentsys.com> writes:
> > > > Uri Guttman wrote:
> > > > > but i don't attack your character as you have shown none. all
> > > > > you have done is flame about how others post here.
> > > >
> > > > With all due respect, all I am guilty of is having opinions
> > > > (which happens to be contrary to your own view in both cases.)
> > > > If anyone did any "flaming", it was people like you that
> > > > turned a simple point into a kill-the-heretic.
> > > >
> > > > You don't agree with someone, fine. But don't make it your
> > > > personal vendetta.
> > >
> > > it isn't personal.
> >
> > You keep making it so. Every thread I make a comment or some point
> > on
> > something, instead of addressing it's merits or cons, you turn it
> > into your own personal holy war. You did exactly that in the thread
> > concerning the usage of "PERL" and you've been doing it again here.
>
> you haven't made one TECHNICAL comment about perl code that i have
> seen.
So what? Point me ot a rule that says every question has to be a
"technical" one or sod off. Anyone can comment on someone else post,
which you invite by posting in the first place. If you can't handle it,
don't post.
> that is the gist of this group. you have always commented on how
> someone else posts or barely topical stuff like PERL vs perl.
By posting you invite comments, if you can't handle it, then don't post.
And would you care to tell me how making a point about something found
in the documentation of Perl to be off topic in a Perl news group?
> your latest was how others (and i) judged a post as homework.
And I simply commented that that is a judgement, which is based on an
assumption that could be entirely wrong. Anyone has the right to post a
comment, and you invite comments by posting, so if you cannot handle it,
don't post.
> and you followed up to my post (one of several) which tags you as more
> obsessed with me than even just the thread.
My initial comment in this thread was not you, so get over it. It was a
general comment made when I first saw it. In the words of late Chris
Farly (RIP), "whooptie freakin' doo"
> > > you attacked first on my homework comment
> >
> > It wasn't an attack, it was a comment. By posting, you are inviting
> > comments. If you cannot accept this, you should not be posting on
> > UseNet (or any other public message forum.)
> >
> > If you bothered to actually check, my first reply was to A. Sinan
> > Unur, not you. Yeah, you really don't have a personal agenda here,
> > right?...
> >
> > > go away before i taunt you a further time. your mother was a
> > > hampster. i fart in your general direction.
> >
> > "...than to open your mouth and remove all doubt."
> i have been helping with real perl issues here
That doesn't give you a free ticket to act any way you want to people
and assume it's perfectly ok. You are no more special than anyone else
here, so get over your self and fix your max line width with replying
while you're at it (it's only yours that ends up having wrapping issues
when ever I hit reply. It is generally accepted be using 72-76 max per
line, as it is to use a shift key, ffs.)
> i have nothing to prove to you. you have tons to prove here.
As I have nothing to prove to you, yet you insist on coming after me as
if I and others do.
--
G.Etly
------------------------------
Date: Sat, 03 May 2008 20:08:51 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Read 20 lines when pressing n for next
Message-Id: <7tgp14p7h64rhg2rbbubj21e6l8thjh8js@4ax.com>
"Gordon Etly" <get@bentsys.com> wrote:
>> > > > 4. must have subroutine used.
>
>Why do you all just assume it's a homework assignment?
Name one other probably explanation for such an odd requirement within
such an odd task.
>Could it not just
>as well be a simplified work project? I would not be at all surprised if
>this was something handed down by one's boss or project manager, and
>written in a simplified form (which is what one *should* do, no?)
A boss or project manager asking to reinvent the wheel, oooops, sorry,
to rewrite the "more" utility "using subroutines" (whatever that is
supposed to mean)? Yes, of course it can be. Just like it is possible
that all the molecules of the chair I am sitting on will move 1m to the
left and I'll drop to the ground. Since Heisenbert we know that that is
possible.
Get real! Any boss or PM asking for something like that will survive
only until his superior finds out.
jue
------------------------------
Date: Sat, 03 May 2008 21:20:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Read 20 lines when pressing n for next
Message-Id: <x763tv84pv.fsf@mail.sysarch.com>
>>>>> "GE" == Gordon Etly <get@bentsys.com> writes:
GE> Uri Guttman wrote:
>> Gordon Etly <get@bentsys.com> writes:
>> > Uri Guttman wrote:
>> > > Gordon Etly <get@bentsys.com> writes:
>> > > > Uri Guttman wrote:
>> > > > > but i don't attack your character as you have shown none. all
>> > > > > you have done is flame about how others post here.
>> > > >
>> > > > With all due respect, all I am guilty of is having opinions
>> > > > (which happens to be contrary to your own view in both cases.)
>> > > > If anyone did any "flaming", it was people like you that
>> > > > turned a simple point into a kill-the-heretic.
>> > > >
>> > > > You don't agree with someone, fine. But don't make it your
>> > > > personal vendetta.
>> > >
>> > > it isn't personal.
>> >
>> > You keep making it so. Every thread I make a comment or some point
>> > on
>> > something, instead of addressing it's merits or cons, you turn it
>> > into your own personal holy war. You did exactly that in the thread
>> > concerning the usage of "PERL" and you've been doing it again here.
>>
>> you haven't made one TECHNICAL comment about perl code that i have
>> seen.
GE> So what? Point me ot a rule that says every question has to be a
GE> "technical" one or sod off. Anyone can comment on someone else post,
GE> which you invite by posting in the first place. If you can't handle it,
GE> don't post.
hmm. see the guidelines. this group is about discussing perl, not the
posters.
>> that is the gist of this group. you have always commented on how
>> someone else posts or barely topical stuff like PERL vs perl.
GE> By posting you invite comments, if you can't handle it, then don't post.
GE> And would you care to tell me how making a point about something found
GE> in the documentation of Perl to be off topic in a Perl news group?
because the answer is already there (and shown many times) and flaming
about it ad nauseum does no one but you any good.
>> your latest was how others (and i) judged a post as homework.
GE> And I simply commented that that is a judgement, which is based on an
GE> assumption that could be entirely wrong. Anyone has the right to post a
GE> comment, and you invite comments by posting, so if you cannot handle it,
GE> don't post.
pot meet kettle. try to actually make a perl code comment already.
>> i have been helping with real perl issues here
GE> That doesn't give you a free ticket to act any way you want to
GE> people and assume it's perfectly ok. You are no more special than
GE> anyone else here, so get over your self and fix your max line
GE> width with replying while you're at it (it's only yours that ends
GE> up having wrapping issues when ever I hit reply. It is generally
GE> accepted be using 72-76 max per line, as it is to use a shift key,
GE> ffs.)
huh?? wrapping issues? you must use some strange usenet reader. emacs
has no problems here. nor do i. try another useless offtopic.
>> i have nothing to prove to you. you have tons to prove here.
GE> As I have nothing to prove to you, yet you insist on coming after me as
GE> if I and others do.
you do have something to prove, such as actual skill in helping others
with perl problems. that is the heart of this group. all the regulars do
that. you haven't. it is called earning stripes. otherwise you might as
well be moronzilla (google for it since you won't get the reference).
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sun, 4 May 2008 00:19:49 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Stuffing @users into $self->{'users'}
Message-Id: <lh8ve5-np3.ln1@osiris.mauzo.dyndns.org>
Quoth "Peter J. Holzer" <hjp-usenet2@hjp.at>:
> On 2008-05-01 14:44, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> >
> > If $x is a reference to an array, then @{ $x } dereferences it.
> >
> > my @users = @{ $self->{users} };
>
> Yup. That's one of the two rules to remember. The other is to use -> to
> access individual members.
I'm currently considering writing a module that would allow the syntax
my @users = $self->{users}[];
instead[1]. Given that it will be rather tricky, would people actually
find such a thing useful, or would the 'effort' of loading a module be
enough to put people off using it?
Ben
[1] I originally did it as a patch for core perl, which was considerably
easier; the consensus on p5p was that such minor and not-obviously-
terribly-useful syntax changes should be tested on CPAN first, if at all
possible.
--
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. ben@morrow.me.uk
------------------------------
Date: 04 May 2008 00:53:42 GMT
From: xhoster@gmail.com
Subject: Re: Stuffing @users into $self->{'users'}
Message-Id: <20080503205345.398$u2@newsreader.com>
Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth "Peter J. Holzer" <hjp-usenet2@hjp.at>:
> > On 2008-05-01 14:44, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> > >
> > > If $x is a reference to an array, then @{ $x } dereferences it.
> > >
> > > my @users = @{ $self->{users} };
> >
> > Yup. That's one of the two rules to remember. The other is to use -> to
> > access individual members.
>
> I'm currently considering writing a module that would allow the syntax
>
> my @users = $self->{users}[];
>
> instead[1]. Given that it will be rather tricky, would people actually
> find such a thing useful, or would the 'effort' of loading a module be
> enough to put people off using it?
The module would have to be based on something like Filter::Util::Call,
right? I've heard bad things about the stability of that, which would put
me off using such a module on a regular basis. Other than that, I'd like
it very much.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Sat, 3 May 2008 16:58:46 -0700 (PDT)
From: arik@blue-linedesign.com
Subject: weird issue with HTML::TokeParser and Fork
Message-Id: <a927f909-5def-410b-92cb-b6c8cd8277a3@u12g2000prd.googlegroups.com>
I wrote a script that scrape information off staples.com and I'm
getting different results if I run it stand alone or I fork the
script.
running the script stand alone I get the expected results and when
forking the script it seems like it ignores the <title> tag. any help
is appreciated:
this is part of the script:
sub GetStaples {
my $oem_PN = $_[0];
my $ItemDesc = $_[1];
my @ItemDesc = split(',',$ItemDesc);
my $Item;
my $price;
my $description;
my $type;
my $title;
my $numofitems;
my $agent = WWW::Mechanize->new(autocheck => 1, cookie_jar =>
undef);
$agent->get("http://www.staples.com/webapp/wcs/stores/servlet/home?
&langId=-1&storeId=10001&catalogId=10051");
$agent->form_name("headerSearchForm");
$agent->field("searchkey",$oem_PN);
$agent->click();
my $stream = HTML::TokeParser->new(\$agent->{content});
open(OUTFILE, ">>output.html") or die "Can't open output.txt: $!";
print OUTFILE $agent->content();
close(OUTFILE);
my $tag = $stream->get_tag("title");
$title = $stream->get_trimmed_text("/title");
print "Title:".$tile."\n";
if ($title !~ /that was easy/){........................
and this is how I fork the script
$pidStaples=fork();
die "Cannot fork: $!" if (! defined $pidStaples);
if (not defined $pidStaples) {
print "esources not avilable.\n";
} elsif ($pidStaples == 0){
GetStaples($ref->{OEM_PartNum},$ref->{Description});
exit(0);
}
the parameters are being passed successfully
and if you noticed I've created an outputfile.html to debug the agent-
>content and it comes back as expected.
even with that I can's get $title back
------------------------------
Date: Sun, 4 May 2008 00:09:08 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: weird issue with HTML::TokeParser and Fork
Message-Id: <fviur4$fg2$1@ml.accsnet.ne.jp>
On Sat, 03 May 2008 16:58:46 -0700, arik wrote:
> $title = $stream->get_trimmed_text("/title");
^^^^^^
> print "Title:".$tile."\n";
^^^^^
use warnings;
use strict;
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1507
***************************************