[31125] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2370 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 27 16:09:43 2009

Date: Mon, 27 Apr 2009 13:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 27 Apr 2009     Volume: 11 Number: 2370

Today's topics:
    Re: access variables from array and set it back <slick.users@gmail.com>
    Re: access variables from array and set it back <noreply@gunnar.cc>
    Re: access variables from array and set it back <jurgenex@hotmail.com>
    Re: access variables from array and set it back <slick.users@gmail.com>
    Re: access variables from array and set it back <noreply@gunnar.cc>
        new CPAN modules on Mon Apr 27 2009 (Randal Schwartz)
    Re: Perl 5.10.0 message: Undefined subroutine &main::  sln@netherlands.com
    Re: Perl is too slow - A statement <n@solenttechnology.co.uk>
    Re: Perl is too slow - A statement <uri@stemsystems.com>
    Re: Problem in parsing from a pipe <january.weiner@gmail.com>
    Re: Sub indentation trouble <bozo_le_clown@wherever.you.want.com>
    Re: Tk::Listbox <ch.l.ngre-nospam@online.de>
    Re: unexplained warning message in m{...} regexp (hymie!)
    Re: unexplained warning message in m{...} regexp <someone@example.com>
    Re: unexplained warning message in m{...} regexp <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 26 Apr 2009 21:42:41 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: access variables from array and set it back
Message-Id: <a86c4ced-5fa6-4bed-84a1-f1d6585f0523@a5g2000pre.googlegroups.com>

my $path1 =3D 'c:\abc';
my $filea =3D 'Y:\a.txt';
my $namex =3D 'Dr. X';

My goal is get from the top the end.

$path1 =3D 'c:\newpath';
$filea =3D 'Y:\newfilea.txt';
$namex =3D 'Dr. Y';


The top will assign by manually by the user, but the bottom one will
somehow automate re-assign the value. I don't want to do one by one.
That's why I'm thinking of putting in a hash and loop and modify the
value. This is where I'm stuck.

Mostly I just do a replace and search but I don't know which variable
to set it back to.

How would I achieve this in a loop?
$HASHX{'path1'} =3D $path1;
$HASHX{'filea '} =3D $filea;



On Apr 24, 6:20=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> [Re-ordered into standard reading order]
>
>
>
> Slickuser <slick.us...@gmail.com> wrote:
> >On Apr 24, 4:29=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> >> Slickuser <slick.us...@gmail.com> wrote:
> >> >I have these variables:
> >> >my $path1 =3D 'c:\abc';
> >> >my $filea =3D 'Y:\a.txt';
> >> >my $namex =3D 'Dr. X';
>
> >> >I want to push this into a hash array or array of variables & values.
>
> >> May I suggest that you get your terminology straightened out first? It
> >> makes communication so much easier if everyone uses the same terms for
> >> the same things.
> [...]
> >> Or are you looking for references, i.e. you want to store a reference =
to
> >> each of your variables in such a hash or an array and then work with
> >> those references?
> >I want to reference the variables and change the value to that
> >reference variable.
>
> Then please see "perldoc perlreftut" and "perldoc perlref".
>
> jue



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

Date: Mon, 27 Apr 2009 07:16:13 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: access variables from array and set it back
Message-Id: <75ktdeFtskgvU1@mid.individual.net>

perl -le '
$path1 = "c:\\abc";
$filea = "Y:\\a.txt";
$namex = "Dr. X";
@refs = \($path1, $filea, $namex);
@values = ("c:\\newpath", "Y:\\newfilea.txt", "Dr. Y");
${ $refs[$_] } = $values[$_] for 0..2;
print for $path1, $filea, $namex;
'
c:\newpath
Y:\newfilea.txt
Dr. Y

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


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

Date: Sun, 26 Apr 2009 22:30:29 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: access variables from array and set it back
Message-Id: <3egav4d2c276l1klifmd4u7at95sfakiff@4ax.com>

