[32710] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3974 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 27 03:09:20 2013

Date: Thu, 27 Jun 2013 00:09:04 -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           Thu, 27 Jun 2013     Volume: 11 Number: 3974

Today's topics:
    Re: CPAN vs. POD outside of .pm (.pl) files? <oneingray@gmail.com>
        form post URL encoded <itko59@gmail.com>
    Re: form post URL encoded <rweikusat@mssgmbh.com>
    Re: form post URL encoded <ben@morrow.me.uk>
    Re: form post URL encoded <itko59@gmail.com>
    Re: form post URL encoded <ben@morrow.me.uk>
    Re: form post URL encoded <itko59@gmail.com>
    Re: form post URL encoded <ben@morrow.me.uk>
    Re: form post URL encoded <itko59@gmail.com>
    Re: form post URL encoded <itko59@gmail.com>
    Re: regex question <jblack@nospam.com>
    Re: regex question <jblack@nospam.com>
    Re: regex question <ben@morrow.me.uk>
    Re: regex question <jblack@nospam.com>
        Tree::Range 0.1 released <oneingray@gmail.com>
    Re: Tree::Range 0.1 released <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Jun 2013 05:42:10 +0000
From: Ivan Shmakov <oneingray@gmail.com>
Subject: Re: CPAN vs. POD outside of .pm (.pl) files?
Message-Id: <8761x09kjx.fsf@violet.siamics.net>

>>>>> Ben Morrow <ben@morrow.me.uk> writes:
>>>>> Quoth Ivan Shmakov <oneingray@gmail.com>:
>>>>> Ben Morrow <ben@morrow.me.uk> writes:

[...]

 >>> What do you mean by 'CPAN'?  The CPAN shell doesn't normally do
 >>> this.  Do you mean search.cpan.org?

 >> Yes, I've meant http://search.cpan.org/ specifically, even though
 >> I've inaccurately referenced the whole cpan.org infrastructure.

 >> I didn't mean cpan(1).

 > OK.  I asked because I think it's possible to configure at least
 > cpanp to install HTML documentation, and IIRC ActiveState have or
 > used to patch their CPAN.pm to do the same.

	That's interesting.  Thanks.

[...]

 >>> search.cpan.org already displays a list of all the .pod files in a
 >>> distribution under the 'Documentation' section.  If a .pm file has
 >>> no Pod, and there is a .pod file next to it, it moves the .pod link
 >>> up into the 'Modules' section.

 >> (Which makes me wonder where is it documented?)

 > I don't think it is.  search.cpan.org is not part of the CPAN
 > infrastructure per se, it was just a useful website written by Graham
 > Barr which was given a domain under cpan.org.

	Which seems to make it quite a "part," at least for a casual
	user like me.

 > I believe the intention is that it should index things in the same
 > way as CPAN.pm and perldoc.

	ACK, thanks.

 >>> It's probably important to get the NAME section of the Pod right.
 >>> I don't exactly know how the search.cpan.org/perldoc?foo links it
 >>> uses for L<> work, but I suspect they're indexed based on the NAME
 >>> section.

 >> ACK, thanks!  Hopefully, such indexing won't insist on the use of a
 >> HYPHEN-MINUS (U+002D) there, instead of the arguably more
 >> appropriate EN DASH (U+2013).

 > I wouldn't muck about with the formatting of the NAME section.

	FWIW, http://search.cpan.org/ seems to handle it just fine.
	Consider, e. g.:

http://search.cpan.org/perldoc?Tree::Range::base
http://search.cpan.org/perldoc?Tree::Range::RB

	Preasumably, it just indexes the PODs by the filename.

 > pod2man in particular is quite picky about it, and there are other
 > tools which rely on the format being right.

	As it seems, ExtUtils::MakeMaker assumes (SPACE, HYPHEN-MINUS,
	SPACE) for the delimiter while handling ABSTRACT_FROM, and I'm
	considering it a bug (yet to be filed.)

	I've not seen any problem with pod2man(1) vs. NAME as of yet.
	What should I take note of?

	(It appears to assume that --quotes= is a string of two
	/octets/, not two /characters,/ though.)

