[31547] in Perl-Users-Digest
Perl-Users Digest, Issue: 2806 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 6 06:09:26 2010
Date: Sat, 6 Feb 2010 03:09:10 -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, 6 Feb 2010 Volume: 11 Number: 2806
Today's topics:
A zero-width positive lookbehind assertion <iamhello99@gmail.com>
Re: A zero-width positive lookbehind assertion <tadmc@seesig.invalid>
Re: A zero-width positive lookbehind assertion <xhoster@gmail.com>
Re: capturing multiple patterns per line <cartercc@gmail.com>
Re: function within qq{} <tzz@lifelogs.com>
OT: GNUS (was: Python's Reference And Internal Model Of <john@castleamber.com>
Perl, ip6 and XML RPC <frederic.perrin@resel.fr>
Re: Python's Reference And Internal Model Of Computing <dthole@gmail.com>
Re: Python's Reference And Internal Model Of Computing <dthole@gmail.com>
Re: Python's Reference And Internal Model Of Computing <steve@REMOVE-THIS-cybersource.com.au>
Re: Python's Reference And Internal Model Of Computing (Pascal J. Bourguignon)
Re: Python's Reference And Internal Model Of Computing <john@castleamber.com>
Re: Python's Reference And Internal Model Of Computing <dthole@gmail.com>
Re: Python's Reference And Internal Model Of Computing <hjp-usenet2@hjp.at>
Re: Running NMap Scan from Perl <m@rtij.nl.invlalid>
Re: SpeedyCGI, clearing certain variables <hjp-usenet2@hjp.at>
very important web site to post you know your political <robin1@cnsp.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 5 Feb 2010 18:56:57 -0800 (PST)
From: George <iamhello99@gmail.com>
Subject: A zero-width positive lookbehind assertion
Message-Id: <ef85c238-dea0-4256-9a99-333dbba0d3ae@o23g2000vbl.googlegroups.com>
Hi
I am trying to get directory name from say a path
c:/app/organizer
what I want to get is organizer , so basically if I search from end
of string and then lookbehind
($name)=($path=~(/(?<=\/)(.*?)(.*?)\z/));
but it does not result in getting to oraginzer , it fetches app/
organizer , kind of greedy
I know I can do it using FILE::BASENAME , but want to understand how
to do it using regexp and look back
thaks
/g
------------------------------
Date: Fri, 05 Feb 2010 22:08:24 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: A zero-width positive lookbehind assertion
Message-Id: <slrnhmpqj2.tdp.tadmc@tadbox.sbcglobal.net>
George <iamhello99@gmail.com> wrote:
> I am trying to get directory name from say a path
> c:/app/organizer
> what I want to get is organizer ,
(my $name = $path) =~ s!.*/!!;
or
my($name) = $path =~ m!([^/]+)$!;
> so basically if I search from end
> of string and then lookbehind
> ($name)=($path=~(/(?<=\/)(.*?)(.*?)\z/));
>
> but it does not result in getting to oraginzer , it fetches app/
> organizer ,
No it doesn't.
> I know I can do it using FILE::BASENAME , but want to understand how
> to do it using regexp and look back
I don't see that lookbehind is necessary.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
------------------------------
Date: Fri, 05 Feb 2010 20:58:21 -0800
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: A zero-width positive lookbehind assertion
Message-Id: <4b6cf783$0$21320$ed362ca5@nr5-q3a.newsreader.com>
George wrote:
> Hi
> I am trying to get directory name from say a path
> c:/app/organizer
> what I want to get is organizer , so basically if I search from end
> of string and then lookbehind
> ($name)=($path=~(/(?<=\/)(.*?)(.*?)\z/));
How would the zero-width look behind change anything? If the slash
itself isn't captured in $1 or $2, who cares if it is in $& ?
>
> but it does not result in getting to oraginzer , it fetches app/
> organizer , kind of greedy
In my hands, $name ends up as the empty string. What you indicate ends
up in $2, not in $1 or $name.
> I know I can do it using FILE::BASENAME , but want to understand how
> to do it using regexp and look back
> thaks
> /g
/([^\/]*)\z/
No look behind needed.
Xho
------------------------------
Date: Fri, 5 Feb 2010 11:22:17 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: capturing multiple patterns per line
Message-Id: <9d5c4bc0-0e97-4bde-a40f-c6b12b7872dd@3g2000yqn.googlegroups.com>
On Feb 5, 1:50=A0pm, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
wrote:
> Thats because your DATA lines have been reformatted and split onto
> several lines!
Yeah, I saw that before I posted, which is why I use '\n' to mark the
ends of the 'real' lines.
> Not every job should be done with an RE
No, but in accord with TIMTOWTDI, I wanted to see how it could be done
with an RE.
> while (<DATA>)
> {
> =A0 =A0 push @urls, /<a href=3D"([^"]+)/g;}
>
> print join(',',@urls), "\n";
I'm having fun playing with the suggestions offered, and am actually
learning in the process. ;-)
Thanks, CC.
------------------------------
Date: Fri, 05 Feb 2010 14:22:33 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: function within qq{}
Message-Id: <87aavne8l2.fsf@lifelogs.com>
On Thu, 04 Feb 2010 07:51:45 -0800 sln@netherlands.com wrote:
s> On Thu, 04 Feb 2010 09:33:24 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:
>> On Wed, 03 Feb 2010 12:48:01 -0800 sln@netherlands.com wrote:
>>
s> On Wed, 03 Feb 2010 12:00:47 -0800, sln@netherlands.com wrote:
>>>> This is just for example purposes. Should you need a full
>>>> blown formatter, there are probably dozens of safe ones on
>>>> Cpan.
>>>>
>>>> my $evstr = "\$retval = sprintf ($msg, ". "@{[map {qq(\"$_\",)} @data]}" .");";
>>
s> Shorter:
s> my $evstr = "\$retval = sprintf ($msg, @{[map {qq(\"$_\",)} @data]} );";
s> or
s> my $evstr = "\$retval = sprintf ($msg, @{[map {qq('$_',)} @data]} );";
>>
s> if you don't want to interpolate @data's elements during eval.
>>
>> That's like putting a band-aid on someone who's being electrocuted.
>> Yeah, it might help with the skin burns, but...
s> You lost me. Something wrong with this?
s> Whats a better way?
I'm saying you improved it a little but the whole thing is a
Frankenstein monster. I wasn't criticizing your change per se.
Ted
------------------------------
Date: Fri, 05 Feb 2010 20:18:42 -0600
From: John Bokma <john@castleamber.com>
Subject: OT: GNUS (was: Python's Reference And Internal Model Of Computing Languages)
Message-Id: <87iqab85tp.fsf_-_@castleamber.com>
David Thole <dthole@gmail.com> writes:
> Thanks,
>
> Another person who read also contacted me directly by email to help me
> with the kill file. I think I got it working and all, so I'll know
> within a few days if it worked or not :)
>
> Thanks though.
In order to have a real signature:
create a .signature file in your home directory and copy this in it
(without the 8<---8<---8<---8<---8<---)
8<---8<---8<---8<---8<---
David
http://www.thedarktrumpet.com/
8<---8<---8<---8<---8<---
And modify (setq gnus-posting-styles ...) in your .gnus.el to:
(setq gnus-posting-styles
'((".*"
(signature-file "~/.signature")
(x-url "http://www.thedarktrumpet.com/")
(organization "The Dark Trumpet"))))
(A real signature has a special marker consisting of -- followed by
exactly one space)
--
John Bokma j3b
Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
------------------------------
Date: Fri, 5 Feb 2010 23:45:58 +0100
From: =?UTF-8?B?RnLDqWTDqXJpYw==?= Perrin <frederic.perrin@resel.fr>
Subject: Perl, ip6 and XML RPC
Message-Id: <20100205234558.53fc1f0b@girafe.home>
Hello list,
I want to talk to an XML RPC service over ip6 (the server doesn't
listen over ip4). However, with the three modules I tried so far
(XML::RPC, RPC::XML, Frontier::RPC::Client), it tries to do the request
over ip4, even though the hostname I gave only resolve to ip6. I know
for a fact that it should work, as the same script in Python works.
Actually, all of this is happening in fBSD jails ; if I "tcpdump -v -i
lo0 port 6800", I see the request going to some other ip4 (the
ip4 address of the jail in which the Perl script is running), so of
course the connection fails. ; this last bit of information may be of a
low entropy, since it really shouldn't matter.
So, how can I use Perl to make XML RPC calls to an ip6 server?
For instance :
% host perso.priv.fperrin.net
perso.priv.fperrin.net has IPv6 address fd93:c8e5:9cb3::3
% cat ariactl.pl
use strict;
use warnings;
use Frontier::Client;
my $ariactl = Frontier::Client->new(url =>
"http://user:PaSSw0rd\@perso.priv.fperrin.net:6800/rpc");
my $v = $ariactl->call("getVersion");
print $v;
% perl ariactl.pl
500 Can't connect to perso.priv.fperrin.net:6800 (connect: Connection
refused)
zsh: exit 61 perl ariactl.pl
% cat ariactl.cmdline.py
from xmlrpclib import ServerProxy
aria2 = ServerProxy("http://user:PaSSw0rd@perso.priv.fperrin.net:6800/rpc").aria2
v = aria2.getVersion()
print v
% python ariactl.cmdline.py
{'version': '1.8.1', 'enabledFeatures': ['BitTorrent', 'GZip', 'HTTPS',
'Message Digest', 'Metalink', 'XML-RPC']}
--
Fred
------------------------------
Date: Fri, 05 Feb 2010 14:39:12 -0600
From: David Thole <dthole@gmail.com>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <m2hbpvl8nj.fsf@dhcpw80ff9506.dynamic.uiowa.edu>
Yeah, I'm relatively new to Usenet so far...maybe 2 weeks old, so I have
only begun to realize that he's actually a troll. How to killify him is
something I'm not sure of yet...but seeing some spam get through, plus
stuff like this makes me want to check up on how to do it. I also need
to figure out how to make my client include previous posts, quoted at
least somewhat. heh, using gnus...so I'm sure it's possible to get this
configured right.
-David
http://www.thedarktrumpet.com
------------------------------
Date: Fri, 05 Feb 2010 14:47:23 -0600
From: David Thole <dthole@gmail.com>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <m2aavnl89w.fsf@dhcpw80ff9506.dynamic.uiowa.edu>
Tad McClellan <tadmc@seesig.invalid> writes:
> ["Followup-To:" header set to comp.lang.perl.misc.]
>
> David Thole <dthole@gmail.com> wrote:
>> Tad,
>>
>> I can promise you I'm not trolling -
>
>
> I did not say, or even imply, that you were trolling.
>
My apologies, I misinterpreted what you were saying.
>
>> I was responding to Xah Lee's
>> original newsgroup post.
>
>
> I did say that you were feeding the troll.
Yeah, I'm kinda getting that now. Sorry for the intrusion for all the
people who read this on perl/cl
-David
------------------------------
Date: 05 Feb 2010 22:26:03 GMT
From: Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <037c8733$0$1292$c3e8da3@news.astraweb.com>
On Fri, 05 Feb 2010 09:53:33 -0600, David Thole wrote:
> I read this....and am a tiny bit confused about the actual problem.
>
> It's not exactly complex to realize that something like: a = b = array
> that a and b both point to the array.
>
> Logically speaking, I'm not sure how one could assume that the same
> assignment would yield a and b point to the same duplicate array.
It's an easy mistake to make, if you don't understand Python's object
model:
>>> a = b = 2
>>> a += 1
>>> a, b
(3, 2)
>>> a = b = [2]
>>> a[0] += 1
>>> a, b
([3], [3])
For the non-Python coders reading, the difference is that ints are
immutable, and hence a += 1 assigns a to a new int, leaving b untouched,
but lists are mutable, hence a[0] += 1 mutates the list which both a and
b refer to. This is a Good Thing, but it is one of the things which give
newcomers some trouble.
--
Steven
------------------------------
Date: Fri, 05 Feb 2010 23:57:09 +0100
From: pjb@informatimago.com (Pascal J. Bourguignon)
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <87r5oznvei.fsf@galatea.lan.informatimago.com>
David Thole <dthole@gmail.com> writes:
> Yeah, I'm relatively new to Usenet so far...maybe 2 weeks old, so I have
> only begun to realize that he's actually a troll. How to killify him is
> something I'm not sure of yet...but seeing some spam get through, plus
> stuff like this makes me want to check up on how to do it. I also need
> to figure out how to make my client include previous posts, quoted at
> least somewhat. heh, using gnus...so I'm sure it's possible to get this
> configured right.
gnus, easy: just type M-x gnus-kill-file-kill-by-author RET on the
article of the author you want to kill-file.
--
__Pascal Bourguignon__
------------------------------
Date: Fri, 05 Feb 2010 16:59:14 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <87fx5fcmrh.fsf@castleamber.com>
David Thole <dthole@gmail.com> writes:
> Yeah, I'm relatively new to Usenet so far...maybe 2 weeks old, so I have
> only begun to realize that he's actually a troll. How to killify him is
> something I'm not sure of yet...but seeing some spam get through, plus
> stuff like this makes me want to check up on how to do it. I also need
> to figure out how to make my client include previous posts, quoted at
> least somewhat. heh, using gnus...so I'm sure it's possible to get this
> configured right.
F (shift F key) = follow up with quoting, no configuring needed (at
least not in my experience).
Regarding scoring, see:
http://www.gnu.org/software/emacs/manual/html_node/gnus/Scoring.html#Scoring
(killfiles have been replaced by scoring).
--
John Bokma j3b
Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
------------------------------
Date: Fri, 05 Feb 2010 19:14:44 -0600
From: David Thole <dthole@gmail.com>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <m2636bkvwb.fsf@dhcpw80ff9506.dynamic.uiowa.edu>
Thanks,
Another person who read also contacted me directly by email to help me
with the kill file. I think I got it working and all, so I'll know
within a few days if it worked or not :)
Thanks though.
David
http://www.thedarktrumpet.com
------------------------------
Date: Sat, 6 Feb 2010 10:57:54 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Python's Reference And Internal Model Of Computing Languages
Message-Id: <slrnhmqf93.584.hjp-usenet2@hrunkner.hjp.at>
On 2010-02-05 18:19, David Thole <dthole@gmail.com> wrote:
> I avoided posting actual code because Xah Lee's post was cross-newgroup,
> which if I write something in Lisp, it definitely wouldn't be applicable
> to Perl or Python. It was a decision to keep it simple is all, language
> inspecific.
This is a noble goal, but "simple" and "language inspecific" don't go
well together. Apparently simple terms like "array" have slightly
different semantics in different languages, so to be language inspecific
you need to carefully define all these terms before you use them. If you
just write something like
a = b
without defining exactly what a and b are and what = does, everybody has
to guess and it is very likely that different people will guess
differently.
hp
------------------------------
Date: Fri, 5 Feb 2010 22:41:44 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Running NMap Scan from Perl
Message-Id: <otfu37-vfi.ln1@news.rtij.nl>
On Fri, 05 Feb 2010 06:21:50 -0800, KDawg44 wrote:
> Hello,
>
> From a resource perspective, would it be better to loop through and scan
> each subnet or build my list of subnets and scan once? Does it matter?
>
> For instance, would I be better looping through:
>
> nmap -sS SUBNET_1
> nmap -sS SUBNET_2
> nmap -sS SUBNET_3
> .....
>
> or
>
> nmap -sS SUBNET_1 SUBNET_2 SUBNET_3 .....
>
> Also, due to a whitelist built into my script (skipped over IP's), the
> scan looks more like:
>
> nmap -sS SUBNET_1.1-40 SUBNET_1.42-100 SUBNET_1.102-254
>
> Will any of this make a difference?
This is actually a nmap question, not a perl question. But yes, it makes
a huge difference as nmap parallises the scans. Read the nmap man page
for more info.
HTH,
M4
------------------------------
Date: Fri, 5 Feb 2010 23:21:23 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: SpeedyCGI, clearing certain variables
Message-Id: <slrnhmp6f4.812.hjp-usenet2@hrunkner.hjp.at>
On 2010-02-05 04:55, Jason Carlton <jwcarlton@gmail.com> wrote:
> I have a rather lengthy CGI script that I wrote about 5 years ago, but
> it's still functional. At the very beginning, though, it connects to a
> database, then loads several variables. It would be nice if these
> could stay persistent.
>
> Rather than rewriting the whole thing, I'm thinking that it might be
> simpler to use SpeedyCGI to just keep a connection open to these
> static variables.
>
> Is there a way for me to empty certain variables on each run?
> Specifically, I'd like to undefine params and cookies. I thought that
> this would work, but it didn't:
Consider using FastCGI as an alternative. A FastCGI script looks roughly
like this:
use CGI::Fast;
# initialisation code, e.g. connect to database, etc.
while(my $q = CGI::Fast->new()) {
# handle one request.
}
Since you get a new CGI::Fast object for each request, you alse get new
params and cookies. Also, all lexical variables declared in the loop are
automatically cleared, only the ones declared before the loop survive
across queries.
hp
------------------------------
Date: Fri, 5 Feb 2010 22:55:13 -0800 (PST)
From: Robin <robin1@cnsp.com>
Subject: very important web site to post you know your political protests....
Message-Id: <e76a365f-b649-407d-b492-8447fe517265@j31g2000yqa.googlegroups.com>
Post a political potest/event you want to happen here at
It will be viewed and hypotherically people might go to it if they
read it and live near you.
http://polunrestthing.memebot.com/
Everyone tell others.
Thank you,
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 2806
***************************************