[Re-ordered AGAIN into standard reading order]
[Please do not top post]
Slickuser <slick.users@gmail.com> wrote:
>On Apr 24, 6:20 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>> [Re-ordered into standard reading order]
>> Slickuser <slick.us...@gmail.com> wrote:
>> >On Apr 24, 4:29 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>> >> Slickuser <slick.us...@gmail.com> wrote:
>> >> >I have these variables:
>> >> >my $path1 = 'c:\abc';
>> >> >my $filea = 'Y:\a.txt';
>> >> >my $namex = 'Dr. X';
>>
>> >> >I want to push this into a hash array or array of variables & values.
>>
>> >> May I suggest that you get your terminology straightened out first? It
>> >> makes communication so much easier if everyone uses the same terms for
>> >> the same things.
>> [...]
>> >> Or are you looking for references, i.e. you want to store a reference to
>> >> each of your variables in such a hash or an array and then work with
>> >> those references?
>> >I want to reference the variables and change the value to that
>> >reference variable.
>>
>> Then please see "perldoc perlreftut" and "perldoc perlref".
>>
>> jue
>my $path1 = 'c:\abc';
>my $filea = 'Y:\a.txt';
>my $namex = 'Dr. X';
>
>My goal is get from the top the end.
>
>$path1 = 'c:\newpath';
>$filea = 'Y:\newfilea.txt';
>$namex = 'Dr. Y';
>
>
>The top will assign by manually by the user, but the bottom one will
>somehow automate re-assign the value. I don't want to do one by one.
>That's why I'm thinking of putting in a hash and loop and modify the
>value. This is where I'm stuck.

Sorry, my EPS::PSI capabilities are very limited and I am very poor at
guessing what other people might have meant. 
Someone else will have to decode the paragraph above and translate it
into plain English. I have no idea what you mean by that.

>Mostly I just do a replace and search but I don't know which variable
>to set it back to.
>
>How would I achieve this in a loop?
>$HASHX{'path1'} = $path1;
>$HASHX{'filea '} = $filea;

I don't get it. Are you looking for references are you looking for loops
or what? One day you are saying X and the next day you are saying Y. I
am lost and am giving up now.

jue


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

Date: Sun, 26 Apr 2009 23:51:14 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: access variables from array and set it back
Message-Id: <f6516398-de15-4e7d-8032-c823dbaa6a83@r31g2000prh.googlegroups.com>

This is what I want.

Can do I this in a loop?

$path1 =3D "c:\\abc";
$filea =3D "Y:\\a.txt";
$namex =3D "Dr. X";
@refs =3D \($path1, $filea, $namex);

I don't want to the set the values right away. Just loop through refs
then doing search & replace.
And set this value to the variable.

I'll look at this example and modify it. thank you.

On Apr 26, 10:16=A0pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> perl -le '
> $path1 =3D "c:\\abc";
> $filea =3D "Y:\\a.txt";
> $namex =3D "Dr. X";
> @refs =3D \($path1, $filea, $namex);
> @values =3D ("c:\\newpath", "Y:\\newfilea.txt", "Dr. Y");
> ${ $refs[$_] } =3D $values[$_] for 0..2;
> print for $path1, $filea, $namex;
> '
> c:\newpath
> Y:\newfilea.txt
> Dr. Y
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Mon, 27 Apr 2009 10:18:39 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: access variables from array and set it back
Message-Id: <75l83hF15ftknU1@mid.individual.net>

Slickuser wrote:
> Gunnar Hjalmarsson wrote:
>> perl -le '
>> $path1 = "c:\\abc";
>> $filea = "Y:\\a.txt";
>> $namex = "Dr. X";
>> @refs = \($path1, $filea, $namex);
>> @values = ("c:\\newpath", "Y:\\newfilea.txt", "Dr. Y");
>> ${ $refs[$_] } = $values[$_] for 0..2;
>> print for $path1, $filea, $namex;
>> '
>> c:\newpath
>> Y:\newfilea.txt
>> Dr. Y
>
> This is what I want.
> 
> Can do I this in a loop?
> 
> $path1 = "c:\\abc";
> $filea = "Y:\\a.txt";
> $namex = "Dr. X";
> @refs = \($path1, $filea, $namex);
> 
> I don't want to the set the values right away. Just loop through refs
> then doing search & replace.

You have three scalar variables, so search and replace does not make 
sense IMO. Either you reassign the variables directly, or you reassign 
them indirectly via references.

Or did I miss something?

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


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

