[31126] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2371 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 03:09:44 2009

Date: Tue, 28 Apr 2009 00:09:09 -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           Tue, 28 Apr 2009     Volume: 11 Number: 2371

Today's topics:
        How to find duplicate in certain fields of array?? <some@body.com>
    Re: How to find duplicate in certain fields of array?? <rvtol+usenet@xs4all.nl>
    Re: How to find duplicate in certain fields of array?? <some@body.com>
    Re: How to find duplicate in certain fields of array?? <jurgenex@hotmail.com>
        Net::NNTP <ashley@123phonesex>
        new CPAN modules on Tue Apr 28 2009 (Randal Schwartz)
    Re: Perl is too slow - A statement <cherryplankton@gmail.com>
    Re: Perl is too slow - A statement <stoupa@practisoft.cz>
    Re: Sub indentation trouble <nospam-abuse@ilyaz.org>
    Re: unexplained warning message in m{...} regexp <nospam-abuse@ilyaz.org>
    Re: unexplained warning message in m{...} regexp <someone@example.com>
    Re: unexplained warning message in m{...} regexp <ben@morrow.me.uk>
    Re: unexplained warning message in m{...} regexp <devnull4711@web.de>
    Re: unexplained warning message in m{...} regexp <uri@stemsystems.com>
    Re: unexplained warning message in m{...} regexp <devnull4711@web.de>
    Re: unexplained warning message in m{...} regexp <uri@stemsystems.com>
        What perlop doesn't tell you about indirect method call <blgl@hagernas.com>
    Re: What perlop doesn't tell you about indirect method  <uri@stemsystems.com>
    Re: What perlop doesn't tell you about indirect method  <blgl@hagernas.com>
    Re: What perlop doesn't tell you about indirect method  <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 27 Apr 2009 17:54:00 -0400
From: somebody <some@body.com>
Subject: How to find duplicate in certain fields of array??
Message-Id: <pan.2009.04.27.21.53.58.753269@body.com>

In the __DATA__ below, the first and last rows contain duplicate names,
i.e., WILLIAM in the first row, and HARRIS in the last row.  I need to
check each of the 4 name fields (first, middle, last, and suffix) for
duplicate names.  So, I've pushed the 4 name fields into a separate array
named @array.  How do I check for duplicates within the 4 named fields?
This is a bit more involved than finding duplicate array elements, since
sub-strings are involved.

-Thanks