-- 
FSF associate member #7257


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

Date: Wed, 26 Jun 2013 00:43:17 -0700 (PDT)
From: Hristo Panayotov <itko59@gmail.com>
Subject: form post URL encoded
Message-Id: <27ae565c-c546-4fb9-91de-b66da28cb321@googlegroups.com>

Hi folks ! Just registered. I need to send to a Payment Gateway encrypted X=
ML /base64/. Here are their requirements :
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
2.Parameter encryption
Java
/String base64Xml =3D URLEncoder.encode(xml.toString(),"UTF-8");
sun.misc.BASE64Encoder encoder =3D new sun.misc.BASE64Encoder();
String base64 =3D encoder.encode(base64Xml.getBytes());
Php:
$base64 =3Dbase64_encode(urlencode($baseStr));
3.Data Submit
<form action=3D=93https://payment.server.com/payment/Interface=94 method=3D=
=93post=94>
<input type=3D=94hidden=94 name=3D=94TradeInfo=94 value=3D=94<%=3D base64 %=
>=94/>
<input type=3D=94submit=94 value=3D=94submit=94 />
</form>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
I do everything to complete my XML then I encode it base64 and try to send.=
 They said that cannot decode it. Why? - they dont know. Me too as I'm newb=
y in Perl. They said that maybe my string is not correctly URL encoded...He=
re is the part of my sending :

#=3D=3D=3D=3D=3D=3D=3D Encode XML base64 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
use MIME::Base64 ;
$enco =3D encode_base64($wr);

#=3D=3D=3D=3D=3D=3D=3D Send request to Payment Gateway =3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua =3D LWP::UserAgent->new();
my $req =3D POST 'https://payment.server.com/payment/Interface'; [
type=3D>'hidden',
name=3D> 'TradeInfo',
value=3D> $enco,
type=3D>'submit',
value=3D>'submit',

];


$content =3D $ua->request($req)->as_string;
# print "Content-type: text/html\n\n";
print $content;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
$enco is encoded string. When I sent them $enco in a file they decode it co=
rrectly. But when I send through Post method they cant

I receive a error.jsp?error=3D1001 all the time I send
Mybe something wrong in my post? Or ?....
Any help ??????????????????????????????????

=09
=09


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

Date: Wed, 26 Jun 2013 09:18:59 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: form post URL encoded
Message-Id: <87zjud8eto.fsf@sapphire.mobileactivedefense.com>

Hristo Panayotov <itko59@gmail.com> writes:
> =====================
> 2.Parameter encryption
> Java
> /String base64Xml = URLEncoder.encode(xml.toString(),"UTF-8");
> sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
> String base64 = encoder.encode(base64Xml.getBytes());
> Php:
> $base64 =base64_encode(urlencode($baseStr));
> 3.Data Submit
> <form action=“https://payment.server.com/payment/Interface” method=“post”>
> <input type=”hidden” name=”TradeInfo” value=”<%= base64 %>”/>
> <input type=”submit” value=”submit” />
> </form>
> ===================
> I do everything to complete my XML then I encode it base64 and try to send. They said that cannot decode it. Why? - they dont know. Me too as I'm newby in Perl. They said that maybe my string is not correctly URL encoded...Here is the part of my sending :
>
> #======= Encode XML base64 ================================
> use MIME::Base64 ;
> $enco = encode_base64($wr);
>
> #======= Send request to Payment Gateway ==================
> use HTTP::Request::Common qw(POST);
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new();
> my $req = POST 'https://payment.server.com/payment/Interface'; [
> type=>'hidden',
> name=> 'TradeInfo',
> value=> $enco,
> type=>'submit',
> value=>'submit',
>
> ];
>
>
> $content = $ua->request($req)->as_string;
> # print "Content-type: text/html\n\n";
> print $content;
> ======================
> $enco is encoded string. When I sent them $enco in a file they
> decode it correctly. But when I send through Post method they cant

