[23379] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5598 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 1 14:06:31 2003

Date: Wed, 1 Oct 2003 11:05: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           Wed, 1 Oct 2003     Volume: 10 Number: 5598

Today's topics:
    Re: Active Perl upgrade problems <Jluis@noEmai.com>
    Re: Active Perl upgrade problems <tcurrey@no.no.i.said.no>
        Bad protocol 'tcp' error - ActiveState Perl <res6mtpc@verizon.net>
    Re: date in hash keys & sorting <king21122@yahoo.com>
    Re: date in hash keys & sorting <bart.lateur@pandora.be>
    Re: date in hash keys & sorting <king21122@yahoo.com>
    Re: date in hash keys & sorting <noreply@gunnar.cc>
        examples of sprintf <king21122@yahoo.com>
    Re: examples of sprintf <noreply@gunnar.cc>
    Re: Hiding PERL code <dthomson@users.sf.net>
    Re: How are spammers exploiting my wwwboard code? <bart.lateur@pandora.be>
        How to generate this list? <bryan@akanta.com>
    Re: How to generate this list? <minceme@start.no>
    Re: Oops, 5.8.1 broke my program <wsanford@wallysanford.com>
    Re: Oops, 5.8.1 broke my program <abigail@abigail.nl>
    Re: Oops, 5.8.1 broke my program <wsanford@wallysanford.com>
    Re: Oops, 5.8.1 broke my program <xaonon@hotpop.com>
    Re: Perl Book Recommendations <notspam@spamfree.dud>
    Re: Problem viewing Google threads for clpm (& others) (Penna Elabi)
    Re: Regexp - optimisation <HelgiBriem_1@hotmail.com>
    Re: Right way to wrap FileHandle? <newspost@coppit.org>
    Re: Saving html form into oracle database <mbudash@sonic.net>
        TZ cache on some Linux kernels (Jon)
        Unable to change a variable (newbie) <4tdn-7vps@spamex.com>
    Re: Unable to change a variable (newbie) (Andrew Perrin (CLists))
    Re: Unable to change a variable (newbie) <4tdn-7vps@spamex.com>
        UserAgent's Max_Size and HTTP's header field Range (Great Deals)
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 01 Oct 2003 17:39:32 +0200
From: José Luis Pérez Diez <Jluis@noEmai.com>
Subject: Re: Active Perl upgrade problems
Message-Id: <VA.00000626.035e35c9@noemai.com>

In article <aa33e448.0310010439.43e8ce75@posting.google.com>, Thomas C 
wrote:
> I upgraded my IIS web site on a 2K box from 5.6.0 to 5.6.1 and now
> instead of the .pl scripts running they want to either open or save.  
> I even tried uninstalling the newer version and reinstalling the newer
> version with no luck.  I also insured the pl association was made in
> IIS and that the perl\bin was in the path statement of the
> environment.  I am out of ideas!  The whole company world wide uses
> this site and it being down is causing lots of trouble.

That one it's hardly a Perl question and it's difficult to parse the 
expressions used here. 

I assume that some changes has been done in your win2K box (I know for 
sure that IIS cannot fit in 2K).

This one has been a IIS or a Perl upgrade? 
What changes had the upgrade done?. 
Can the changes be undone?




------------------------------

Date: Wed, 1 Oct 2003 09:19:48 -0700
From: "Trent Curry" <tcurrey@no.no.i.said.no>
Subject: Re: Active Perl upgrade problems
Message-Id: <bleuro$2uj$1@news.astound.net>

José Luis Pérez Diez wrote:
> In article <aa33e448.0310010439.43e8ce75@posting.google.com>, Thomas C
> wrote:
>> I upgraded my IIS web site on a 2K box from 5.6.0 to 5.6.1 and now
>> instead of the .pl scripts running they want to either open or save.
>> I even tried uninstalling the newer version and reinstalling the
>> newer version with no luck.  I also insured the pl association was
>> made in IIS and that the perl\bin was in the path statement of the
>> environment.  I am out of ideas!  The whole company world wide uses
>> this site and it being down is causing lots of trouble.
>
> That one it's hardly a Perl question and it's difficult to parse the
> expressions used here.
>
> I assume that some changes has been done in your win2K box (I know for
> sure that IIS cannot fit in 2K).
>
> This one has been a IIS or a Perl upgrade?
> What changes had the upgrade done?.
> Can the changes be undone?

He clearly said he upgraded Perl "5.6.0 to 5.6.1". Had you actually read the
post instead of smearing it apparently for using an MS product to run it,
you would of caught that.

Go to your control panel (Administive Tools) for IIS and make sure the
directory (/cgi-bin? or perhaps /scripts?) has execute access.

-- 
Trent Curry

perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'




------------------------------

Date: Wed, 01 Oct 2003 16:07:50 GMT
From: "Mike Lottridge" <res6mtpc@verizon.net>
Subject: Bad protocol 'tcp' error - ActiveState Perl
Message-Id: <qZCeb.540$3b7.189@nwrddc02.gnilink.net>

I'm getting an bad protocol error 'tcp' whenever I use any of the LWP
modules (and PPM as well). I'm using a Windows 2000 system. There's not a
problem with tcp on port 80, i can browse the net, plus run other command
line cygwin utilities (wget, ...) without problems.

Is this a matter of not being able to find the "protocols" file? I've
checked my %WINDIR% variable, it's set and there is a valid "protocols" file
there. This problem cropped up recently... I'm not sure what changed on my
system, and I'm stumped on how to debug it.

Included is an example error when using PPM.

C:\Perl\bin>ppm
PPM - Programmer's Package Manager version 3.1.
Copyright (c) 2001 ActiveState SRL. All Rights Reserved.

Entering interactive shell. Using Term::ReadLine::Stub as readline library.

Type 'help' to get started.