while ( <DATA> ) {

  @row = split /\|/;

  #Place all 4 name fields in array(first, middle, last, suffix).
  for ($i=3; $i <= 6; $i++) {
    push (@array, "$row[$i]");
  }


__DATA__
CA|6299| |WILLIAM| |S|SMITH WILLIAM|
DE|6209| |MANNY|J|MORALES|JR.|
WA|1838| |KATHLEEN| |MCDONALD| |
OH|3968| |JR|SCOTT HARRIS|HARRIS|JR| 



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

Date: Tue, 28 Apr 2009 00:19:18 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: How to find duplicate in certain fields of array??
Message-Id: <49f62f66$0$191$e4fe514c@news.xs4all.nl>

somebody wrote:

>   for ($i=3; $i <= 6; $i++) {
>     push (@array, "$row[$i]");
>   }

Equivalent:

     push @array, @row[ 3 .. 6 ];


1. Your question mark key is broken.
2. You are unwantingly pushing the data from all rows into one array.
3. In perlretut you will find \b. But you already know split.

-- 
Ruud


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

Date: Mon, 27 Apr 2009 22:42:30 -0400
From: somebody <some@body.com>
Subject: Re: How to find duplicate in certain fields of array??
Message-Id: <pan.2009.04.28.02.42.28.943409@body.com>

On Tue, 28 Apr 2009 00:19:18 +0200, Dr.Ruud wrote:

> somebody wrote:
> 
>>   for ($i=3; $i <= 6; $i++) {
>>     push (@array, "$row[$i]");
>>   }
> 
> Equivalent:
> 
>      push @array, @row[ 3 .. 6 ];
> 

That's a much more compact syntax.  But now how do you find duplicates in
$row[3], 4, 5, and 6?  I need to determine that there are 2 WILLIAM in
the first row, and 2 HARRIS in the forth row. 

-Thanks

__DATA__
CA|6299| |WILLIAM| |S|SMITH WILLIAM|
DE|6209| |MANNY|J|MORALES|JR.|
WA|1838| |KATHLEEN| |MCDONALD| |
OH|3968| |JR|SCOTT HARRIS|HARRIS|JR| 



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

Date: Mon, 27 Apr 2009 19:57:13 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to find duplicate in certain fields of array??
Message-Id: <horcv4drd62bilb9kptcg10de4223ou3ku@4ax.com>

somebody <some@body.com> wrote:
>But now how do you find duplicates in
>$row[3], 4, 5, and 6?  I need to determine that there are 2 WILLIAM in
>the first row, and 2 HARRIS in the forth row. 

Please define "duplicate". Would "Harris" also be a duplicate of
"Harrison"? Or "Sam" of "Samuel"?
Would "William" be a duplicate of "John-William"?

>__DATA__
>CA|6299| |WILLIAM| |S|SMITH WILLIAM|
>DE|6209| |MANNY|J|MORALES|JR.|
>WA|1838| |KATHLEEN| |MCDONALD| |
>OH|3968| |JR|SCOTT HARRIS|HARRIS|JR| 

For these sample data you can simply create the set of all names (by
whatever definition of "name"; that definition determines how to split
the entry into individual items) per column and then check if the set
intersection is emtpy. Details on that part please see "perldoc -q
intersection".

jue


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

Date: Mon, 27 Apr 2009 18:53:45 -0400
From: "Horny Girls" <ashley@123phonesex>
Subject: Net::NNTP
Message-Id: <gt5dba02ke2@news6.newsguy.com>

I am trying to create a perl function that posts to newsgroups.  I have an 
account with newsguy and I'm trying to connect through their server using 
Net:NNTP.  I believe I've made the connection but I'm not quite sure.  So 
I'm not sure if my message isn't in the correct format or if I don't have 
the perl code right.  I did get a response of '1' when I asked a simple 
post_ok, so I think that a connection has been made.  And I've double 
checked my message and should have all the required fields in the correct 
format.  Does anyone have any suggestions?

Here's the basic code:

use NET::NNTP;
my $nntp = Net::NNTP->new($newshost);
$nntp->authinfo($settings{'newsusr'}, $settings{'newspass'});
my $ok = $nntp->postok();
$nntp->post(@message);
$nntp->quit();

$ok returns 1.

Ken 




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

Date: Tue, 28 Apr 2009 04:42:31 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Apr 28 2009
Message-Id: <KIsnqv.1Cry@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-Pythonic-Functions-0.2
http://search.cpan.org/~hlubenow/Acme-Pythonic-Functions-0.2/
Python-like functions for Perl 
----
Alien-WiX-0.305224
http://search.cpan.org/~csjewell/Alien-WiX-0.305224/
Installing and finding Windows Installer XML (WiX) 
----
AnyEvent-4.4
http://search.cpan.org/~mlehmann/AnyEvent-4.4/
provide framework for multiple event loops 
----
Apache2-WURFLFilter-1.61
http://search.cpan.org/~ifuschini/Apache2-WURFLFilter-1.61/
is a Apache Mobile Filter that manage content (text & image) to the correct mobile device 
----
Bio-PrimerDesigner-0.06
http://search.cpan.org/~smckay/Bio-PrimerDesigner-0.06/
Design PCR Primers using primer3 and epcr 
----
Bot-BasicBot-Pluggable-Module-Eliza-0.05
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-Module-Eliza-0.05/
Eliza for Bot::BasicBot::Pluggable 
----
CPAN-FindDependencies-2.32
http://search.cpan.org/~dcantrell/CPAN-FindDependencies-2.32/
find dependencies for modules on the CPAN 
----
CPAN-Mini-Growl-0.03
http://search.cpan.org/~miyagawa/CPAN-Mini-Growl-0.03/
Growls updates from CPAN::Mini 
----
CPANPLUS-0.86
http://search.cpan.org/~kane/CPANPLUS-0.86/
API & CLI access to the CPAN mirrors 
----
CPANPLUS-0.8601
http://search.cpan.org/~kane/CPANPLUS-0.8601/
API & CLI access to the CPAN mirrors 
----
CPANPLUS-Dist-Build-0.24
http://search.cpan.org/~bingos/CPANPLUS-Dist-Build-0.24/
CPANPLUS plugin to install packages that use Build.PL 
----
CSS-Parse-Packed-0.03
http://search.cpan.org/~ziguzagu/CSS-Parse-Packed-0.03/
A CSS::Parse module packed duplicated selectors. 
----
Catalyst-Controller-RequestToken-0.05
http://search.cpan.org/~hide/Catalyst-Controller-RequestToken-0.05/
Handling transaction token across forms 
----
Catalyst-Controller-WrapCGI-0.0030
http://search.cpan.org/~rkitover/Catalyst-Controller-WrapCGI-0.0030/
Run CGIs in Catalyst 
----
Catalyst-Controller-WrapCGI-0.0031
http://search.cpan.org/~rkitover/Catalyst-Controller-WrapCGI-0.0031/
Run CGIs in Catalyst 
----
Catalyst-Controller-WrapCGI-0.0032
http://search.cpan.org/~rkitover/Catalyst-Controller-WrapCGI-0.0032/
Run CGIs in Catalyst 
----
Catalyst-Plugin-Params-Demoronize-1.11
http://search.cpan.org/~diz/Catalyst-Plugin-Params-Demoronize-1.11/
convert common UTF-8 and Windows-1252 characters to their ASCII equivalents 
----
Catalyst-Plugin-SmartURI-0.032
http://search.cpan.org/~rkitover/Catalyst-Plugin-SmartURI-0.032/
Configurable URIs for Catalyst 
----
Catalyst-View-GD-Barcode-QRcode-0.05
http://search.cpan.org/~hide/Catalyst-View-GD-Barcode-QRcode-0.05/
GD::Barcode::QRcode View Class 
----
CatalystX-CRUD-0.42
http://search.cpan.org/~karman/CatalystX-CRUD-0.42/
CRUD framework for Catalyst applications 
----
CatalystX-Menu-Suckerfish-0.01
http://search.cpan.org/~converter/CatalystX-Menu-Suckerfish-0.01/
Generate an HTML UL element for use as a CSS-enhanced Suckerfish menu. 
----
CatalystX-Menu-Tree-0.01
http://search.cpan.org/~converter/CatalystX-Menu-Tree-0.01/
Generate a menu tree from a Catalyst application's actions 
----
Chart-Clicker-2.23
http://search.cpan.org/~gphat/Chart-Clicker-2.23/
Powerful, extensible charting. 
----
Chess-Play-0.05
http://search.cpan.org/~gippoliti/Chess-Play-0.05/
Play chess games, calculate legal moves, use a search algorithm 
----
Class-MOP-0.83
http://search.cpan.org/~drolsky/Class-MOP-0.83/
A Meta Object Protocol for Perl 5 
----
DBIx-Class-0.08101
http://search.cpan.org/~ribasushi/DBIx-Class-0.08101/
Extensible and flexible object <-> relational mapper. 
----
DBIx-InsertHash-0.011
http://search.cpan.org/~uvoelker/DBIx-InsertHash-0.011/
insert/update a database record from a hash 
----
DateTime-TimeZone-0.90
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.90/
Time zone object base class and factory 
----
EV-3.6
http://search.cpan.org/~mlehmann/EV-3.6/
perl interface to libev, a high performance full-featured event loop 
----
Ed2k_link-20090427
http://search.cpan.org/~val/Ed2k_link-20090427/
module for creation and work with eD2K links 
----
Fedora-App-ReviewTool-0.08
http://search.cpan.org/~rsrchboy/Fedora-App-ReviewTool-0.08/
Application class for ReviewTool 
----
Fedora-App-ReviewTool-0.09
http://search.cpan.org/~rsrchboy/Fedora-App-ReviewTool-0.09/
Application class for ReviewTool 
----
Finance-QuoteDB-0.07
http://search.cpan.org/~ecocode/Finance-QuoteDB-0.07/
User database tools based on Finance::Quote 
----
Finance-QuoteDB-0.08
http://search.cpan.org/~ecocode/Finance-QuoteDB-0.08/
User database tools based on Finance::Quote 
----
FreeBSD-Ports-INDEXhash-1.2.1
http://search.cpan.org/~vvelox/FreeBSD-Ports-INDEXhash-1.2.1/
Generates a hash out of the FreeBSD Ports index file. 
----
GD-Graph-ohlc-0.9600
http://search.cpan.org/~jettero/GD-Graph-ohlc-0.9600/
GD::Graph type that shows open, high, low and close as ticks on little sticks 
----
Git-SVNReplay-1.0210
http://search.cpan.org/~jettero/Git-SVNReplay-1.0210/
replay git commits into a throwaway svn repo 
----
HTML-Defang-1.01
http://search.cpan.org/~kurianja/HTML-Defang-1.01/
Cleans HTML as well as CSS of scripting and other executable contents, and neutralises XSS attacks. 
----
HTTP-Request-AsCGI-0.6
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.6/
Set up a CGI environment from an HTTP::Request 
----
HTTP-Request-AsCGI-0.7
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.7/
Set up a CGI environment from an HTTP::Request 
----
HTTP-Request-AsCGI-0.8
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.8/
Set up a CGI environment from an HTTP::Request 
----
HTTP-Request-AsCGI-0.9
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.9/
Set up a CGI environment from an HTTP::Request 
----
JSON-DWIW-0.32
http://search.cpan.org/~dowens/JSON-DWIW-0.32/
JSON converter that Does What I Want 
----
Locale-Maketext-Gettext-1.27
http://search.cpan.org/~imacat/Locale-Maketext-Gettext-1.27/
Joins the gettext and Maketext frameworks 
----
Log-Report-0.24
http://search.cpan.org/~markov/Log-Report-0.24/
report a problem, pluggable handlers and language support 
----
Mail-ClamAV-0.27
http://search.cpan.org/~converter/Mail-ClamAV-0.27/
Perl extension for the clamav virus scanner 
----
Mail-ClamAV-0.28
http://search.cpan.org/~converter/Mail-ClamAV-0.28/
Perl extension for the clamav virus scanner 
----
Math-ODE-0.05_01
http://search.cpan.org/~leto/Math-ODE-0.05_01/
Solve N-th Order Ordinary Differential Equations 
----
Module-Install-CheckLib-0.02
http://search.cpan.org/~bingos/Module-Install-CheckLib-0.02/
A Module::Install extension to check that a library is available 
----
Module-Install-NoAutomatedTesting-0.02
http://search.cpan.org/~bingos/Module-Install-NoAutomatedTesting-0.02/
A Module::Install extension to avoid CPAN Testers 
----
Moose-0.76
http://search.cpan.org/~drolsky/Moose-0.76/
A postmodern object system for Perl 5 
----
MooseX-Constructor-AllErrors-0.007
http://search.cpan.org/~hdp/MooseX-Constructor-AllErrors-0.007/
capture all constructor errors 
----
MooseX-FSM-0.01
http://search.cpan.org/~goraxe/MooseX-FSM-0.01/
The great new MooseX::FSM! 
----
MooseX-InsideOut-0.103
http://search.cpan.org/~hdp/MooseX-InsideOut-0.103/
inside-out objects with Moose 
----
MooseX-Lexical-Types-0.01
http://search.cpan.org/~flora/MooseX-Lexical-Types-0.01/
automatically validate lexicals against Moose type constraints 
----
MooseX-Role-XMLRPC-Client-0.03
http://search.cpan.org/~rsrchboy/MooseX-Role-XMLRPC-Client-0.03/
provide the needed bits to be a XML-RPC client 
----
MooseX-Workers-0.05
http://search.cpan.org/~perigrin/MooseX-Workers-0.05/
Provides a simple sub-process management for asynchronous tasks. 
----
PDF-FDF-Simple-0.19
http://search.cpan.org/~schwigon/PDF-FDF-Simple-0.19/
Read and write (Acrobat) FDF files. 
----
POE-Stage-0.05
http://search.cpan.org/~rcaputo/POE-Stage-0.05/
a base class for message-driven objects 
----
Padre-Plugin-Perl6-0.34
http://search.cpan.org/~azawawi/Padre-Plugin-Perl6-0.34/
Padre plugin for Perl6 
----
Poppler-0.01
http://search.cpan.org/~cornelius/Poppler-0.01/
perl binding of poppler library. 
----
Poppler-0.02
http://search.cpan.org/~cornelius/Poppler-0.02/
perl binding of poppler library. 
----
Queue-Q4Pg-Lite-0.02
http://search.cpan.org/~fujiwara/Queue-Q4Pg-Lite-0.02/
Simple message queue using PostgreSQL 
----
Queue-Q4Pg-Lite-0.03
http://search.cpan.org/~fujiwara/Queue-Q4Pg-Lite-0.03/
Simple message queue using PostgreSQL 
----
Railsish-0.21
http://search.cpan.org/~gugod/Railsish-0.21/
A web application framework. 
----
SSH-Batch-0.018
http://search.cpan.org/~agent/SSH-Batch-0.018/
Cluster operations based on parallel SSH, set and interval arithmetic 
----
SSH-Batch-0.019
http://search.cpan.org/~agent/SSH-Batch-0.019/
Cluster operations based on parallel SSH, set and interval arithmetic 
----
SVG-Sparkline-0.2.7
http://search.cpan.org/~gwadej/SVG-Sparkline-0.2.7/
Create Sparklines in SVG 
----
Shipwright-2.2.0
http://search.cpan.org/~sunnavy/Shipwright-2.2.0/
Best Practical Builder 
----
Socket-Class-2.16
http://search.cpan.org/~chrmue/Socket-Class-2.16/
A class to communicate with sockets 
----
Sub-Curried-0.07
http://search.cpan.org/~osfameron/Sub-Curried-0.07/
Currying of subroutines via a new 'curry' declarator 
----
Sub-Curried-0.08
http://search.cpan.org/~osfameron/Sub-Curried-0.08/
Currying of subroutines via a new 'curry' declarator 
----
TaskForest-1.24
http://search.cpan.org/~enoor/TaskForest-1.24/
A simple but expressive job scheduler that allows you to chain jobs/tasks and create time dependencies. Uses text config files to specify task dependencies. 
----
Term-GentooFunctions-1.3501
http://search.cpan.org/~jettero/Term-GentooFunctions-1.3501/
provides gentoo's einfo, ewarn, eerror, ebegin and eend. 
----
Test-Ping-0.08
http://search.cpan.org/~xsawyerx/Test-Ping-0.08/
Testing pings using Net::Ping 
----
Test-XML-Element-0.01
http://search.cpan.org/~cycles/Test-XML-Element-0.01/
Test the properties a single XML element in isolation. 
----
Text-SmartLinks-0.01
http://search.cpan.org/~szabgab/Text-SmartLinks-0.01/
connecting test files with pod documentation 
----
Tree-Template-Declare-0.1
http://search.cpan.org/~dakkar/Tree-Template-Declare-0.1/
easily build tree structures 
----
Tree-Transform-XSLTish-0.1
http://search.cpan.org/~dakkar/Tree-Transform-XSLTish-0.1/
transform tree data, like XSLT but in Perl 
----
TryCatch-1.001000
http://search.cpan.org/~ash/TryCatch-1.001000/
first class try catch semantics for Perl, without source filters. 
----
URI-SmartURI-0.026
http://search.cpan.org/~rkitover/URI-SmartURI-0.026/
Subclassable and hostless URIs 
----
URI-SmartURI-0.027
http://search.cpan.org/~rkitover/URI-SmartURI-0.027/
Subclassable and hostless URIs 
----
UUID-Generator-PurePerl-0.05
http://search.cpan.org/~banb/UUID-Generator-PurePerl-0.05/
Universally Unique IDentifier (UUID) Generator 
----
UUID-Object-0.80
http://search.cpan.org/~banb/UUID-Object-0.80/
Universally Unique IDentifier (UUID) Object Class 
----
XML-XPathEngine-0.12
http://search.cpan.org/~mirod/XML-XPathEngine-0.12/
a re-usable XPath engine for DOM-like trees 
----
autobox-dump-20090426.1746
http://search.cpan.org/~cowens/autobox-dump-20090426.1746/
human/perl readable strings from the results of an EXPR 
----
jmx4perl-0.01_02
http://search.cpan.org/~roland/jmx4perl-0.01_02/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Mon, 27 Apr 2009 16:14:04 -0500
From: cherryplankton <cherryplankton@gmail.com>
Subject: Re: Perl is too slow - A statement
Message-Id: <1116339401262559395.065716cherryplankton-gmail.com@news.giganews.com>

<mercurish@googlemail.com> wrote:
> We hear this all too common:
>             "I have one huge problem with Perl; it is too slow."
> 
> But is Perl realy slow, could perl be slow at all?
> 
> The problem is that most programmers associate an implementation of a
> programming
> language with the language it self. The current interpreter is too
> slow and hence programmers
> think that 'Perl' is too slow.
> 
> Perl5 doesn't perform anything to make Perl machine like-able, Perl5
> is infact hated by machines
> where the Perl5 program is being executed.
> 
> Though however, with Perl6 the maintainers of the programming language
> are hoping to reduce the
> runtime overhead of using Perl over the traditional programming
> languages such as C.
> 
> But is Perl ready to be used for huge projects or is other languges
> such as Python taking over??
> 
> What are we going to do??
> 
> 
> -- Kasra
You want to see slow? Try a bad SQL join called from PHP with Firefox on
a slow one-core machine. Than after pulling hair and doing a forced
shutdown and reboot, Firefox asks if you want to restore the previous
session?  Perl has never done that to me. Always fast service with Perl.
 

-- 
signed


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

Date: Tue, 28 Apr 2009 00:58:52 +0200
From: "Petr Vileta \"fidokomik\"" <stoupa@practisoft.cz>
Subject: Re: Perl is too slow - A statement
Message-Id: <gt5dfc$2gta$1@ns.felk.cvut.cz>

sln@netherlands.com wrote:
> On Sun, 26 Apr 2009 01:21:30 -0700 (PDT), neilsolent
> <n@solenttechnology.co.uk> wrote: 
> 
>> Why don't you post some simple scripts doing what you think Perl is
>> slow at - and show us how it can be done faster in some other
>> language? 
> 
> char *str = "This is a long sentence";
> printf ("%s", &str[10]);
> 
> ----------------
> 
> my $str = "This is a long sentence";
> my @words = split ' ', $str;
> printf ("%s %s", @words[3,4]);
> 

Bad!

my $str = "This is a long sentence";
print substr($str, 10);

-- 
Petr Vileta, Czech Republic
(My server rejects all messages from Yahoo and Hotmail.
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>



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

Date: Mon, 27 Apr 2009 20:17:15 GMT
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Sub indentation trouble
Message-Id: <slrngvc4mb.q6h.nospam-abuse@chorin.math.berkeley.edu>

On 2009-04-27, Julien K. <bozo_le_clown@wherever.you.want.com> wrote:
>> All changes should be documented in cperl-mode.el.
>
>   So let me rephrase this point:
>
>   I didn't find the change(s) that led to the modification in 'sub's 
>   indentation within all the changes between cperl versions reported in the 
>   beginning of cperl.el.

There should be something liek "Major rework of indentation engine".
1/4 ;-)

Yours,
Ilya


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

Date: Mon, 27 Apr 2009 20:19:26 GMT
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <slrngvc4qe.q6h.nospam-abuse@chorin.math.berkeley.edu>

On 2009-04-27, Ben Morrow <ben@morrow.me.uk> wrote:
>> > (3) { } already having their own meaning as RE meta-characters.
>> > 
>> > Since (3) is part of the language and (2) is part of your data, altering
>> > (1) is probably your best bet.
>> 
>> (3) is irrelevant because it does the same thing with 
>> non-meta-characters as well:
>> 
>> $ perl -le'print qr{\A\{oops\}\z}'
>> (?-xism:\A{oops}\z)
>> $ perl -le'print qr<\A\<oops\>\z>'
>> (?-xism:\A<oops>\z)
>
> It's not, since /(?-xism:\A<oops>\z)/ matches "<oops>", whereas the
> equivalent with {} doesn't.

I think you are wrong (untested).

Ilya


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

Date: Mon, 27 Apr 2009 13:47:31 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <ERoJl.72210$Ji5.20287@newsfe21.iad>

Ben Morrow wrote:
> Quoth "John W. Krahn" <jwkrahn@shaw.ca>:
>> hymie! wrote:
>>> In our last episode, the evil Dr. Lacto had captured our hero,
>>>   Klaus <klaus03@gmail.com>, who said:
>>>
>>>
>>>> I am trying to match a literal string '{0,0}' using the syntax m{...}.
>>>> I know that I have to escape both the '{' and '}' characters.
>>> I've read through about half of this thread, and not that I'm expert,
>>> but the problem seems to be three-fold:
>>>
>>> (1) using { } as your RE delimiters
>>> (2) using { } as part of your RE
>>> (3) { } already having their own meaning as RE meta-characters.
>>>
>>> Since (3) is part of the language and (2) is part of your data, altering
>>> (1) is probably your best bet.
>> (3) is irrelevant because it does the same thing with 
>> non-meta-characters as well:
>>
>> $ perl -le'print qr{\A\{oops\}\z}'
>> (?-xism:\A{oops}\z)
>> $ perl -le'print qr<\A\<oops\>\z>'
>> (?-xism:\A<oops>\z)
> 
> It's not, since /(?-xism:\A<oops>\z)/ matches "<oops>", whereas the
> equivalent with {} doesn't.

$ perl -le'print "<oops>" =~ m<\A\<oops\>\z> ? "Match" : "Oops"'
Match
$ perl -le'print "{oops}" =~ m{\A\{oops\}\z} ? "Match" : "Oops"'
Match



John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov


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

Date: Mon, 27 Apr 2009 22:13:09 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <5ojhc6-aq9.ln1@osiris.mauzo.dyndns.org>


Quoth "John W. Krahn" <jwkrahn@shaw.ca>:
> Ben Morrow wrote:
> > Quoth "John W. Krahn" <jwkrahn@shaw.ca>:
> >> hymie! wrote:
> >>> In our last episode, the evil Dr. Lacto had captured our hero,
> >>>   Klaus <klaus03@gmail.com>, who said:
> >>>
> >>>
> >>>> I am trying to match a literal string '{0,0}' using the syntax m{...}.
> >>>> I know that I have to escape both the '{' and '}' characters.
> >>> I've read through about half of this thread, and not that I'm expert,
> >>> but the problem seems to be three-fold:
> >>>
> >>> (1) using { } as your RE delimiters
> >>> (2) using { } as part of your RE
> >>> (3) { } already having their own meaning as RE meta-characters.
> >>>
> >>> Since (3) is part of the language and (2) is part of your data, altering
> >>> (1) is probably your best bet.
> >> (3) is irrelevant because it does the same thing with 
> >> non-meta-characters as well:
> >>
> >> $ perl -le'print qr{\A\{oops\}\z}'
> >> (?-xism:\A{oops}\z)
> >> $ perl -le'print qr<\A\<oops\>\z>'
> >> (?-xism:\A<oops>\z)
> > 
> > It's not, since /(?-xism:\A<oops>\z)/ matches "<oops>", whereas the
> > equivalent with {} doesn't.
> 
> $ perl -le'print "<oops>" =~ m<\A\<oops\>\z> ? "Match" : "Oops"'
> Match
> $ perl -le'print "{oops}" =~ m{\A\{oops\}\z} ? "Match" : "Oops"'
> Match

OK, fair enough :). That's just perl being overly clever about its
metachars, though.