Quick guess: Are you posting the text with correct line endings, that
is \xd\xa after each line? (you should probably also do somethin a la
binmode(STDOUT) to stop perl from messing with the data).


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

Date: Wed, 26 Jun 2013 12:33:08 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: form post URL encoded
Message-Id: <k40r9a-bni1.ln1@anubis.morrow.me.uk>


Quoth Hristo Panayotov <itko59@gmail.com>:
> Hi folks ! Just registered. I need to send to a Payment Gateway
> encrypted XML /base64/. Here are their requirements :
> =====================
> 2.Parameter encryption

You do realise this is not 'encrypted', don't you?

> Java
> /String base64Xml = URLEncoder.encode(xml.toString(),"UTF-8");
> sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
> String base64 = encoder.encode(base64Xml.getBytes());
> Php:
> $base64 =base64_encode(urlencode($baseStr));
> 3.Data Submit
> <form action="https://payment.server.com/payment/Interface" method="post">
> <input type="hidden" name="TradeInfo" value="<%= base64 %>"/>
> <input type="submit" value="submit" />
> </form>
> ===================
> I do everything to complete my XML then I encode it base64 and try to
> send. They said that cannot decode it. Why? - they dont know. Me too as
> I'm newby in Perl. They said that maybe my string is not correctly URL
> encoded...Here is the part of my sending :
> 
> #======= Encode XML base64 ================================
> use MIME::Base64 ;
> $enco = encode_base64($wr);

You've skipped the 'convert to UTF-8' and 'URL-encode' steps. See
Encode::encode and URI::Escape::uri_escape.

> #======= Send request to Payment Gateway ==================
> use HTTP::Request::Common qw(POST);
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new();
> my $req = POST 'https://payment.server.com/payment/Interface'; [
> type=>'hidden',
> name=> 'TradeInfo',
> value=> $enco,
> type=>'submit',
> value=>'submit',
> 
> ];

This is not how POST works. You want a field called 'TradeInfo' with a
value of $enco; that is

    [ TradeInfo => $enco ]

The submit button is not itself submitted (it doesn't have a name), so
it's irrelevant here.

> $content = $ua->request($req)->as_string;
> # print "Content-type: text/html\n\n";
> print $content;
> ======================
> $enco is encoded string. When I sent them $enco in a file they decode it
> correctly. But when I send through Post method they cant
> 
> I receive a error.jsp?error=1001 all the time I send
> Mybe something wrong in my post? Or ?....
> Any help ??????????????????????????????????
           ^^^^^^^^^
Please don't do that.

Ben



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

Date: Wed, 26 Jun 2013 06:21:32 -0700 (PDT)
From: Hristo Panayotov <itko59@gmail.com>
Subject: Re: form post URL encoded
Message-Id: <fa85c0e7-a991-48b0-a9ec-ffc9ac5199ac@googlegroups.com>

ThanQ Ben ! It is one of my first Perl tries ;) Could U help me some ? itko59 at gmail dot com


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

Date: Wed, 26 Jun 2013 14:45:19 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: form post URL encoded
Message-Id: <fs7r9a-ucm1.ln1@anubis.morrow.me.uk>


Quoth Hristo Panayotov <itko59@gmail.com>:
> ThanQ Ben ! It is one of my first Perl tries ;) 
     ^^^
Please don't do that.

> Could U help me some ?
       ^^^
Please don't do that either.

> itko59 at gmail dot com

If you post here (in proper English), I might be able to.

Ben



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

Date: Wed, 26 Jun 2013 07:14:03 -0700 (PDT)
From: Hristo Panayotov <itko59@gmail.com>
Subject: Re: form post URL encoded
Message-Id: <599df0e4-7f8d-4052-bdf9-f0237386b224@googlegroups.com>