Date: Mon, 27 Apr 2009 04:42:27 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Apr 27 2009
Message-Id: <KIqt2r.1ury@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-CPANAuthors-Portuguese-0.03
http://search.cpan.org/~braceta/Acme-CPANAuthors-Portuguese-0.03/
We are the Portuguese CPAN Authors 
----
Acme-CPANAuthors-Taiwanese-0.04
http://search.cpan.org/~gugod/Acme-CPANAuthors-Taiwanese-0.04/
We are Taiwanese CPAN Authors! 
----
Acme-Perl-VM-0.0.3
http://search.cpan.org/~gfuji/Acme-Perl-VM-0.0.3/
An implementation of Perl5 Virtual Machine in Pure Perl (APVM) 
----
Apache2-WURFLFilter-1.60
http://search.cpan.org/~ifuschini/Apache2-WURFLFilter-1.60/
is a Apache Mobile Filter that manage content (text & image) to the correct mobile device 
----
App-DPath-0.02
http://search.cpan.org/~schwigon/App-DPath-0.02/
Cmdline tool around Data::DPath 
----
App-PM-Announce-0.024
http://search.cpan.org/~rkrimen/App-PM-Announce-0.024/
Announce your PM meeting via Meetup and LinkedIn 
----
Archive-RPM-0.04
http://search.cpan.org/~rsrchboy/Archive-RPM-0.04/
work with an RPM 
----
Brackup-1.08
http://search.cpan.org/~bradfitz/Brackup-1.08/
Flexible backup tool. Slices, dices, encrypts, and sprays across the net. 
----
CGI-DataObjectMapper-0.0105
http://search.cpan.org/~kimoto/CGI-DataObjectMapper-0.0105/
Data-Object Mapper for CGI form data 
----
CHI-0.2
http://search.cpan.org/~jswartz/CHI-0.2/
Unified cache interface 
----
CPANPLUS-YACSmoke-0.34
http://search.cpan.org/~bingos/CPANPLUS-YACSmoke-0.34/
Yet Another CPANPLUS Smoke Tester 
----
Catalyst-Controller-WrapCGI-0.0029
http://search.cpan.org/~rkitover/Catalyst-Controller-WrapCGI-0.0029/
Run CGIs in Catalyst 
----
Catalyst-Devel-1.12
http://search.cpan.org/~flora/Catalyst-Devel-1.12/
Catalyst Development Tools 
----
CatalystX-Imports-0.05
http://search.cpan.org/~flora/CatalystX-Imports-0.05/
Shortcut functions for Catalyst controllers 
----
Deliantra-Client-2.04
http://search.cpan.org/~mlehmann/Deliantra-Client-2.04/
----
Fedora-App-ReviewTool-0.07
http://search.cpan.org/~rsrchboy/Fedora-App-ReviewTool-0.07/
Application class for ReviewTool 
----
Fedora-Bugzilla-0.09
http://search.cpan.org/~rsrchboy/Fedora-Bugzilla-0.09/
Interact with Fedora's bugzilla instance 
----
Fedora-Bugzilla-0.10
http://search.cpan.org/~rsrchboy/Fedora-Bugzilla-0.10/
Interact with Fedora's bugzilla instance 
----
Finance-QuoteDB-0.06
http://search.cpan.org/~ecocode/Finance-QuoteDB-0.06/
User database tools based on Finance::Quote 
----
Git-SVNReplay-1.0200
http://search.cpan.org/~jettero/Git-SVNReplay-1.0200/
replay git commits into a throwaway svn repo 
----
Gtk2-CV-1.54
http://search.cpan.org/~mlehmann/Gtk2-CV-1.54/
----
HTTP-Request-AsCGI-0.502
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.502/
----
HTTP-Request-AsCGI-0.503
http://search.cpan.org/~hdp/HTTP-Request-AsCGI-0.503/
Setup a CGI enviroment from a HTTP::Request 
----
IO-Async-0.20
http://search.cpan.org/~pevans/IO-Async-0.20/
a collection of modules that implement asynchronous filehandle IO 
----
IO-Async-Loop-Epoll-0.04
http://search.cpan.org/~pevans/IO-Async-Loop-Epoll-0.04/
a Loop using an IO::Epoll object 
----
IO-Async-Loop-Glib-0.14
http://search.cpan.org/~pevans/IO-Async-Loop-Glib-0.14/
a Loop using the Glib::MainLoop object 
----
IO-Async-Loop-IO_Ppoll-0.03
http://search.cpan.org/~pevans/IO-Async-Loop-IO_Ppoll-0.03/
a Loop using an IO::Ppoll object 
----
Lingua-PT-Conjugate-1.17
http://search.cpan.org/~egross/Lingua-PT-Conjugate-1.17/
----
Math-Random-ISAAC-1.0.4
http://search.cpan.org/~frequency/Math-Random-ISAAC-1.0.4/
Perl interface to the ISAAC PRNG Algorithm 
----
Module-Install-AssertOS-0.10
http://search.cpan.org/~bingos/Module-Install-AssertOS-0.10/
A Module::Install extension to require that we are running on a particular OS 
----
MooseX-Role-XMLRPC-Client-0.02
http://search.cpan.org/~rsrchboy/MooseX-Role-XMLRPC-Client-0.02/
provide the needed bits to be a XML-RPC client 
----
MySQL-Sandbox-2.0.99b
http://search.cpan.org/~gmax/MySQL-Sandbox-2.0.99b/
Quickly installs MySQL side server, either standalone or in groups 
----
Net-Address-Ethernet-1.114
http://search.cpan.org/~mthurn/Net-Address-Ethernet-1.114/
find hardware ethernet address 
----
Net-PubSubHubbub-Publisher-0.90
http://search.cpan.org/~bradfitz/Net-PubSubHubbub-Publisher-0.90/
client library to ping a PubSubHubbub hub 
----
Net-PubSubHubbub-Publisher-0.91
http://search.cpan.org/~bradfitz/Net-PubSubHubbub-Publisher-0.91/
client library to ping a PubSubHubbub hub 
----
News-Pictures-0.14
http://search.cpan.org/~cguine/News-Pictures-0.14/
The great new News::Pictures! 
----
Oxford-Calendar-2.03
http://search.cpan.org/~dom/Oxford-Calendar-2.03/
University of Oxford calendar conversion routines 
----
Queue-Q4Pg-Lite-0.01
http://search.cpan.org/~fujiwara/Queue-Q4Pg-Lite-0.01/
Simple message queue using PostgreSQL 
----
SSH-Batch-0.017
http://search.cpan.org/~agent/SSH-Batch-0.017/
Cluster operations based on parallel SSH, set and interval arithmetic 
----
SVN-Hooks-0.17.54
http://search.cpan.org/~gnustavo/SVN-Hooks-0.17.54/
A framework for implementing Subversion hooks. 
----
Sledge-Template-ClearSilver-I18N-0.01
http://search.cpan.org/~matsumoto/Sledge-Template-ClearSilver-I18N-0.01/
Internationalization extension to Sledge::Template::ClearSilver. 
----
Syntax-Highlight-Perl6-0.46
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.46/
Perl 6 Syntax Highlighter 
----
TM-Corpus-0.08
http://search.cpan.org/~drrho/TM-Corpus-0.08/
Topic Maps, Document Corpus 
----
TM-Corpus-0.09
http://search.cpan.org/~drrho/TM-Corpus-0.09/
Topic Maps, Document Corpus 
----
Term-GentooFunctions-1.3500
http://search.cpan.org/~jettero/Term-GentooFunctions-1.3500/
provides gentoo's einfo, ewarn, eerror, ebegin and eend. 
----
Test-DistManifest-1.1.4
http://search.cpan.org/~frequency/Test-DistManifest-1.1.4/
Tests that your MANIFEST matches the distribution as it exists, excluding those in your MANIFEST.SKIP 
----
Test-Ping-0.06
http://search.cpan.org/~xsawyerx/Test-Ping-0.06/
Testing pings using Net::Ping 
----
Test-Ping-0.07
http://search.cpan.org/~xsawyerx/Test-Ping-0.07/
Testing pings using Net::Ping 
----
Text-Template-Simple-0.70
http://search.cpan.org/~burak/Text-Template-Simple-0.70/
Simple text template engine 
----
TheSchwartz-Worker-PubSubHubbubPublish-1.00
http://search.cpan.org/~bradfitz/TheSchwartz-Worker-PubSubHubbubPublish-1.00/
ping pubsubhubbub hub servers 
----
WebService-MusicBrainz-0.22
http://search.cpan.org/~bfaist/WebService-MusicBrainz-0.22/
----
Win32-Env-Path-0.03
http://search.cpan.org/~adamk/Win32-Env-Path-0.03/
Manipulate environment PATH strings 
----
Xtract-0.05
http://search.cpan.org/~adamk/Xtract-0.05/
Take any data source and deliver it to the world 
----
autobox-dump-20090425.1630
http://search.cpan.org/~cowens/autobox-dump-20090425.1630/
human/perl readable strings from the results of an EXPR 


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: Sun, 26 Apr 2009 18:31:37 -0700
From: sln@netherlands.com
Subject: Re: Perl 5.10.0 message: Undefined subroutine &main:: called at (re_eval 2) line 1.
Message-Id: <1h2av4pson24nb95l4s25f284mfs8cl9dj@4ax.com>