~% perl -E'say "a<1>" =~ m<\Aa\<1\>\z>; say "a{1}" =~ m{\Aa\{1\}\z}'            
1

~% perl -E'say "a<1>" =~ m<\Aa<1>\z>; say "a{1}" =~ m{\Aa{1}\z}'                
1

~%

So it's impossible to (reliably) match a literal "{" in a {}-delimited
regex.

Ben



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

Date: Tue, 28 Apr 2009 00:14:42 +0200
From: Frank Seitz <devnull4711@web.de>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <75mp2eF17ntduU1@mid.individual.net>

Ben Morrow wrote:
> 
> ~% perl -E'say "a<1>" =~ m<\Aa\<1\>\z>; say "a{1}" =~ m{\Aa\{1\}\z}'            
> 1
> 
> ~% perl -E'say "a<1>" =~ m<\Aa<1>\z>; say "a{1}" =~ m{\Aa{1}\z}'                
> 1
> 
> ~%
> 
> So it's impossible to (reliably) match a literal "{" in a {}-delimited
> regex.

I disagree, it is possible with quotemeta (\Q...\E):

$ perl -E'say "a<1>" =~ m<\Aa<1>\z>; say "a{1}" =~ m{\Aa\Q{\E1\Q}\E\z}'
1
1

Frank
-- 
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel


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