VGhlaXIgcmVxdWlyZW1lbnRzIGFuZCBleGFtcGxlcyAvc2l0ZSBJIGhhdmUgdG8gUE9TVCB0by8g
Og0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0K
MuOAgVBhcmFtZXRlciBlbmNyeXB0aW9uDQpKYXZhDQovU3RyaW5nIGJhc2U2NFhtbCA9IFVSTEVu
Y29kZXIuZW5jb2RlKHhtbC50b1N0cmluZygpLCJVVEYtOCIpOw0Kc3VuLm1pc2MuQkFTRTY0RW5j
b2RlciBlbmNvZGVyID0gbmV3IHN1bi5taXNjLkJBU0U2NEVuY29kZXIoKTsNClN0cmluZyBiYXNl
NjQgPSBlbmNvZGVyLmVuY29kZShiYXNlNjRYbWwuZ2V0Qnl0ZXMoKSk7DQpQaHA6DQokYmFzZTY0
ID1iYXNlNjRfZW5jb2RlKHVybGVuY29kZSgkYmFzZVN0cikpOw0KM+OAgURhdGEgU3VibWl0DQo8
Zm9ybSBhY3Rpb2494oCcaHR0cHM6Ly9wYXltZW50LnNlcnZlci5jb20vcGF5bWVudC9JbnRlcmZh
Y2XigJ0gbWV0aG9kPeKAnHBvc3TigJ0+DQo8aW5wdXQgdHlwZT3igJ1oaWRkZW7igJ0gbmFtZT3i
gJ1UcmFkZUluZm/igJ0gdmFsdWU94oCdPCU9IGJhc2U2NCAlPuKAnS8+DQo8aW5wdXQgdHlwZT3i
gJ1zdWJtaXTigJ0gdmFsdWU94oCdc3VibWl04oCdIC8+DQo8L2Zvcm0+DQo044CBQWxsIG9mIHRo
ZSBwYXJhbWV0ZXIgc2hvdWxkIGRpc3Rpbmd1aXNoIHRoZSBjYXBpdGFsIGxldHRlciBhbmQgbG93
ZXJjYXNl44CCDQo144CBQ29kZSBmb3JtYXQ6VVRGLTgNCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQoNCkhlcmUgaXMgbXkgUGVybCBjb2RlIC9h
dCB0aGUgbW9tZW50LyA6DQoNCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09DQogIz09PT09PT0gRW5jb2RlIFhNTCBiYXNlNjQgPT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT0NCiB1c2UgTUlNRTo6QmFzZTY0IDsNCiB1c2UgVVJJOjpFc2Nh
cGU7DQogdXNlIEVuY29kZTo6RW5jb2RlcjsgICAgICAgICAgICAgICAgICM/Pz8/Pw0KICRlbiA9
IHVyaV9lc2NhcGUoJHdyKTsgICAgICAjICR3ciBpcyBteSBzdHJpbmcgL2NvbnRhaW4gWE1MLyAh
ISEhISEhDQogJGVuY28gPSBlbmNvZGUoJGVuKS0+dXRmOC0+YmFzZTY0OyAgICM/Pz8/Pw0KICMg
JGVuY28xID0gZW5jb2RlKCJ1dGY4IiwgJGVuKTsNCiAjICRlbmNvID0gZW5jb2RlX2Jhc2U2NCgk
ZW5jbzEpOw0KIA0KICM9PT09PT09IFNlbmQgcmVxdWVzdCB0byBQYXltZW50IEdhdGV3YXkgPT09
PT09PT09PT09PT09PT09DQp1c2UgVVRGODsNCiB1c2UgSFRUUDo6UmVxdWVzdDo6Q29tbW9uIHF3
KFBPU1QpOyAgDQogIHVzZSBMV1A6OlVzZXJBZ2VudDsgDQogJHVhID0gTFdQOjpVc2VyQWdlbnQt
Pm5ldygpOyAgDQpteSAkcmVxID0gUE9TVCAnaHR0cHM6Ly9wYXltZW50LnNlcnZlci5jb20vcGF5
bWVudC9JbnRlcmZhY2UnOyBbDQogIHR5cGU9PidoaWRkZW4nLA0KICBuYW1lPT4gJ1RyYWRlSW5m
bycsIA0KICBUcmFkZUluZm8gPT4gJGVuY28sDQogIHR5cGU9PidzdWJtaXQnLA0KICB2YWx1ZT0+
J3N1Ym1pdCcsDQoNCiBdOyANCiANCiAkY29udGVudCA9ICR1YS0+cmVxdWVzdCgkcmVxKS0+YXNf
c3RyaW5nOyANCiMgcHJpbnQgIkNvbnRlbnQtdHlwZTogdGV4dC9odG1sXG5cbiI7IA0KIHByaW50
ICRjb250ZW50Ow0KDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT0NCkknbSBpbiB0b3VjaCBCZW4gIQ0KDQo=


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