ppm> s quotehist
Searching in Active Repositories
Error: No valid repositories: Error: 500 Can't connect to
ppm.ActiveState.com:80 (Bad protocol 'tcp') Error: 500 Can't connect to
ppm-ia.ActiveState.com:80 (Bad protocol 'tcp')
ppm>




------------------------------

Date: Thu, 02 Oct 2003 01:48:07 +1000
From: King <king21122@yahoo.com>
Subject: Re: date in hash keys & sorting
Message-Id: <3F7AF737.60008@yahoo.com>

Gunnar Hjalmarsson wrote:
> King wrote:
> 
>>
>>     my $dates = "02-Aug-4";  #this could be 98-Aug-04
>>
>>     my %months = ( Jan => 1, Feb => 2, Mar => 3, Apr => 4,
>>                 Maj => 5, Jun => 6, Jul => 7, Aug => 8,
> 
> --------------------^

this is funny, I did not read it carfully.. sorry. :)


> You don't *need* to repeat my typo. 'Maj' is Swedish for 'May'. :)
> 
>>                 Sep => 9, Oct => 10, Nov => 11, Dec => 12 );
>>
>> my $pat;
>>     my $sortabledates = sprintf $pat,
> 
> ----------------------------------^^^^
> That variable has no value.

well, by the time it needs a value it will have it from the calculation 
to takes place first since it is at the right of the sprintf, "I gussed" 
  :|


> 
>>         ((map { /[a-z]{3}/i ? $months{$_} : $_ } split /-/, $dates)[0] 
>> > 35 ? $pat = 19'%d%02d%02d' : $pat = 20'%d%02d%02d') ;
> 
> 
> Some more faulty logic...
> 
>> 19 and 20 before the pattern is what I need but this is not the
>> correct way to do it, just to show you what I am thinking, how could
>> it be written?
> 
> 
> I just added a line to my dateconvert() function.
> 
>     my $date = "02-Aug-4";  #this could be 98-Aug-04
> 
>     print dateconvert($date);
> 
>     sub dateconvert {
>         my $date = shift;
>         my %months = (
>             Jan => 1, Feb => 2, Mar => 3, Apr => 4,
>             May => 5, Jun => 6, Jul => 7, Aug => 8,
>             Sep => 9, Oct => 10, Nov => 11, Dec => 12
>         );
>         my ($year, $month, $day) = split /-/, $date;
>         $year += $year > 35 ? 1900 : 2000;
>         $month = $months{$month};
>         return sprintf '%d%02d%02d', $year, $month, $day;
>     }
> 


many thanks



------------------------------

Date: Wed, 01 Oct 2003 16:01:17 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: date in hash keys & sorting
Message-Id: <ahulnvsnubet5o0e8oadcbhn1sf13i11s9@4ax.com>

Sam wrote:

>one of the problems I am facing is converting the date, the result are
>2002124 for 2002-Jan-24
>2002124 for 2002-Dec-4
>that sorting will not work, any idea is appriciated

That should be 

	20020124 for 2002-Jan-24
	20021204 for 2002-Dec-4

-- 
	Bart.


------------------------------

Date: Thu, 02 Oct 2003 02:03:22 +1000
From: King <king21122@yahoo.com>
Subject: Re: date in hash keys & sorting
Message-Id: <3F7AFACA.5070705@yahoo.com>

Gunnar Hjalmarsson wrote:
> King wrote:
> 
>>
>>     my $dates = "02-Aug-4";  #this could be 98-Aug-04
>>
>>     my %months = ( Jan => 1, Feb => 2, Mar => 3, Apr => 4,
>>                 Maj => 5, Jun => 6, Jul => 7, Aug => 8,
> 
> --------------------^
> You don't *need* to repeat my typo. 'Maj' is Swedish for 'May'. :)
> 
>>                 Sep => 9, Oct => 10, Nov => 11, Dec => 12 );
>>
>> my $pat;
>>     my $sortabledates = sprintf $pat,
> 
> ----------------------------------^^^^
> That variable has no value.
> 
>>         ((map { /[a-z]{3}/i ? $months{$_} : $_ } split /-/, $dates)[0] 
>> > 35 ? $pat = 19'%d%02d%02d' : $pat = 20'%d%02d%02d') ;
> 
> 
> Some more faulty logic...
> 
>> 19 and 20 before the pattern is what I need but this is not the
>> correct way to do it, just to show you what I am thinking, how could
>> it be written?
> 
> 
> I just added a line to my dateconvert() function.
> 
>     my $date = "02-Aug-4";  #this could be 98-Aug-04
> 
>     print dateconvert($date);
> 
>     sub dateconvert {
>         my $date = shift;
>         my %months = (
>             Jan => 1, Feb => 2, Mar => 3, Apr => 4,
>             May => 5, Jun => 6, Jul => 7, Aug => 8,
>             Sep => 9, Oct => 10, Nov => 11, Dec => 12
>         );
>         my ($year, $month, $day) = split /-/, $date;
>         $year += $year > 35 ? 1900 : 2000;
>         $month = $months{$month};
>         return sprintf '%d%02d%02d', $year, $month, $day;
>     }
> 

why is there $year += $year > 35, isn't $year > 35 the condition we want 
to check? when I do it $year > 35 ... I get Useless use of a constant in 
void context. I don't understand this condition, if you explain I will 
be very thankfull.




------------------------------

Date: Wed, 01 Oct 2003 18:21:03 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: date in hash keys & sorting
Message-Id: <bleutu$bc708$1@ID-184292.news.uni-berlin.de>