Date: Mon, 27 Apr 2009 19:16:50 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <87k5557km5.fsf@quad.sysarch.com>

>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:

  FS> Ben Morrow wrote:
  >> So it's impossible to (reliably) match a literal "{" in a {}-delimited
  >> regex.

  FS> I disagree, it is possible with quotemeta (\Q...\E):

  FS> $ perl -E'say "a<1>" =~ m<\Aa<1>\z>; say "a{1}" =~ m{\Aa\Q{\E1\Q}\E\z}'
  FS> 1
  FS> 1

you don't have to quote each of {} separately. one \Q\E works as 1 won't
get quoted.

perl -E'say "a{1}" =~ m{\Aa\Q{1}\E\z}'
1

also you can put the {1} in a variable and \Q it:

perl -E'$x ="{1}"; say "a{1}" =~ m{\Aa\Q$x\E\z}'
1

so there are ways around it. look at these:

perl -E'say qr{\Aa\Q{1}\E\z}'
(?-xism:\Aa\{1\}\z)

perl -E'say qr{\Aa\{1\}\z}'
(?-xism:\Aa{1}\z)

the latter doesn't have escaped braces since the string parser removed
them so the regex parser sees a quantifier. in the former the \Q is done
in the regex parser so you get a literal {1}.

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: Tue, 28 Apr 2009 08:02:53 +0200
From: Frank Seitz <devnull4711@web.de>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <75nkg8F17ntduU2@mid.individual.net>