Date: Wed, 26 Jun 2013 17:36:09 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: form post URL encoded
Message-Id: <pshr9a-j7p1.ln1@anubis.morrow.me.uk>

You are posting in Base64. Please don't do that: this group is
text-only.

You are using Unicode quotes in your code samples. Don't do that:
they're not the same as ASCII quotes, and they aren't valid syntax. It's
possible this is what's causing Google to post in Base64; that would be
pretty stupid, given the design characteristics of UTF-8, but that's
Google Groups for you.

You are also using other random Unicode punctuation. Please don't do
that without a good reason. If you're copying text from somewhere else
please make sure it's suitable for Usenet before posting it.

Since you're using Google Groups, you may not realise that this group is
not part of the Google hivemind but is part of Usenet, a much older
system with its own traditions and conventions. You may want to learn a
little about it before posting, and you may want to find yourself a real
newsreader and news server.

Quoth Hristo Panayotov <itko59@gmail.com>:
> Their requirements and examples /site I have to POST to/ :
> ====================================================
> 2 Parameter encryption

You keep referring to this process as 'encryption' when it isn't. If
this is a term you are getting from your payment service provider, you
may want to consider finding someone else who knows what they are
talking about.

[...]
> Here is my Perl code /at the moment/ :
> 
> =====================================================
>  #======= Encode XML base64 ================================

You should start all your code with

    use warnings;
    use strict;

This will help catch simple errors.

>  use MIME::Base64 ;
>  use URI::Escape;
>  use Encode::Encoder;                 #?????

I would stick to the explicit Encode interface to start with.

    use Encode qw/encode/;

>  $en = uri_escape($wr);      # $wr is my string /contain XML/ !!!!!!!
>  $enco = encode($en)->utf8->base64;   #?????

'strict' would have given you an error here, since you didn't have an
'encode' function. 

>  # $enco1 = encode("utf8", $en);
>  # $enco = encode_base64($enco1);

This would have been right, if you'd imported encode from Encode.
However, you should give your variables better names than '$enco1'.

>  
>  #======= Send request to Payment Gateway ==================
> use UTF8;

There is no 'UTF8' module. There is a 'utf8' module, but you don't need
it here.

>  use HTTP::Request::Common qw(POST);  
>   use LWP::UserAgent; 
>  $ua = LWP::UserAgent->new();  
> my $req = POST 'https://payment.server.com/payment/Interface'; [
                                                              ^^^
What is that semicolon doing there?

>   type=>'hidden',
>   name=> 'TradeInfo', 
>   TradeInfo => $enco,
>   type=>'submit',
>   value=>'submit',
> 
>  ]; 

No, you still haven't understood how the form submission works. What
does a browser send to the webserver when you give it this HTML

    <form action="https://..." method="POST">
        <input type=hidden name=TradeInfo value="foo">
        <input type=submit value="Submit">
    </form>

and click on the button? This is not a Perl question, but you need to be
able to answer it before you can write this piece of code.

>  $content = $ua->request($req)->as_string; 
> # print "Content-type: text/html\n\n"; 
>  print $content;
> 
> =============================================
> I'm in touch Ben !

How nice. In touch with whom?

Ben



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

