[26986] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8929 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 7 11:05:50 2006

Date: Tue, 7 Feb 2006 08:05:04 -0800 (PST)
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, 7 Feb 2006     Volume: 10 Number: 8929

Today's topics:
    Re: Best way for -h option for script to run perldoc on <a24061@yahoo.com>
    Re: facl under Solaris (Anno Siegel)
    Re: Keith Keller: Hypocrite <matthew.garrish@sympatico.ca>
    Re: problem with XML::Parser dying on errors... xhoster@gmail.com
    Re: Regular Expression for 001-999 <xx087@freenet.carleton.ca>
    Re: Regular Expression for 001-999 <abaugher@esc.pike.il.us>
    Re: Regular Expression for 001-999 <1usa@llenroc.ude.invalid>
    Re: SOAP::Lite example meets http server 500 error? <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Feb 2006 13:04:22 +0000
From: Adam Funk <a24061@yahoo.com>
Subject: Re: Best way for -h option for script to run perldoc on itself?
Message-Id: <mfimb3-3ql.ln1@news.ducksburg.com>

On 2006-02-07, Ed Hennig <edh@example.com> wrote:
> What's the best or correct way to get a Perl program to handle the -h
> option (through getopts) by outputting its own perldoc documentation
> to the terminal?
>
> exec("perldoc " . $0) if ( $option{h} );

That's roughly how I've been doing it, although I can't remember where
I learned it.  The following is an excerpt from one of my programs.

use Getopt::Std ;
my %option;

getopts("hsb:t:p:P:fdDlwT:a", \%option) ;

if ( $option{h} ) {
    exec("perldoc " . $0) ;  # exec terminates this script
}


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

Date: 7 Feb 2006 11:06:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: facl under Solaris
Message-Id: <ds9v0a$18v$3@mamenchi.zrz.TU-Berlin.DE>