Uri Guttman wrote:
>>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
> 
>   FS> Ben Morrow wrote:
>   >> So it's impossible to (reliably) match a literal "{" in a {}-delimited
>   >> regex.
> 
>   FS> I disagree, it is possible with quotemeta (\Q...\E):
> 
>   FS> $ perl -E'say "a<1>" =~ m<\Aa<1>\z>; say "a{1}" =~ m{\Aa\Q{\E1\Q}\E\z}'
>   FS> 1
>   FS> 1
> 
> you don't have to quote each of {} separately. one \Q\E works as 1 won't
> get quoted.
> 
> perl -E'say "a{1}" =~ m{\Aa\Q{1}\E\z}'
> 1
> 
> also you can put the {1} in a variable and \Q it:
> 
> perl -E'$x ="{1}"; say "a{1}" =~ m{\Aa\Q$x\E\z}'
> 1
> 
> so there are ways around it. look at these:
> 
> perl -E'say qr{\Aa\Q{1}\E\z}'
> (?-xism:\Aa\{1\}\z)
> 
> perl -E'say qr{\Aa\{1\}\z}'
> (?-xism:\Aa{1}\z)
> 
> the latter doesn't have escaped braces since the string parser removed
> them so the regex parser sees a quantifier. in the former the \Q is done
> in the regex parser so you get a literal {1}.