Date: Wed, 26 Jun 2013 11:00:12 -0700 (PDT)
From: Hristo Panayotov <itko59@gmail.com>
Subject: Re: form post URL encoded
Message-Id: <61245a2c-f891-4fbe-9530-12621b4dcb7c@googlegroups.com>

ThanQ very much ! I'll have in mind ur suggestion. Have to learn !
ThanQ again !


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

Date: Wed, 26 Jun 2013 12:49:23 -0700 (PDT)
From: Hristo Panayotov <itko59@gmail.com>
Subject: Re: form post URL encoded
Message-Id: <8ecf0821-543b-4675-b1c3-61be7ee4a0a9@googlegroups.com>

And thanks again ! It has worked ;) 


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

Date: Mon, 24 Jun 2013 23:17:50 -0500
From: John Black <jblack@nospam.com>
Subject: Re: regex question
Message-Id: <MPG.2c32d5e4a5ce366798977e@news.eternal-september.org>

In article <kq3qnu$8m0$1@speranza.aioe.org>, derykus@gmail.com says...
> 
> On 6/21/2013 12:45 PM, John Black wrote:
> > In article <210620130850374203%jimsgibson@gmail.com>, jimsgibson@gmail.com says...
> >>
> >> [...]
> >
> > This is great.  Thanks to both of you.  It does work for my example but I tried to apply it
> > to a different example and its not working.  I want to match on some pattern that is not
> > followed by some other string later but not necessarily immediately following like my
> > original example.
> >
> > I tried /pattern1.*(?!string)/
> >
> > but this seems to match pattern1 even if "string" comes later somewhere on the line.
> >
> 
> Another alternative to lookaheads is the /p switch which effectively 
> partitions a successful match into pre-match, match, and post-match:
> 
> if ( "foo bar" =~ /foo/p and ${^POSTMATCH} !~ /bar/ ) ...
> 
> So, ${^PREMATCH} is "",  ${^MATCH} is"foo", and  ${^POSTMATCH} is " bar"
> 
> P.S. ( "p" in /p doesn't mean "partition" but it's still an easy way to 
> remember what happens. See perlre ).

Charles, thanks.  I like it.  Its actually more readable than the negative lookahead syntax.

John Black


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

Date: Mon, 24 Jun 2013 23:24:41 -0500
From: John Black <jblack@nospam.com>
Subject: Re: regex question
Message-Id: <MPG.2c32d784451bf8f698977f@news.eternal-september.org>

In article <id1f9a-vp62.ln1@anubis.morrow.me.uk>, ben@morrow.me.uk says...
> 
> Quoth John Black <jblack@nospam.com>:
> > 
> > This is great.  Thanks to both of you.  It does work for my example but
> > I tried to apply it 
> > to a different example and its not working.  I want to match on some
> > pattern that is not 
> > followed by some other string later but not necessarily immediately
> > following like my 
> > original example.
> > 
> > I tried /pattern1.*(?!string)/
> > 
> > but this seems to match pattern1 even if "string" comes later somewhere
> > on the line.
> 
> Yes. Think a bit about how it matches. If you match (say) 
>     
>     "foo bar" =~ /foo.*(?!bar)/
> 
> then first the 'foo' matches the 'foo', then the .* matches the ' bar',
> then perl tries to match /bar/ at that point. It doesn't match (we're at
> the end of the string), so the (?!) succeeds, and the whole match
> succeeds. 
> 
> Running a match under 'use re "debug";' might help you to understand
> what's going on, though it tends to produce so much output it takes a
> bit of practice to sort through it.
> 
> You want to assert 'starting immediately after the 'foo', it must not be
> possible to match any amount of text followed by 'bar''. That is,
> 
>     /foo(?!.*bar)/
> 
> with the .* inside the (?!). (You may also want /s.)

Ben, thanks.  This makes sense but I'm not sure where I would want the /s or why?

John Black


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

Date: Tue, 25 Jun 2013 18:34:45 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: regex question
Message-Id: <lu0p9a-eak1.ln1@anubis.morrow.me.uk>