King wrote:
> Gunnar Hjalmarsson wrote:
>> 
>>     my $date = "02-Aug-4";  #this could be 98-Aug-04
>>
>>     print dateconvert($date);
>>
>>     sub dateconvert {
>>         my $date = shift;
>>         my %months = (
>>             Jan => 1, Feb => 2, Mar => 3, Apr => 4,
>>             May => 5, Jun => 6, Jul => 7, Aug => 8,
>>             Sep => 9, Oct => 10, Nov => 11, Dec => 12
>>         );
>>         my ($year, $month, $day) = split /-/, $date;
>>         $year += $year > 35 ? 1900 : 2000;
>>         $month = $months{$month};
>>         return sprintf '%d%02d%02d', $year, $month, $day;
>>     }
> 
> why is there $year += $year > 35, isn't $year > 35 the condition we
> want to check?

Yes. That's what it does.

> when I do it $year > 35 ... I get Useless use of a constant in void
> context.

I hope you don't do just that...  The whole expression doesn't result
in any error or warning for me.

> I don't understand this condition, if you explain I will be very
> thankfull.

It's the same as:

     if ($year > 35) {
         $year += 1900;
     } else {
         $year += 2000;
     }

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Thu, 02 Oct 2003 01:18:25 +1000
From: King <king21122@yahoo.com>
Subject: examples of sprintf
Message-Id: <3F7AF041.20009@yahoo.com>

Hello

are there some easy examples on how to use the sprintf, examples that 
will assume you don't know any thing about the function and takes you 
one step at the time teaching you the ins and outs on its usage?
I have read the online docs, but need more easy examples.

I am trying to add numbers 20 infront of the format %d%02d%02d and could 
not find an example on how to do it.

thanks



------------------------------

Date: Wed, 01 Oct 2003 17:47:39 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: examples of sprintf
Message-Id: <blesv9$b7t7i$1@ID-184292.news.uni-berlin.de>

King wrote:
> I am trying to add numbers 20 infront of the format %d%02d%02d

     '20%d%02d%02d'

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Thu, 02 Oct 2003 01:15:47 +1000
From: Derek Thomson <dthomson@users.sf.net>
Subject: Re: Hiding PERL code
Message-Id: <3f7aefb6$1@duster.adelaide.on.net>

Andreas Kahari wrote:
> In article <3f783e96$1@duster.adelaide.on.net>, Derek Thomson wrote:
> 
>>Andreas Kahari wrote:
> 
> [cut]
> 
>>>I was once working for a company that didn't want to thow its
>>>"IP" around too much.  Compiled Perl scripts was the only way to
>>>distribute Perl programs to the outside of the company.
> 
> [cut]
> 
>>How was it done? I'm pretty certain it's going to be easy to break, 
>>given that "perl -MO=Deparse <file>" does a damned fine job of 
>>decompiling anything that can be actually executed in Perl. Try it on 
>>something Acme::Bleach-ed or Acme::EyeDrop-ed and see for yourself.
> 
> 
> Some Windows perl distribution + perl2exe.  

In that case I don't think it would hold up very long. The intermediate 
form is still there. The Perl interpreter is still there. It would just 
be a matter of applying B::Deparse to the "frozen" intermediate form. 
There's probably already a prepackaged tool to do it somewhere ;)

I'm interested to hear what people have done to try to conceal their 
Perl source, as my working theory is that it's just impossible. I'd be 
interested to hear of any cases that can contradict this assertion, though!

> I haven't tried the
> Acme::* stuff, and fortunately I don't have to.
> 

I only gave those as examples of source filters that "obsucate" source 
code, and are almost totally reversible with B::Deparse. Acme::* stuff 
is "interesting, but ultimately pointless" stuff on purpose, IIRC.

Regards,
Derek.



------------------------------

Date: Wed, 01 Oct 2003 15:27:48 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: How are spammers exploiting my wwwboard code?
Message-Id: <geslnv0qc0pfh723ankm37ml8hdpbc4joa@4ax.com>

Eric J. Roode wrote:

>Buck wrote:
>
>> The 711 on a directory (NOTICE: I did say cgi-bin directory) provides
>> traverse access, and blocks LISTing of the directory.  If the cgi-bin
>> directory were 755 as you say, just pointing to the cgi-bin directory -
>> any one can see each and every script in the directory.
>
>Only if the web server is configured very badly.

Perhaps Buck is talking about something else. Perhaps He's talking about
several users sharing the same webserver, as clients, and accessing the
scripts from the shell or from other scripts on the same server.

In that case, you'd (likely) need the exact filename... but by examining
the other person's website, it's quite easy to figure those out. So it
wouldn't help that much.

-- 
	Bart.


------------------------------

Date: Wed, 01 Oct 2003 16:54:08 GMT
From: Bryan <bryan@akanta.com>
Subject: How to generate this list?
Message-Id: <QEDeb.413$yQ6.62530841@newssvr21.news.prodigy.com>

If I have the following:

4 A's, 2 B's, 1 C, 3 D's

What's the best way to create a list of -all- the possible combinations 
of these letters?

Thanks!



------------------------------

Date: Wed, 1 Oct 2003 17:44:21 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: Re: How to generate this list?
Message-Id: <slrnbnm13o.64i.minceme@imap-a.start.no>