I know all that. I wanted to show how to put a literal "{" or "}"
in a {}-delimited regex. "\{" doesn't work but "\Q{\E" does.

Frank
-- 
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel


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

Date: Tue, 28 Apr 2009 02:59:43 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <87zle1z2jk.fsf@quad.sysarch.com>

>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:

  FS> Uri Guttman wrote:

  >> the latter doesn't have escaped braces since the string parser
  >> removed them so the regex parser sees a quantifier. in the former
  >> the \Q is done in the regex parser so you get a literal {1}.

  FS> I know all that. I wanted to show how to put a literal "{" or "}"
  FS> in a {}-delimited regex. "\{" doesn't work but "\Q{\E" does.

then consider my post an explanation to others why \Q\E works and \'s
don't. but you deserve credit for posting the correct solution.

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: Tue, 28 Apr 2009 05:55:15 +0200
From: Bo Lindbergh <blgl@hagernas.com>
Subject: What perlop doesn't tell you about indirect method calls
Message-Id: <gt5ung$kk8$1@aioe.org>

hacker->${\sub{Perl->${\sub{another->${\sub{Just->${\sub{print"@_,"}}(@_)}}(@_)}}(@_)}}

 ... and the hideous thing even runs under strict.


/Bo Lindbergh


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

Date: Tue, 28 Apr 2009 00:10:40 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: What perlop doesn't tell you about indirect method calls
Message-Id: <87eivd5sfz.fsf@quad.sysarch.com>