On Sat, 25 Apr 2009 20:35:46 -0400, Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> wrote:

>I get the error message "Undefined subroutine &main:: called at (re_eval
>2) line 1." running the attached Perl program. The program does not
>contain the character '0E'x and the message does not occur if I remove the
>last line:
>
>my $match = "1 12 123 254 255 256" =~ /$OctetPat/;
>
>Note: the extproc is the OS/2 equivalent of a shebang in Unix.

my $OctetRange = qr/(?{&^N > 255})/;
                       ^
There is another variable called $^N

-sln

ps - But i have 5.8 and here's what I get:


Quantifier follows nothing in regex; marked by <-- HERE in m/ \d{1,3}
                   (
                     ( (?-xism:(?{&^N > 255})) )
                     (* <-- HERE FAIL)
                   )
                 / at aa.pl line 5.




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

Date: Mon, 27 Apr 2009 03:25:34 -0700 (PDT)
From: neilsolent <n@solenttechnology.co.uk>
Subject: Re: Perl is too slow - A statement
Message-Id: <b6ad1712-da38-45c0-a5ab-cb6f0d136df1@u39g2000pru.googlegroups.com>

On 26 Apr, 22:33, Tad J McClellan <ta...@seesig.invalid> wrote:
> s...@netherlands.com <s...@netherlands.com> wrote:
> > On Sun, 26 Apr 2009 01:21:30 -0700 (PDT), neilsolent <n...@solenttechno=
logy.co.uk> wrote:
>
> >>> We hear this all too common:
> >>> =A0 =A0 =A0 =A0 =A0 =A0 "I have one huge problem with Perl; it is too=
 slow."