* Bryan <bryan@akanta.com>              (CCLXXIV'th day of year MMIII)

> If I have the following:
>
> 4 A's, 2 B's, 1 C, 3 D's
>
> What's the best way to create a list of -all- the possible combinations 
> of these letters?

Maybe you could use this? (untested, this'll be a long list...)

    #!/usr/bin/perl
    use strict;
    use warnings;
    use Algorithm::Permute;

    my $p = new Algorithm::Permute([ split //, "AAAABBCDDD" ]);
    while (my @res = $p->next) {
        print join("", @res), "\n";
    }

-- 
                                                  (,_    ,_,    _,)
                                                  /|\`\._( )_./'/|\
                                                 · ·  \/ L /\ D  · ·
                                                /__|.-'`-\_/-`'-.|__\
`·..·´¯`·..·´¯`·..·´¯`·..·´¯`·..·´¯`·..·´¯`·.. `          "          `


------------------------------

Date: Wed, 1 Oct 2003 08:53:13 -0700
From: "Wally Sanford" <wsanford@wallysanford.com>
Subject: Re: Oops, 5.8.1 broke my program
Message-Id: <blet5j$ahsqj$1@ID-196529.news.uni-berlin.de>

Abigail wrote:
> Xaonon (xaonon@hotpop.com) wrote on MMMDCLXXXII September MCMXCIII in
> <URL:news:slrnbnkat7.vjm.xaonon@xaonon.local>:
> {}  Or, more likely, it was broken before in some way that wasn't
> apparent until {}  I installed 5.8.1.  The program in question is a
> signature generator, which {}  runs as a daemon and produces random
> quips via a named pipe.  The main loop {}  looks like this:
> {}
[Snip more NON STANDARD quoting...]

Abigail, coudl you please refrain from using non standard quoting. It makes
it more difficult for people who use parsers to sort out quoting levels
(color coding, etc.) groups.google.com is one such place that does this.
Thank you.


[Heres an old post relating to this, indicating I'm not the first to ask
either.]
[Google:
http://groups.google.com/groups?selm=1dtt53a.yov94bavpsleN%40roxboro0-0035.dyn.interpath.net&oe=UTF-8&output=gplain ]

From: planb@newsreaders.com (J. Moreno)
Subject: Re: Statistics for comp.lang.perl.misc
Date: 1999/06/22
Message-ID: <1dtt53a.yov94bavpsleN@roxboro0-0035.dyn.interpath.net>#1/1
References: <7klk8a$e4o$1@info2.uah.edu>
<m1yahdtu8e.fsf@halfdome.holdit.com> <B393DDDE9668DA7A8E@204.112.166.88>
<m1lnddtq9j.fsf@halfdome.holdit.com> <7km2bi$gm6$1@info2.uah.edu>
<376e9cd7.236836@news.skynet.be> <7km87l$i2h$1@info2.uah.edu>
<377077b3.4718606@news.skynet.be> <7ko44l$lg$3@info2.uah.edu>
<m1ogi8l3s0.fsf@halfdome.holdit.com>
Mail-Copies-To: nobody
X-ACLA-Charter:
<http://www.dejanews.com/msgid.xp?MID=%3Cphenix-121119981748546229@roxboro0-
023.dyn.interpath.net%3E&ST=&AH=1>
X-Face: 48Sy^\</dKZe1J<x|w^od|[iJ}v*!!%."nNxwca8S2[}H-$<)+4]aq(v<;)uv
:jQ5(aeN*L~ayLVWcoPoFtB7M7v}N,+YkX*__,I8RqhT
Organization: phenix@interpath.com
X-FAQs-Read: perl, pascal.mac
User-Agent: MacSOUP/2.4
Newsgroups: comp.lang.perl.misc


Randal L. Schwartz <merlyn@stonehenge.com> wrote:

> >>>>> "Greg" == Greg Bacon <gbacon@itsc.uah.edu> writes:
>
> Greg> That's beatable too.  What if she uses different prefixes for each
> Greg> quoted line?
>
> Maybe Abi deserves to be taken out of the normal mix, and given an
> honorary "automatically historically excessive" OCR place in the
> standings.  Item # 0 or something. :)
>
> Maybe what I'm really saying is I don't understand if Abi is using
> different prefixes just to foul up statistics, or what.  And if so,
> the stats should just ignore her.  And I don't like having that kind
> of confusion in my life. :)
>
> print "Just another confused Perl hacker,"

I'd agree with you totally, if you didn't use a non standard style
yourself.

The more people that use the standard quoting style the easier it is to
convince newsreader authors that they should recognize that there /is/ a
standard.

And ditto for posters -- non-standard quoting just encourages them to
ignore the fact that their newsreaders spew out garbage; after all why
should they take the trouble to switch to something better or fix it by
hand when the old timers/big names are using something non-standard.




------------------------------

Date: 01 Oct 2003 16:18:00 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Oops, 5.8.1 broke my program
Message-Id: <slrnbnlvho.ta8.abigail@alexandra.abigail.nl>

Wally Sanford (wsanford@wallysanford.com) wrote on MMMDCLXXXIII September
MCMXCIII in <URL:news:blet5j$ahsqj$1@ID-196529.news.uni-berlin.de>:
==  Abigail wrote:
== > Xaonon (xaonon@hotpop.com) wrote on MMMDCLXXXII September MCMXCIII in
== > <URL:news:slrnbnkat7.vjm.xaonon@xaonon.local>:
== > {}  Or, more likely, it was broken before in some way that wasn't
== > apparent until {}  I installed 5.8.1.  The program in question is a
== > signature generator, which {}  runs as a daemon and produces random
== > quips via a named pipe.  The main loop {}  looks like this:
== > {}
==  [Snip more NON STANDARD quoting...]
==  
==  Abigail, coudl you please refrain from using non standard quoting. It makes
==  it more difficult for people who use parsers to sort out quoting levels
==  (color coding, etc.) groups.google.com is one such place that does this.
==  Thank you.
==  
==  
==  [Heres an old post relating to this, indicating I'm not the first to ask
==  either.]
==  [Google:
==  
==  From: planb@newsreaders.com (J. Moreno)
==  Subject: Re: Statistics for comp.lang.perl.misc
==  Date: 1999/06/22


Let's see, two requests in 4 years. I can't really be impressed by
those numbers.

You have a few options:
  - Make your parser smarter. It'll be fairly trivial in Perl to read a
    posting of mine and determine that posts quoting prefix.
  - Killfile me.

The latter is the easiest option.


Abigail
-- 
perl -wle'print"Êõóô áîïôèåò Ðåòì Èáãëåò"^"\x80"x24'


------------------------------

Date: Wed, 1 Oct 2003 09:29:24 -0700
From: "Wally Sanford" <wsanford@wallysanford.com>
Subject: Re: Oops, 5.8.1 broke my program
Message-Id: <blev9d$bmafl$1@ID-196529.news.uni-berlin.de>

Abigail wrote:
> Wally Sanford (wsanford@wallysanford.com) wrote on MMMDCLXXXIII
> September MCMXCIII in
> <URL:news:blet5j$ahsqj$1@ID-196529.news.uni-berlin.de>: ==  Abigail
> wrote: == > Xaonon (xaonon@hotpop.com) wrote on MMMDCLXXXII September
> MCMXCIII in == > <URL:news:slrnbnkat7.vjm.xaonon@xaonon.local>:
> == > {}  Or, more likely, it was broken before in some way that wasn't
> == > apparent until {}  I installed 5.8.1.  The program in question
> is a == > signature generator, which {}  runs as a daemon and
> produces random == > quips via a named pipe.  The main loop {}  looks
> like this: == > {}
> ==  [Snip more NON STANDARD quoting...]
> ==
> ==  Abigail, coudl you please refrain from using non standard
> quoting. It makes ==  it more difficult for people who use parsers to
> sort out quoting levels ==  (color coding, etc.) groups.google.com is
> one such place that does this. ==  Thank you.
> ==
> ==
> ==  [Heres an old post relating to this, indicating I'm not the first
> to ask ==  either.]
> ==  [Google:
> ==
> ==  From: planb@newsreaders.com (J. Moreno)
> ==  Subject: Re: Statistics for comp.lang.perl.misc
> ==  Date: 1999/06/22
>
>
> Let's see, two requests in 4 years. I can't really be impressed by
> those numbers.

Then you didn't search very hard. There have been numerous threads on the
subject, and the net conclusion as always come to that std is the way to go;
it's just that developers that create readers don't consider the
*standards*. And it gets worse when the "veterans" of usenet don't follow
the standards themselves. Not the kind of example you want to set for newer
folks.

> You have a few options:
>   - Make your parser smarter. It'll be fairly trivial in Perl to read
>     a posting of mine and determine that posts quoting prefix.
>   - Killfile me.
>
> The latter is the easiest option.

This is entirely beside the point. Even if *I* killfiled you, many others
would se it. New comers would catch the same bad habit and it spreads. Why
do you think this subject has been brought up all over usenet for years? And
not to mention virtually all content still ends up in Google.




------------------------------

Date: 1 Oct 2003 17:13:51 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: Oops, 5.8.1 broke my program
Message-Id: <slrnbnmd8u.56b.xaonon@xaonon.local>

Ned i bach <slrnbnl60m.dr.abigail@alexandra.abigail.nl>, Abigail
<abigail@abigail.nl> teithant i thiw hin: 

> Xaonon (xaonon@hotpop.com) wrote on MMMDCLXXXII September MCMXCIII in
> <URL:news:slrnbnkat7.vjm.xaonon@xaonon.local>:
> 
> > Or, more likely, it was broken before in some way that wasn't apparent
> > until I installed 5.8.1.  The program in question is a signature
> > generator, which runs as a daemon and produces random quips via a named
> > pipe.  The main loop looks like this:
> > 
> >     while( 1 )
> >     {
> >         -p $options{outfile}
> >             or die "$0: `$options{outfile}' disappeared\n";
> >         sysopen FIFO, $options{outfile}, O_WRONLY
> >             or die "$0: $options{outfile}: $!\n";
> >         
> >         print FIFO randsig();
> >         close FIFO or die "$0: $options{outfile}: $!\n";
> >         
> >         # Sleep briefly to let the reader see EOF.
> >         select undef, undef, undef, 0.1;
> >     }
> > 
> > Now, though, it seems that the reader doesn't ever see an EOF.  For
> > example, running "cat sig.fifo" spits out signature after signature
> > until I kill the process, as opposed to just printing one and finishing.
> > I note that running the program with 5.6.1 still works, but I want a
> > more rigorous solution.  Can anyone identify the problem?
> 
> What does your program do with 5.8.0?

I don't know.  I had 5.6.1 and went directly to 5.8.1 from there.

-- 
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
http://xaonon.dyndns.org/  Guaranteed content-free since 1999.  No refunds.
"It is strange that kibo would be eating the girls pocky, as the frilly pink
bags they come in are full of love and kissing." -- haon4707


------------------------------

Date: Wed, 01 Oct 2003 15:39:37 GMT
From: Sean O'Dwyer <notspam@spamfree.dud>
Subject: Re: Perl Book Recommendations
Message-Id: <notspam-A5E1BF.11452301102003@nyctyp02-ge0.rdc-nyc.rr.com>

In article <bleo54$rc8$1$8300dec7@news.demon.co.uk>,
 Chris Smith <chris@FLARBLEinfinitemonkeys.org.uk> wrote:

> OReilly Programming Perl (The Camel Book)
> OReilly Perl Cookbook

Cheers,

Sean


------------------------------

Date: 1 Oct 2003 08:20:26 -0700
From: terebinthus@go.com (Penna Elabi)
Subject: Re: Problem viewing Google threads for clpm (& others)
Message-Id: <77081966.0310010720.6580feae@posting.google.com>

charley@pulsenet.com (Chris Charley) wrote in message news:<4f7ed6d.0309271649.113dfb2f@posting.google.com>...
>
> I keep getting the message in Google groups,
>                
>            Unable to find thread. Please recheck the URL.
> 
> when trying to access the links in this group.

Google Groups is having problems, see thread:

http://groups.google.com/groups?&threadm=77081966.0309291030.125fdfe5%40posting.google.com


------------------------------

Date: Wed, 01 Oct 2003 15:10:22 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: Regexp - optimisation
Message-Id: <dhrlnvo32hq7mn45m42f6o5476ii4f2cnp@4ax.com>

On 1 Oct 2003 14:02:15 GMT, Glenn Jackman <xx087@freenet.carleton.ca>
wrote:

>Helgi Briem <HelgiBriem_1@hotmail.com> wrote:
>>  On Tue, 30 Sep 2003 22:24:44 +0100, "Stephen Adam"
>> <stephen.adam@ntlworld.com> wrote:
>>  
>> >It seems to recognise all the e-mail addresses i've tested it 
>> >with though I know its pretty limited.
>>  
>>  Read perldoc -q "valid mail"
>>  
>>  E-mail addresses are far too complicated to be
>>  validated by a single regex.
>
>This is either very clever or very foolish (you decide), but I lifted
>this from the "Mastering Regular Expressions" book:

Well, I actually meant "simple" regex, but thanks
for that.  At least it shows how tricky it is to
match valid e-mail addresses, which was my point.


------------------------------

Date: Wed, 01 Oct 2003 17:12:06 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: Right way to wrap FileHandle?
Message-Id: <Pine.BSF.4.56.0310011307001.38963@www.provisio.net>

On Wed, 1 Oct 2003, David Coppit wrote:

> - ungetc doesn't seem to work in my implementation. The code is below. Can
>   anyone spot the problem?

I'll answer my own question:

The problem is that my @ISA says that a FileHandle::Unget is a IO::Handle when
it really isn't. In the fixed version below, I (1) import then re-export the
functions exported by FileHandle, and (2) use an AUTOLOAD in the main package
to intercept any calls and then forward them to the encapsulated file handle.

I *think* that does the trick.

David

------------------------------%<-----------------------------
# First line
# Second line
package FileHandle::Unget;

use strict;
use Symbol;
use FileHandle;
use Exporter;

use 5.000;

use vars qw( @ISA $VERSION $AUTOLOAD @EXPORT @EXPORT_OK );

@ISA = qw( Exporter );

$VERSION = '0.10';

@EXPORT = @FileHandle::EXPORT;
@EXPORT_OK = @FileHandle::EXPORT_OK;

import FileHandle @EXPORT, @EXPORT_OK;

#-------------------------------------------------------------------------------

sub new
{
  my $class = shift;

  my $fh = gensym;

  ${*$fh} = tie *$fh, "${class}::Tie", @_;

  ref(${*$fh}) or return undef;

  bless $fh, $class;
  return $fh;
}

#-------------------------------------------------------------------------------

sub AUTOLOAD
{
  my $sub = $AUTOLOAD;
  $sub =~ s/.*://;

  # Alias the anonymous subroutine to the name of the sub we want ...
  no strict 'refs';
  *{$sub} = sub
    {
      my $self = shift;

      if (ref $self)
      {
        my $tie = tied *$self;
        $tie->{'fh'}->$sub(@_);
      }
      else
      {
        die "Can't get here?";
        $sub = "FileHandle::$sub";
        &$sub(@_);
      }
    };

  # ... and go to it.
  goto &$sub;
}

###############################################################################

package FileHandle::Unget::Tie;

use strict;
use FileHandle;

use 5.000;

use vars qw( $VERSION $AUTOLOAD );

$VERSION = '0.10';

#-------------------------------------------------------------------------------

my %tie_mapping = (
  PRINT => 'print', PRINTF => 'printf', WRITE => 'syswrite',
  READLINE => 'getline', GETC => 'getc', READ => 'read', CLOSE => 'close',
  BINMODE => 'binmode', OPEN => 'open', EOF => 'eof', FILENO => 'fileno',
  SEEK => 'seek', TELL => 'tell',
);

#-------------------------------------------------------------------------------

sub AUTOLOAD
{
  my $name = $AUTOLOAD;
  $name =~ s/.*://;

  die "Unhandled function $name!" unless exists $tie_mapping{$name};

  my $sub = $tie_mapping{$name};

  # Alias the anonymous subroutine to the name of the sub we want ...
  no strict 'refs';
  *{$name} = sub
    {
      my $self = shift;

      $sub = 'getlines' if $sub eq 'getline' && wantarray;

      $self->{'fh'}->$sub(@_);
    };

  # ... and go to it.
  goto &$name;
}

#-------------------------------------------------------------------------------

sub TIEHANDLE
{
  my $class = shift;

  my $self = bless({}, $class);

  $self->{'fh'} = FileHandle->new(@_) or return undef;

  return $self;
}

################################################################################
# Test program below
# It should print the first line, then a *, then the second line

my $fh = new FileHandle::Unget($0);

print scalar <$fh>;

$fh->ungetc(ord('*'));

print $fh->getline;

$fh->close;
------------------------------%<-----------------------------


------------------------------

Date: Wed, 01 Oct 2003 15:55:27 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Saving html form into oracle database
Message-Id: <mbudash-816802.08552701102003@typhoon.sonic.net>

In article <3db2b381.0310010704.665891ad@posting.google.com>,
 nick77074@hotmail.com (Nick) wrote:

> I'm new to perl programming. Just wanted to know if there is a way I
> could save the whole HTML FORM into database rather then saving it by
> individual fields.
> Someone mentioned it to me that it can be done. I just don't know how
> to do it.
> 
> Reason I'm trying to do this is because im working on a FORM with
> about 50 input fields. All I need is a way to save this form and pull
> it back with the data and be able to make changes to it and save it
> again. I know I can run a sql query and save all the fields
> individually and do the same when I put the data back into the FORM
> before showing it but thats kinda lengthy approach. Anyone know a
> better way of doing this?? Don't know much about cgi.pm either.
> 
> Thanks for your help.
> Nick

the problem i see is that a cgi script is not delivered a form, it's 
delivered the names/values _in_ a form when that form was submitted. one 
possibility: have your form handler read in the static html file 
containing the form, fill it in, and save it to your db in a blob field 
(ugh!)

hth-

-- 
Michael Budash


------------------------------

Date: 1 Oct 2003 10:27:46 -0700
From: jon18_uk2002@yahoo.co.uk (Jon)
Subject: TZ cache on some Linux kernels
Message-Id: <83bd902f.0310010927.456738aa@posting.google.com>

While doing some time/date functions I had to change the timezone used
(by changing the ENV{TZ}) twice in one script.  However, it seems the
kernel cached the last zone and failed to open or change to the new
one.  I confirmed this using strace, as you could see it only opened
the one file.  The code I used is as follows.

$ENV{TZ} = ':/usr/share/zoneinfo/Europe/London';

$time = time();

($sec,$min,$hour,$day,$mon,$this_year,$wday,$yday,$isdst) =
localtime($time);
print "$hour:$min\n";

$ENV{TZ} = ':/usr/share/zoneinfo/Europe/Paris';

($sec,$min,$hour,$day,$mon,$this_year,$wday,$yday,$isdst) =
localtime($time);
print "$hour:$min\n";

Is the code I used.  The times should be out by an hour (Paris is one
hour ahead of London), however for me they both show the same time,
which is within the London (GMT+1) timezone.  The results were
different on another server.

Linux 2.4.20 complied from source, Perl 5.8.0 (RedHat RPM) - failed.
Linux 2.4.7 RedHat supplied, Perl 5.6.0 (RedHat RPM) - worked.

I should really repeat the tests with the same version of Perl on both
kernels, this time I will build Perl myself, I will try that later
today, but I wonder if anyone else can confirm this issue or maybe
point me in the direction of the problem.

Jon.


------------------------------

Date: Wed, 01 Oct 2003 11:49:08 -0400
From: Orest Kinasevych <4tdn-7vps@spamex.com>
Subject: Unable to change a variable (newbie)
Message-Id: <blet1m$k0r$1@reader2.panix.com>

I have three perl CGI scripts that successfully pass variables to each 
other.

In one of the scripts I created a variable ($user_dir) that contains the 
name of a temporary directory that one of the other scripts will create.

I would like to name that directory after the session ID that was passed 
from the PHP page that called the CGI.  Something like this:


$user_dir = "/tmp/".$sessionid;


But that isn't working at all.  What is working is this 
("0688b79939fdeb65effac2314a1f934e" being my current session ID):


$user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e";


Meaning that the value of $user_dir is indeed passed to the script that 
creates the directory and that script correctly creates the directory 
named "/tmp/0688b79939fdeb65effac2314a1f934e".

However, when I try to set the variable as shown earlier:


$user_dir = "/tmp/".$sessionid;


the variable $user_dir doesn't appear to be set, that is, the script 
that creates the directory doesn't create one at all.

Testing $sessionid == "0688b79939fdeb65effac2314a1f934e" evaluates to 
true.  If I do a print $user_dir, $user_dir shows the expected value.

I am fairly adept at PHP but am a Perl newbie.  I'm guessing that there 
might be something here having to do with "pass-by-reference" (from what 
I've gleaned from online documentation) but I can't quite figure it out.



A few more details:

The $user_dir variable assignment occurs within header.cgi.  header.cgi 
is called from upload.cgi and progress.cgi using a require statement:

require ("./header.cgi");

Bottom line is this:

a) if ($sessionid == "0688b79939fdeb65effac2314a1f934e") # evaluates to true

b) $user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e" # works when used 
to create a directory by that name

c) $user_dir = "/tmp/".$sessionid # does not work


One last piece of info:

The set of statements used to create the directory looks like this:

unless (-d "$user_dir")
{
     mkdir ("$user_dir", 0777);
     chmod (0777, "$user_dir");
}



Thanks for any assistance/tips/pointers!

- Orest



-- 
Orest Kinasevych Saj
--------------------------------
OKINA CONSULTING
"Technology Solutions for Publishing"
--------------------------------


For the benefit of all readers, please reply directly to the newsgroup.



------------------------------

Date: 01 Oct 2003 12:07:53 -0400
From: clists@perrin.socsci.unc.edu (Andrew Perrin (CLists))
Subject: Re: Unable to change a variable (newbie)
Message-Id: <84r81xgcva.fsf@perrin.socsci.unc.edu>

Orest Kinasevych <4tdn-7vps@spamex.com> writes:

> [snip]
> I would like to name that directory after the session ID that was
> passed from the PHP page that called the CGI.  Something like this:
> 
> 
> $user_dir = "/tmp/".$sessionid;
> 

Just FYI, there's no need for the concatenation; you can use:

$user_dir = "/tmp/$sessionid";

> 
> But that isn't working at all.  What is working is this
> ("0688b79939fdeb65effac2314a1f934e" being my current session ID):
> 
> 
> $user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e";
> 
> 
> Meaning that the value of $user_dir is indeed passed to the script
> that creates the directory and that script correctly creates the
> directory named "/tmp/0688b79939fdeb65effac2314a1f934e".

Correct.

> 
> However, when I try to set the variable as shown earlier:
> 
> 
> $user_dir = "/tmp/".$sessionid;
> 
> 
> the variable $user_dir doesn't appear to be set, that is, the script
> that creates the directory doesn't create one at all.
> 
> Testing $sessionid == "0688b79939fdeb65effac2314a1f934e" evaluates to
> true.  

Irrelevant, since the == operator is testing for numerical
equality. Try $sessionid eq "0688b79939fdeb65effac2314a1f934e". 

> If I do a print $user_dir, $user_dir shows the expected value.

Tehn why do you say above that $user_dir doesn't appear to be set?
Clearly it is getting set, and your problem lies elsewhere.

> [snip]
> Bottom line is this:
> 
> a) if ($sessionid == "0688b79939fdeb65effac2314a1f934e") # evaluates to true
> 
> b) $user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e" # works when
> used to create a directory by that name
> 
> c) $user_dir = "/tmp/".$sessionid # does not work
> 

Something else is wrong, assuming a) is still true when you use eq
instead of ==.  Once $user_dir is correctly set, there's no difference
between the two forms.