Steffen Netz  <SteffenNetz@freenet.de> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> > Steffen Netz  <SteffenNetz@freenet.de> wrote in comp.lang.perl.misc:
> > > 
> > > Hello,
> > > 
> > > how can I get the file-tests to consider the FACL's in Solaris?
> > > In the ExtUtils::Install Module is an test 
> > > 	    if (!$nonono && !-w $targetdir) {
> > > 		warn "Warning: You do not have permissions to " .
> > > 		    "install into $from_to{$source_dir_or_file}"
> > > 		    unless $warn_permissions++;
> > > 	    }
> > > 
> > > My targetdir is open only under facl.
> > > Therefore Install fails.
> > 
> > Have you searched CPAN?  There's a module Solaris::ACL that should
> > help.  I'd expect that ExtUtils::Install must be told to use it.
> > 
> > Anno
> 
> Hi Anno,
> 
> I have. I installed a patch in my ExtUtils::Install,
> but cannot access the shadoww-passwords via getpw*
> Therefore, I have my UID hardcoded. Rather bad.
> ...
>  my $acl=getfacl($targetdir);
>  if (!$nonono && !-w $targetdir && !($acl->users(305) &02 )) {
> ...
> 
> How is the best way to contact Module-Owner? 
> Via PM, or is there a newsgroup?

Mail the author at the address given in the pod under AUTHOR.  Some
modules have their own mailing list, but I doubt this one does.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: Tue, 7 Feb 2006 07:20:21 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Keith Keller: Hypocrite
Message-Id: <7g0Gf.2257$J%6.151652@news20.bellglobal.com>


"R3e4al5to 23ar3ga4rino" <1m@b3i4t5eme.org> wrote in message 
news:SaTFf.12144$1e5.302723@news20.bellglobal.com...
>
> It appears that Mr. Keller wants to kiss the asses of those in
> comp.lang.perl.misc but he is perfectly willing to shit all over
> those in alt.os.linux.slackware.
>

I like his priorities!

Is that what you were asking?

Matt 




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

Date: 07 Feb 2006 15:34:40 GMT
From: xhoster@gmail.com
Subject: Re: problem with XML::Parser dying on errors...
Message-Id: <20060207103710.665$8x@newsreader.com>

bboett@adlp.org wrote:
> hello!
>
> i have a little daemon which fetches regularly some rss feeds, now for
> some time that daemon keeps crashing on me with the message:
> not well-formed (invalid token) at line 80, column 45, byte 4904 at
> /usr/lib/perl5/XML/Parser.pm line 187
> from the cpan shell:
> XML::Parser is up to date (2.34).
>
> i mean i would like to deal with the error myself, e.g. spit out the
> data that caused that error... but at the moment i seem unable to stop
> XML::Parser or expat to die on my with no usable info on what is going
> wrong....

You trap XML::Parser dies the same way you trap any other dies in Perl,
by using eval BLOCK.  See perldoc -f eval.  Once you trap the die, I don't
know how you get the data which caused it in a nice format for printing.
Perhaps you should pass your data through a validator before giving it to
XML::Parser.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 7 Feb 2006 14:48:57 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Regular Expression for 001-999
Message-Id: <slrnduhcqp.5bi.xx087@smeagol.ncf.ca>

At 2006-02-07 05:35AM, Armin Gajda <twist64@gmx.de> wrote:
>  Armin Gajda schrieb:
> > Hi,
> > 
> > can someone tell me how to define a regular expression that matches
> > 
> > L001-L999 OR P001-P009?
> > 
> > I found: ^[LP]\d{3}$
> > 
> > But here the L000 and P000 is allowed.
> > Any ideas?
> > 
> > bye Armin
>  
>  Thank you for the answers - it works!
>  
>  bye Armin

Also, negative look-ahead:
    /^[LP](?!000)\d{3}$/


-- 
Glenn Jackman
Ulterior Designer


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

Date: Tue, 07 Feb 2006 09:24:36 -0600
From: Aaron Baugher <abaugher@esc.pike.il.us>
Subject: Re: Regular Expression for 001-999
Message-Id: <8664nrb39n.fsf@cail.baugher.pike.il.us>

Armin Gajda <twist64@gmx.de> writes:

> can someone tell me how to define a regular expression that matches
>
> L001-L999 OR P001-P009?
>
> I found: ^[LP]\d{3}$
>
> But here the L000 and P000 is allowed.

If this is a practical situation and not a homework assignment, I'd
stick with your simple regex, and skip those two special cases with a
second simple regex, something like:

  ( /^[LP]\d{3}$/ and not /000/ )

I don't know whether that'll run faster or slower, but it was
certainly faster to code.


-- 
Aaron -- aaron_baugher@yahoo.com
         http://360.yahoo.com/aaron_baugher


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

Date: Tue, 07 Feb 2006 15:56:43 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Regular Expression for 001-999
Message-Id: <Xns97636F6D46894asu1cornelledu@127.0.0.1>

Aaron Baugher <abaugher@esc.pike.il.us> wrote in 
news:8664nrb39n.fsf@cail.baugher.pike.il.us:

> Armin Gajda <twist64@gmx.de> writes:
> 
>> can someone tell me how to define a regular expression that matches
>>
>> L001-L999 OR P001-P009?
>>
>> I found: ^[LP]\d{3}$
>>
>> But here the L000 and P000 is allowed.
> 
> If this is a practical situation and not a homework assignment, I'd
> stick with your simple regex, and skip those two special cases with a
> second simple regex, something like:
> 
>   ( /^[LP]\d{3}$/ and not /000/ )
> 
> I don't know whether that'll run faster or slower, but it was
> certainly faster to code.

You might want to look at the requirements again:

L001-L999

or

P001-P009

Hence, if you want a single regex:

#!/usr/bin/perl

use strict;
use warnings;

while (<DATA>) {
    chomp;
    print "$_\n" if m{ \A (?:L\d\d[1-9]) | (?:P00[1-9]) \z }x;
}

__DATA__
L000
L123
L999
P000
P001
P901

Or, it might be faster to break it up:

#!/usr/bin/perl

use strict;
use warnings;

while (<DATA>) {
    chomp;
    print "$_\n" if m{ \A L \d \d [1-9] \z }x 
                 or m{ \A P  0  0 [1-9] \z }x;
}

__DATA__
L000
L123
L999
P000
P001
P901

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Tue, 7 Feb 2006 09:20:12 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: SOAP::Lite example meets http server 500 error?
Message-Id: <slrnduhelc.ogh.tadmc@magna.augustmail.com>

jck11 <jck11@msr.pchome.com.tw> wrote:

> I meet http 500 error when I run the perl code below


Your Question is Asked Frequently.

   perldoc -q 500

     My CGI script runs from the command line but not the 
     browser.  (500 Server Error)


> Package World;
  ^
  ^

Case matters.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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 V10 Issue 8929
***************************************


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