[26573] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8709 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 26 14:05:27 2005

Date: Sat, 26 Nov 2005 11:05:05 -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           Sat, 26 Nov 2005     Volume: 10 Number: 8709

Today's topics:
    Re: /(foo|)/ vs /(foo)?/ robic0
    Re: Hash's Regex Transformation with Map <xx087@freenet.carleton.ca>
    Re: Hash's Regex Transformation with Map robic0
    Re: Hash's Regex Transformation with Map <tadmc@augustmail.com>
        modules, modules, modules robic0
    Re: modules, modules, modules <tadmc@augustmail.com>
    Re: modules, modules, modules <sherm@dot-app.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 26 Nov 2005 05:21:01 -0800
From: robic0
Subject: Re: /(foo|)/ vs /(foo)?/
Message-Id: <cingo1pi0s581ocupj764c5ctpb1k1k8j9@4ax.com>

On Fri, 18 Nov 2005 03:11:38 +0100, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:

>Eric J. Roode:
>
>>    "(?(condition)yes-pattern|no-pattern)"
>>    "(?(condition)yes-pattern)"
>>
>>       Conditional expression.  "(condition)" should be either an
>>       integer in parentheses (which is valid if the corresponding
>>       pair of parentheses matched), or look-ahead/look-behind/eval-
>>       uate zero-width assertion.
>>
>>       For example:
>>
>>           m{ ( \( )?
>>              [^()]+
>>              (?(1) \) )
>>            }x
>>
>>       matches a chunk of non-parentheses, possibly included in
>>       parentheses themselves.
>>
>> This.... is vague at best.  What is "no-pattern"?
>
>The pattern that will be used if the test returned false.
>
>
>>  What means
>> "valid"? ("matches", I assume, but perhaps one should not use it if
>> there's a chance that the numbered parentheses don't match?)
>
>The (1) is only valid if there exists a corresponding (capturing?)
>group.
>
>
>  m{ ( \( )?     # optional opening paren
>     [^()]+      # 1 or more non-parens
>     (?(1) \) )  # if the 1st group matched, so there was
>                 #   an opening paren, then require a
>                 #   closing one
>   }x

This is just amazing, singular regex concepts agreggated in
a nested theorehtical proof. Random number generator plus
character code/stream will break this type of nesting proofs
every time. You can't depend on the regex module to unwind
its stack like this. The reason you think this is valid
is because your sole input matches an expected output.
Try the random generator for a few months, capture the 
(failures if possible) sucesses. You may be in for a
shock!

>
>
>I guess that if the "corresponding pair of parens" didn't match+capture,
>$1 keeps its old value, because the ? comes after the 1st group.



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

Date: 26 Nov 2005 12:47:57 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Hash's Regex Transformation with Map
Message-Id: <slrndogmbt.in6.xx087@smeagol.ncf.ca>