-- 
----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu


------------------------------

Date: Wed, 01 Oct 2003 13:42:20 -0400
From: Orest Kinasevych <4tdn-7vps@spamex.com>
Subject: Re: Unable to change a variable (newbie)
Message-Id: <blf3lu$mdj$1@reader2.panix.com>

On 2003-10-01 12:07 PM, Andrew Perrin (CLists) remarked:

> Orest Kinasevych <4tdn-7vps@spamex.com> writes:
> 
> 
>>[snip]
>>I would like to name that directory after the session ID that was
>>passed from the PHP page that called the CGI.  Something like this:
>>
>>
>>$user_dir = "/tmp/".$sessionid;
>>
> 
> 
> Just FYI, there's no need for the concatenation; you can use:
> 
> $user_dir = "/tmp/$sessionid";
> 
> 
>>But that isn't working at all.  What is working is this
>>("0688b79939fdeb65effac2314a1f934e" being my current session ID):
>>
>>
>>$user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e";
>>
>>
>>Meaning that the value of $user_dir is indeed passed to the script
>>that creates the directory and that script correctly creates the
>>directory named "/tmp/0688b79939fdeb65effac2314a1f934e".
> 
> 
> Correct.
> 
> 
>>However, when I try to set the variable as shown earlier:
>>
>>
>>$user_dir = "/tmp/".$sessionid;
>>
>>
>>the variable $user_dir doesn't appear to be set, that is, the script
>>that creates the directory doesn't create one at all.
>>
>>Testing $sessionid == "0688b79939fdeb65effac2314a1f934e" evaluates to
>>true.  
> 
> 
> Irrelevant, since the == operator is testing for numerical
> equality. Try $sessionid eq "0688b79939fdeb65effac2314a1f934e". 
> 
> 
>>If I do a print $user_dir, $user_dir shows the expected value.
> 
> 
> Tehn why do you say above that $user_dir doesn't appear to be set?
> Clearly it is getting set, and your problem lies elsewhere.
> 
> 
>>[snip]
>>Bottom line is this:
>>
>>a) if ($sessionid == "0688b79939fdeb65effac2314a1f934e") # evaluates to true
>>
>>b) $user_dir = "/tmp/0688b79939fdeb65effac2314a1f934e" # works when
>>used to create a directory by that name
>>
>>c) $user_dir = "/tmp/".$sessionid # does not work
>>
> 
> 
> Something else is wrong, assuming a) is still true when you use eq
> instead of ==.  Once $user_dir is correctly set, there's no difference
> between the two forms.
> 