>
> >>> But is Perl realy slow, could perl be slow at all?
>
> >>In my experience Perl is fast, in fact breath-takingly fast for an
> >>interpreted language, and given the huge high-level functionality it
> >>provides.
> >>I don't have any benchmarks to back this up, but I think it is a known
> >>fact that it compares reasonably to even optimised C code, performing
> >>similar tasks. Obviously it really depends what tasks we are talking
> >>about.
> >>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 =3D "This is a long sentence";
> > printf ("%s", &str[10]);
>
> > ----------------
>
> > my $str =3D "This is a long sentence";
>
> =A0 =A0 print substr($str, 10);
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"- Hid=
e quoted text -
>
> - Show quoted text -

Running these "equivalent" bits of Perl an C in a tight loop (1000000
iterations) - shows on my machine:

approx 0.3s run time for the C
approx 0.9s run time for Perl

I think this is pretty good considering Perl is interpreted and (I
suspect) the example is deliberately picked to find something C is
faster at!




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

Date: Mon, 27 Apr 2009 11:58:56 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl is too slow - A statement
Message-Id: <8763gq9jgf.fsf@quad.sysarch.com>

>>>>> "n" == neilsolent  <n@solenttechnology.co.uk> writes:

  >> > char *str = "This is a long sentence";
  >> > printf ("%s", &str[10]);
  >> > ----------------
  >> > my $str = "This is a long sentence";
  >>     print substr($str, 10);

  n> Running these "equivalent" bits of Perl an C in a tight loop (1000000
  n> iterations) - shows on my machine:

  n> approx 0.3s run time for the C
  n> approx 0.9s run time for Perl

  n> I think this is pretty good considering Perl is interpreted and (I
  n> suspect) the example is deliberately picked to find something C is
  n> faster at!