At 2005-11-25 10:49PM, Edward WIJAYA <ewijaya@singnet.com.sg> wrote:
>  Hi all,
>  
>  How can I make my snippet below:
>  
>  
>  $ perl -MData::Dumper -e '
>  $h = {"A[TCG]GG 3" => foo, "CTG[AA] 2" => bar};
>  %nh = map { my $k =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
>  print Dumper \%nh;'

$k is undefined

    %nh = map { ($k = $_) =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
-------------------^^^^^

-- 
Glenn Jackman
Ulterior Designer


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

Date: Sat, 26 Nov 2005 05:30:18 -0800
From: robic0
Subject: Re: Hash's Regex Transformation with Map
Message-Id: <1mogo1l374ou8n5v2nju8c7761drkikmju@4ax.com>

On 26 Nov 2005 12:47:57 GMT, Glenn Jackman <xx087@freenet.carleton.ca>
wrote:

>At 2005-11-25 10:49PM, Edward WIJAYA <ewijaya@singnet.com.sg> wrote:
>>  Hi all,
>>  
>>  How can I make my snippet below:
>>  
>>  
>>  $ perl -MData::Dumper -e '
>>  $h = {"A[TCG]GG 3" => foo, "CTG[AA] 2" => bar};
>>  %nh = map { my $k =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
>>  print Dumper \%nh;'
>
>$k is undefined
>
>    %nh = map { ($k = $_) =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
                       ^^
Yeah but get the can't use global in "my ($k = $_)" since $_ is
global and declared elsewhere (if strict).



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

Date: Sat, 26 Nov 2005 11:23:55 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Hash's Regex Transformation with Map
Message-Id: <slrndoh6hb.arv.tadmc@magna.augustmail.com>

robic0 <> wrote:
> On 26 Nov 2005 12:47:57 GMT, Glenn Jackman <xx087@freenet.carleton.ca>
> wrote:
> 
>>At 2005-11-25 10:49PM, Edward WIJAYA <ewijaya@singnet.com.sg> wrote:
>>>  Hi all,
>>>  
>>>  How can I make my snippet below:
>>>  
>>>  
>>>  $ perl -MData::Dumper -e '
>>>  $h = {"A[TCG]GG 3" => foo, "CTG[AA] 2" => bar};
>>>  %nh = map { my $k =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
>>>  print Dumper \%nh;'
>>
>>$k is undefined
>>
>>    %nh = map { ($k = $_) =~ s/\[[ATCG]+\]/S/g; $k=> $h->{$_} } (keys %{$h});
>                        ^^
> Yeah but get the can't use global in "my ($k = $_)" 


Did you try it?

Did in not work when you did?


> since $_ is
> global and declared elsewhere (if strict).


The built-in variables need not be declared, even under "use strict".


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


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

Date: Sat, 26 Nov 2005 03:33:38 -0800
From: robic0
Subject: modules, modules, modules
Message-Id: <thhgo15btusdquaqkbftag0ukvtpcvt1sg@4ax.com>

Is it just me or do most Perl modules (Cpan) exist
outside of perl standard distribution? The phrase
"try this module" casually uttered here. Am I 
mistaken, so many beta this and beta that listings.
If I put out a module on CPAN is it a guarantee
of fittness for any user of it? There is so much
crap and garbage out there on CPAN it makes my
head spin (Telnet being one). I've given up
on anything but in the official distribution.
Can anyone tell me why I've done that, or am
I just imagining things?



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

Date: Sat, 26 Nov 2005 07:54:22 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: modules, modules, modules
Message-Id: <slrndogq8e.8c0.tadmc@magna.augustmail.com>

robic0 <> wrote:

> Is it just me or do most Perl modules (Cpan) exist
> outside of perl standard distribution? 


It is not just you.


> The phrase
> "try this module" casually uttered here. 


Because most Real Programmers have already bought into the
idea of code reuse.


> Am I 
> mistaken, so many beta this and beta that listings.


You are not mistaken.

Uttering "try this module" where the module is beta could be
a mistake though. Have you seen that happen? Got an example?


> If I put out a module on CPAN is it a guarantee
> of fittness for any user of it? 


No.


> There is so much
> crap and garbage out there on CPAN it makes my
> head spin (Telnet being one). 


Do not use the modules that you have identified as crap and garbage,
just use the ones that smell pretty to you.


> I've given up
> on anything but in the official distribution.


OK.


> Can anyone tell me why I've done that, 


Discerning how you think is beyond me.


> or am
> I just imagining things?


Imagining that you have given up on CPAN modules?

I think you can trust yourself, so you are (probably) not
imagining that you have given up on CPAN modules.


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


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

Date: Sat, 26 Nov 2005 13:54:52 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: modules, modules, modules
Message-Id: <m24q5zutmr.fsf@Sherm-Pendleys-Computer.local>

robic0 writes:

> Is it just me or do most Perl modules (Cpan) exist
> outside of perl standard distribution? The phrase
> "try this module" casually uttered here.

It's not just you. I'd go so far as to say that CPAN is Perl's standout
feature. In my opinion, the power of Perl isn't what the language itself
lets you write; it's what CPAN lets you *not* write.

> mistaken, so many beta this and beta that listings.
> If I put out a module on CPAN is it a guarantee
> of fittness for any user of it?

No, there's no formal "vetting" procedure. There is a rating system on
<http://search.cpan.org>, but it isn't very widely used.

> There is so much crap and garbage out there on CPAN

Sturgeon's Law applies - 90% of *everything* is crap.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

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 8709
***************************************


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