Quoth John Black <jblack@nospam.com>:
> In article <id1f9a-vp62.ln1@anubis.morrow.me.uk>, ben@morrow.me.uk says...
> > 
> > You want to assert 'starting immediately after the 'foo', it must not be
> > possible to match any amount of text followed by 'bar''. That is,
> > 
> >     /foo(?!.*bar)/
> > 
> > with the .* inside the (?!). (You may also want /s.)
> 
> Ben, thanks.  This makes sense but I'm not sure where I would want the
> /s or why?

Read the section on m// in perlop. /s makes . match newline, which it
otherwise doesn't.

Ben



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

Date: Tue, 25 Jun 2013 14:28:50 -0500
From: John Black <jblack@nospam.com>
Subject: Re: regex question
Message-Id: <MPG.2c33ab5656e3ecb3989780@news.eternal-september.org>

In article <lu0p9a-eak1.ln1@anubis.morrow.me.uk>, ben@morrow.me.uk says...
> 
> Quoth John Black <jblack@nospam.com>:
> > In article <id1f9a-vp62.ln1@anubis.morrow.me.uk>, ben@morrow.me.uk says...
> > > 
> > > You want to assert 'starting immediately after the 'foo', it must not be
> > > possible to match any amount of text followed by 'bar''. That is,
> > > 
> > >     /foo(?!.*bar)/
> > > 
> > > with the .* inside the (?!). (You may also want /s.)
> > 
> > Ben, thanks.  This makes sense but I'm not sure where I would want the
> > /s or why?
> 
> Read the section on m// in perlop. /s makes . match newline, which it
> otherwise doesn't.

Ah yes.  I was confused because for some reason, I saw your /s as \s.  Thanks.

John Black


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

Date: Thu, 27 Jun 2013 05:27:43 +0000
From: Ivan Shmakov <oneingray@gmail.com>
Subject: Tree::Range 0.1 released
Message-Id: <87a9mc9l80.fsf@violet.siamics.net>

>>>>> Ivan Shmakov <oneingray@gmail.com> writes:

 > So, I've crafted the base for a Tree::Interval-like module,
 > implemented on top of Tree::RB, and I'm open to suggestions of what'd
 > be a suitable name for it?

[...]

 > FWIW, Tree::Interval::RB seems more appropriate, as the code as it is
 > requires only the compare, delete, insert and lookup methods from the
 > "backend," and thus could probably be not that hard to generalize.

	So, I've ended up with Tree::Range::RB, and Tree::Range::base
	for the ->get_range () and ->range_set () methods.  Both are now
	released as Tree::Range 0.1.  The CPAN page for the version is:

http://search.cpan.org/~onegray/Tree-Range-0.1/

[...]

PS.  The namespace registration request is filed and pending approval.

-- 
FSF associate member #7257


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

Date: Thu, 27 Jun 2013 07:47:20 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Tree::Range 0.1 released
Message-Id: <oo3t9a-pe72.ln1@anubis.morrow.me.uk>


Quoth Ivan Shmakov <oneingray@gmail.com>:
> 
> 	So, I've ended up with Tree::Range::RB, and Tree::Range::base
> 	for the ->get_range () and ->range_set () methods.  Both are now
> 	released as Tree::Range 0.1.  The CPAN page for the version is:
> 
> http://search.cpan.org/~onegray/Tree-Range-0.1/
> 
> [...]
> 
> PS.  The namespace registration request is filed and pending approval.

The namespace registration process is pretty-much defunct at this point.
Both Tree::Range::RB and Tree::Range::base are already as 'properly
registered' as they need to be; that is, they are listed in
02packages.details.txt.gz on CPAN, so clients like CPAN.pm and cpanm
will find your distributions for those package names.

However, it goes against convention to have a distribution called
Tree-Range that does not contain a module Tree::Range. You should
consider either renaming Tree::Range::base or at least providing a
documentation-only Tree::Range explaining why there isn't a module
there.

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:

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


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