it also shows you have no clue about what is important these
days. development time is way more expensive than running time. you can
always get a faster computer but you rarely can speed up a development
schedule.

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: Mon, 27 Apr 2009 21:44:24 +0200 (CEST)
From: January Weiner <january.weiner@gmail.com>
Subject: Re: Problem in parsing from a pipe
Message-Id: <gt51un$tue$1@sagnix.uni-muenster.de>

On 2009-04-24, Eric Pozharski <whynot@pozharski.name> wrote:
> On 2009-04-22, January Weiner <january.weiner@gmail.com> wrote:
>> On 2009-04-21, Eric Pozharski <whynot@pozharski.name> wrote:
>>> Think 3-args B<open>, it's safer.
>>
>> Why?
>
> 	perl -wle '$cmd = q|rm -rf /; true|; open $fh, "$cmd|" or die $!'
> 	Name "main::fh" used only once: possible typo at -e line 1.
> 	rm: cannot remove root directory `/'

Maybe I'm not too bright, but I don't get it :( Would you mind being a
little more verbose? I mean, you can do the same with 3 arg open:

  perl -wle '$cmd = q|rm -rf /; true|; open( $fh, "-|", "$cmd" ) or die $!'

Where is the difference?  I understand that using open( $fh, $file )
instead of open( $fh, "<$file" ) can in some cases lead to problems (if
$file becomes ">something"), but in this particular case we are reading
from a pipe anyways, and if the $cmd has been manipulated (and we were
careless and haven't checked it) than the tree args version will not be of
any help.

And anyway, I have always thought that preventing malicious input from the
users should be happening on an altogether different level, starting with
at least using taint mode -- am I wrong?

> Define "quite large".  As of second, I think, it's possible to go
> through pattern one match per time (but not at 3AM).

$ du -hs human_est.out
1.2G  human_est.out
$ du -hs nr
3.5G  nr

> And a piece of advice.  If you're going to stay here, anytime think of
> C<use File::Slurp;>, and find a good reason against.  Because sooner or
> later, you'll be adviced of it anyway.

Maybe, but this is not going to happen. I want to stop reading a huge file
after I have collected all the information that I need from it - why should
I slurp 3.5 gb if I have what I need after reading 10k?

j.



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

Date: Mon, 27 Apr 2009 09:18:43 +0200
From: "Julien K." <bozo_le_clown@wherever.you.want.com>
Subject: Re: Sub indentation trouble
Message-Id: <slrngvan2j.4e8.bozo_le_clown@thabor.lan.ah2d.fr>

On 25-04-2009, Ilya Zakharevich wrote:
> On 2009-04-24, Julien K. <bozo_le_clown@wherever.you.want.com> wrote:
>>   I also tried to track what changed before cperl-5.1 because my settings 
>> did not changed during the past few years (if it's not broken...)
>
> 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.

  Cheers,

  Julien


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

Date: Mon, 27 Apr 2009 20:37:26 +0200
From: Lamprecht <ch.l.ngre-nospam@online.de>
Subject: Re: Tk::Listbox
Message-Id: <gt4u16$jla$1@online.de>

greymausg@mail.com wrote:
> I seem  to be having areal problem with Tk::Listbox, wrote the script
> 
> http://sial.org/pbot/36228. 
> 
> Which fails with error:
> 
> no event type or button # or keysym at
> /usr/lib/perl5/site_perl/5.10.0/i486-linux-thread-multi/Tk/Widget.pm

This seems to be fixed in
http://search.cpan.org/~srezic/Tk-804.028_501/
See also:
http://rt.cpan.org/Public/Bug/Display.html?id=38746

Regards, Christoph


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

Date: Mon, 27 Apr 2009 14:06:55 GMT
From: hymie@lactose.homelinux.net (hymie!)
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <3_iJl.90964$0%2.40581@newsfe22.iad>

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.

In short, don't do that.  Pick a more reasonable RE delimiter.

--hymie!    http://lactose.homelinux.net/~hymie    hymie@lactose.homelinux.net
------------------------ Without caffeine for 909 days ------------------------


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

Date: Mon, 27 Apr 2009 10:55:42 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <ykmJl.72356$_R4.5109@newsfe11.iad>

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)



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 19:41:52 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: unexplained warning message in m{...} regexp
Message-Id: <gsahc6-oq8.ln1@osiris.mauzo.dyndns.org>


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.

Ben



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

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


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