Thanks -- you confirmed what I thought was the case and helped me 
clarify the question for myself.

Although progress.cgi and upload.cgi each call header.cgi, they do so 
separately and the $sessionid variable is set separately within each of 
them.  That means that header.cgi gets a different $sessionid value from 
progress.cgi than it does from upload.cgi -- my print $user_dir; 
statement was occurring within progress.cgi (showing me correct values) 
while $upload.cgi was providing an incorrect value to header.cgi.

(Nothing like a pad of paper to help figure out the sequence!)

Thanks again.

- Orest

-- 
Orest Kinasevych Saj
--------------------------------
OKINA CONSULTING
"Technology Solutions for Publishing"
--------------------------------


For the benefit of all readers, please reply directly to the newsgroup.



------------------------------

Date: 1 Oct 2003 08:38:17 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: UserAgent's Max_Size and HTTP's header field Range
Message-Id: <cafe07c7.0310010738.50cc5ea5@posting.google.com>

Here is my code:
#!/usr/bin/perl
  use Net::HTTP;
  use LWP::UserAgent;

  $ua = LWP::UserAgent->new (agent => 'Mozilla/4.0', );
  $ua->max_size(2000);
  $url = 'http://news.google.com';  # for instance, no trailing /

  $htmlcode = $ua->get($url, Range => 'bytes=1000-')->content; 
  print $htmlcode;