>>>>> "BL" == Bo Lindbergh <blgl@hagernas.com> writes:

  hacker-> ${\sub{Perl->${\sub{another->${\sub{Just->${\sub{print"@_,"}}(@_)}}(@_)}}(@_)}}

those are direct method calls.

  BL> ... and the hideous thing even runs under strict.

why shouldn't it? all those token are parsed as bareword class names
which is fine under strict.

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: Tue, 28 Apr 2009 06:24:58 +0200
From: Bo Lindbergh <blgl@hagernas.com>
Subject: Re: What perlop doesn't tell you about indirect method calls
Message-Id: <gt60f6$lqm$1@aioe.org>

In article <87eivd5sfz.fsf@quad.sysarch.com>, Uri Guttman <uri@stemsystems.com> 
wrote:

> >>>>> "BL" == Bo Lindbergh <blgl@hagernas.com> writes:
> 
>   hacker-> ${\sub{Perl->${\sub{another->${\sub{Just->${\sub{print"@_,"}}(@_)}}(@_)}}(@_)}}
> 
> those are direct method calls.

Then what adjective should be used to distinguish between

    $object -> method (@args)

and

    $object -> $methodname (@args)

?


/Bo Lindbergh


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

Date: Tue, 28 Apr 2009 00:37:51 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: What perlop doesn't tell you about indirect method calls
Message-Id: <878wll5r6o.fsf@quad.sysarch.com>

>>>>> "BL" == Bo Lindbergh <blgl@hagernas.com> writes:

  BL> In article <87eivd5sfz.fsf@quad.sysarch.com>, Uri Guttman <uri@stemsystems.com> 
  BL> wrote:

  >> >>>>> "BL" == Bo Lindbergh <blgl@hagernas.com> writes:
  >> 
  hacker-> ${\sub{Perl->${\sub{another->${\sub{Just->${\sub{print"@_,"}}(@_)}}(@_)}}(@_)}}
  >> 
  >> those are direct method calls.

  BL> Then what adjective should be used to distinguish between

  BL>     $object -> method (@args)

  BL> and

  BL>     $object -> $methodname (@args)

dynamic method calls? delayed binding is another term used as the method
name is not known until the call is made. they are both direct since the
object (or classname) is unambiguous and uses -> to bind the method name
to the object/class. indirect calls are like:

	new Classname @args
	method $obj 'blah'

those are potentially buggy since a sub new() or method() could have
been declared earlier in the file and those would be called instead of a
method. this is documented in (i think) perlobj. that doc states that
you should never use indirect method calls. your code with a dynamic
method name is fine and i have used it in several places. 

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: 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 2371
***************************************


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