#################
First of all, if I put 2000 or 1000 or 750 in max_size, the result is
the same, I don't know why, but if I put 400 there, the downloaded is
much smaller.

Secondly, Range => 'bytes=1000-' does not seem to work. I only want to
fetch the middle part of the page, not from the beginning. How could I
do that?

Here is the header I sent via nettransport
2003-10-01 11:35:38.713 Connecting to news.google.com:80
2003-10-01 11:35:38.713 Connecting to 216.239.33.104:80
2003-10-01 11:35:38.963 Connected
2003-10-01 11:35:38.963 GET / HTTP/1.1
2003-10-01 11:35:38.963 Host: news.google.com
2003-10-01 11:35:38.963 Referer: http://news.google.com
2003-10-01 11:35:38.963 Accept: */*
2003-10-01 11:35:38.963 User-Agent: Mozilla/4.0
2003-10-01 11:35:38.963 Range: bytes=12485-
2003-10-01 11:35:38.963 Connection: close

Here is the header file which google gave me when I use net-transport:

2003-10-01 11:35:40.085 HTTP/1.1 200 OK
2003-10-01 11:35:40.085 Date: Wed, 01 Oct 2003 15:35:38 GMT
2003-10-01 11:35:40.085 Server: GWS/2.1
2003-10-01 11:35:40.085 Content-length: 67700
2003-10-01 11:35:40.085 Cache-control: no-cache, must-revalidate
2003-10-01 11:35:40.085 Expires: Fri, 01 Jan 1990 00:00:00 GMT
2003-10-01 11:35:40.085 Pragma: no-cache
2003-10-01 11:35:40.085 Last-Modified: Wed, 01 Oct 2003 15:30:28 GMT
2003-10-01 11:35:40.085 Content-Type: text/html


------------------------------

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



------------------------------

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.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5598
***************************************


home help back first fref pref prev next nref lref last post