[30215] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1458 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 22 16:27:32 2008

Date: Tue, 22 Apr 2008 13:27:22 -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, 22 Apr 2008     Volume: 11 Number: 1458

Today's topics:
    Re: Matching URLs with REs (was "Some questions about q <abigail@abigail.be>
    Re: Matching URLs with REs (was "Some questions about q <see.my.signature@for.my.email.address>
    Re: Matching URLs with REs (was "Some questions about q <see.my.signature@for.my.email.address>
    Re: Matching URLs with REs (was "Some questions about q <abigail@abigail.be>
    Re: Matching URLs with REs (was "Some questions about q <tadmc@seesig.invalid>
    Re: Matching URLs with REs (was "Some questions about q <benkasminbullock@gmail.com>
        Merging/Joining AoA <v3gupta@gmail.com>
    Re: Merging/Joining AoA <benkasminbullock@gmail.com>
    Re: Merging/Joining AoA <name@yahoo.com>
    Re: Merging/Joining AoA <JustMe@somewhere.de>
    Re: Merging/Joining AoA <simon.chao@fmr.com>
    Re: Merging/Joining AoA <benkasminbullock@gmail.com>
    Re: Merging/Joining AoA <simon.chao@fmr.com>
        mod_perl and parallel Perl versions <noreply@gunnar.cc>
    Re: mod_perl and parallel Perl versions <ben@morrow.me.uk>
    Re: mod_perl and parallel Perl versions <spamtrap@dot-app.org>
    Re: mod_perl and parallel Perl versions <spamtrap@dot-app.org>
    Re: mod_perl and parallel Perl versions <noreply@gunnar.cc>
    Re: mod_perl and parallel Perl versions <ben@morrow.me.uk>
    Re: mod_perl and parallel Perl versions <spamtrap@dot-app.org>
    Re: mod_perl and parallel Perl versions <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Apr 2008 09:24:34 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <slrng0bhei.uuv.abigail@alexandra.abigail.be>

                                                               _
Robbie Hatley (see.my.signature@for.my.email.address) wrote on VCCCXLII
September MCMXCIII in <URL:news:ntednUYddefT1ZjVnZ2dnUVZ_uCinZ2d@giganews.com>:
{}  
{}  "Abigail" put forth into the annals of Usenet:
{}  
{} > (a rather large URL-capturing regex)
{}  
{}  Hmmm... I'm curious, did you write that manually, or generate it
{}  programmatically?  If generated, using what software?
{}  
{}  And how many decaseconds does it take a regex compiler to process
{}  that?
{}  
{} > I don't believe in capturing a few invalid ones - nor in
{} > rejected valid ones.
{}  
{}  I believe in simplicity over perfection.  Given these choices:
{}  A. Make a 100% perfect program taking 284 man-hours
{}  B. Make a  97% perfect program taking   5 man-hours
{}  I usually take B.


Well, that all depends, doesn't it? If you're getting paid only if it
passes the customers testing phase, you are more likely to choose A.

Furthermore, I do hope the programmer that programmed the computer in
my car didn't go for B.

Besides, where do you stop? You might as well use /./, having almost no
developer time, and it would still not reject any valid URI.


BTW, it didn't take me more than 5 hours to generate the regexp I gave you.
Writing the test suite OTOH did.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Wed, 16 Apr 2008 12:23:08 -0700
From: "Robbie Hatley" <see.my.signature@for.my.email.address>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <UPadnU-YwqC-z5vVnZ2dnUVZ_h6hnZ2d@giganews.com>


Ben Bullock wrote:

> I think there are only about 200 or so, most of which are rare.

Well, I'm not going to spend the time to make a soon-to-be-obsolete-anyway regex
out of 200 disparate chunks.  For my purposes, the regexes in my program seem to be
working fine.  If I need something more perfect, I'll take the advice of the folks who pointed
out that CPAN module to me.  (A bit more on this in a separate reply.)

> Did you really not understand my point?

I'd like to say, "You have a point there!", but I'm afraid you need a sharpener for that;
it seems a bit dull at the tip.

> Well, even if they do know a better approach, they might not have the
> energy to discuss it with you.

Some do.  For those who don't, a 24oz coffee is $1.59 at 7-11.

-- 
perl -le 'print "\122\157b\142\151e\40\110\141t\154\145y";'
perl -le 'print "\124\165s\164\151n\54\40\103A\54\40\125\123A";'
perl -le 'print "\154one\167olf\100\167ell\56\143om\n";'
perl -le 'print scalar reverse "/flowenol~/moc.llew.www//\72ptth";'




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

Date: Wed, 16 Apr 2008 12:49:32 -0700
From: "Robbie Hatley" <see.my.signature@for.my.email.address>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <cYydnc438-vPxZvVnZ2dnUVZ_tOtnZ2d@giganews.com>


"A. Sinan Unur" wrote:

> "Robbie Hatley" wrote:
>
> > "Abigail" put forth into the annals of Usenet:
> >
> >> (a rather large URL-capturing regex)
> >
> > Hmmm... I'm curious, did you write that manually, or generate it
> > programmatically?  If generated, using what software?
>
> You can read how it is done by looking at the sources of
> Regexp::Common modules. It is very elegant.

Ok, will do.

> ... using Regexp::Common would have cut that down to 2
> minutes for a perfect program ...

I'll try that.

Ok, I just downloaded Regexp-Common-2.120.  Now I have a folder
with a bunch of stuff in it.  This may sound like an incredibly
stupid question, but what do I do with it?  I've never actually
used a CPAN module before.  Any hints a CPAN newbie should be
aware of?

-- 
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant




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

Date: 16 Apr 2008 20:47:53 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <slrng0cpfp.uuv.abigail@alexandra.abigail.be>

                                                               _
Robbie Hatley (see.my.signature@for.my.email.address) wrote on VCCCXLII
September MCMXCIII in <URL:news:cYydnc438-vPxZvVnZ2dnUVZ_tOtnZ2d@giganews.com>:
,,  
,,  "A. Sinan Unur" wrote:
,,  
,, > "Robbie Hatley" wrote:
,, >
,, > > "Abigail" put forth into the annals of Usenet:
,, > >
,, > >> (a rather large URL-capturing regex)
,, > >
,, > > Hmmm... I'm curious, did you write that manually, or generate it
,, > > programmatically?  If generated, using what software?
,, >
,, > You can read how it is done by looking at the sources of
,, > Regexp::Common modules. It is very elegant.
,,  
,,  Ok, will do.
,,  
,, > ... using Regexp::Common would have cut that down to 2
,, > minutes for a perfect program ...
,,  
,,  I'll try that.
,,  
,,  Ok, I just downloaded Regexp-Common-2.120.  Now I have a folder
,,  with a bunch of stuff in it.  This may sound like an incredibly
,,  stupid question, but what do I do with it?  I've never actually
,,  used a CPAN module before.  Any hints a CPAN newbie should be
,,  aware of?


One could start with reading a file called README.


Abigail
-- 
print v74.117.115.116.32.97.110.111.116.104.101.114.
      v32.80.101.114.108.32.72.97.99.107.101.114.10;


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

Date: Thu, 17 Apr 2008 10:56:53 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <slrng0d4qn.7rh.tadmc@tadmc30.sbcglobal.net>

Robbie Hatley <see.my.signature@for.my.email.address> wrote:


> Ok, I just downloaded Regexp-Common-2.120.  Now I have a folder
> with a bunch of stuff in it.  This may sound like an incredibly
> stupid question, but what do I do with it?  I've never actually
> used a CPAN module before.  Any hints a CPAN newbie should be
> aware of?


   perldoc -q CPAN
or
   perldoc -q module


        How do I install a module from CPAN?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Thu, 17 Apr 2008 00:11:56 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Matching URLs with REs (was "Some questions about q{} and qr{}").
Message-Id: <fu64kc$gbl$1@ml.accsnet.ne.jp>

On Wed, 16 Apr 2008 12:49:32 -0700, Robbie Hatley wrote:

> Ok, I just downloaded Regexp-Common-2.120.  Now I have a folder with a
> bunch of stuff in it.  This may sound like an incredibly stupid
> question, but what do I do with it?  I've never actually used a CPAN
> module before.  Any hints a CPAN newbie should be aware of?

If I want to install a cpan module, I usually don't directly download 
the .tar.gz file. Instead I log in as root and type

cpan Regexp::Common

You might need to prefix that with "sudo" if you are using Ubuntu/Debian 
linux.

If you are using ActiveState Perl on Windows, you are better off using 
"ppm", the Perl Package Manager, which has precompiled versions of the 
modules.


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

Date: Mon, 21 Apr 2008 23:35:53 -0700 (PDT)
From: Vishal G <v3gupta@gmail.com>
Subject: Merging/Joining AoA
Message-Id: <49da6afc-916b-48f5-acc5-cce535e3c615@h1g2000prh.googlegroups.com>

Hi Guys,

I have a little complicated problem...

I have two arrays

@a = ( ['id', 'name', 'age'],
           ['1', 'Fred', '24'],
           ['2', 'Frank', '42'],
         );

@b = ( ['id', 'sex'],
           ['1', 'm' ],
           ['2', 'm'],
         );

I want to join these two AoA, based on id, so the resulting array will
look like this

@c = ( ['id', 'name', 'age', 'sex'],
           ['1', 'Fred', '24', 'm' ],
           ['2', 'Frank', '42', 'm'],
         );

Any Ideas?

Thanks in advance.


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

Date: Tue, 22 Apr 2008 00:13:35 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Merging/Joining AoA
Message-Id: <7d3db66d-5cef-4eaa-8cd3-54e489ae1721@a5g2000prg.googlegroups.com>

On Apr 22, 3:35 pm, Vishal G <v3gu...@gmail.com> wrote:
> Hi Guys,
>
> I have a little complicated problem...
>
> I have two arrays
>
> @a = ( ['id', 'name', 'age'],
>            ['1', 'Fred', '24'],
>            ['2', 'Frank', '42'],
>          );
>
> @b = ( ['id', 'sex'],
>            ['1', 'm' ],
>            ['2', 'm'],
>          );
>
> I want to join these two AoA, based on id, so the resulting array will
> look like this
>
> @c = ( ['id', 'name', 'age', 'sex'],
>            ['1', 'Fred', '24', 'm' ],
>            ['2', 'Frank', '42', 'm'],
>          );
>
> Any Ideas?

my %akeys;
@akeys{map $$_[0],@a} = @a;
my %bkeys;
@bkeys{map $$_[0],@b} = @b;
my @c;
for (sort keys %akeys) {
    if ($bkeys{$_}) {
	push @c, [@{$akeys{$_}},@{$bkeys{$_}}[1..$#{$bkeys{$_}}]];
    }
}
for (@c) {
    print "[",join (", ",@$_),"]\n";
}


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

Date: Tue, 22 Apr 2008 14:26:31 +0200
From: Matija Papec <name@yahoo.com>
Subject: Re: Merging/Joining AoA
Message-Id: <fuklho$hk8$1@ss408.t-com.hr>

Vishal G wrote:
> I have a little complicated problem...
> 
> I have two arrays
> 
> @a = ( ['id', 'name', 'age'],
>            ['1', 'Fred', '24'],
>            ['2', 'Frank', '42'],
>          );
> 
> @b = ( ['id', 'sex'],
>            ['1', 'm' ],
>            ['2', 'm'],
>          );
> 
> I want to join these two AoA, based on id, so the resulting array will
> look like this
> 
> @c = ( ['id', 'name', 'age', 'sex'],
>            ['1', 'Fred', '24', 'm' ],
>            ['2', 'Frank', '42', 'm'],
>          );

Assuming that both @a and @b have same size and same id order,

for my $i (0 .. $#a) {
   my $at = $a[$i];
   my $bt = $b[$i];
   push @$at, @$bt[1 .. $#$bt];
}
use Data::Dumper;
print Dumper \@a;


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

Date: Tue, 22 Apr 2008 16:24:19 +0200
From: Hartmut Camphausen <JustMe@somewhere.de>
Subject: Re: Merging/Joining AoA
Message-Id: <MPG.22781335a22632c6989681@news.t-online.de>

In <<7d3db66d-5cef-4eaa-8cd3-54e489ae1721@a5g2000prg.googlegroups.com>> 
schrieb Ben Bullock...

> [...]
> my @c;
> for (sort keys %akeys) {
>     [...]
> }
> for (@c) {
>     print "[",join (", ",@$_),"]\n";
> }

Prints   [1, Fred, 24, m]
         [2, Frank, 42, m] 
         [id, name, age, sex]

Take care of the 'sort' ;-)


Alternatively, if you want to take care of the IDs of /both/ arrays,
you could write:


#!perl.exe -w                             # well, on Windows...
use     strict;                           # always 'use' this one!

my @a = ( ['id',  'name',   'age' ],	# just our data...
          ['2',   'Frank',  '42'  ],
          ['1',   'Fred',   '24'  ],
          ['3',   'Pat',    '36'  ],
        );
my @b = ( ['id',  'sex' ],                # ...to deal with
          ['1',   'm'   ],
          ['2',   'm'   ],
          ['4',   '??'  ],
        );

my @afields = @{ shift @a };              # get rid of field names,
my @bfields = @{ shift @b }; shift @bfields; # keeping them at hand
my %a       = map {$_->[0],   $_} @a;     # now we can refer to the...
my %b       = map {shift @{$_}, $_} @b;   # ...data by their IDs

my %seen;                                 # just to avoid duplicates
my @c       = ( [ @afields, @bfields ],       # field names come first
                map { [ $a{$_}  ?  @{$a{$_}} : ($_, ('') x $#afields),
                        $b{$_}  ?  @{$b{$_}} : (    ('') x @bfields )
                      ] 
                    } sort grep { $seen{$_}++ ? 0 : $_ }
                                 keys (%a), keys (%b)
              );


 ...gives 

['id', 'name',  'age',  'sex']
['1',  'Fred',  '24',   'm'  ]
['2',  'Frank', '42',   'm'  ]
['3',  'Pat',   '36',   ''   ]
['4',  '',      '',     '??' ]



mfg, Hartmut


-- 
  ------------------------------------------------
Hartmut Camphausen      h.camp[bei]textix[punkt]de


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

Date: Tue, 22 Apr 2008 08:11:23 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Merging/Joining AoA
Message-Id: <0a4e56de-c96d-4f83-a927-5e43b7779e13@u69g2000hse.googlegroups.com>

On Apr 22, 2:35=A0am, Vishal G <v3gu...@gmail.com> wrote:
> Hi Guys,
>
> I have a little complicated problem...
>
> I have two arrays
>
> @a =3D ( ['id', 'name', 'age'],
> =A0 =A0 =A0 =A0 =A0 =A0['1', 'Fred', '24'],
> =A0 =A0 =A0 =A0 =A0 =A0['2', 'Frank', '42'],
> =A0 =A0 =A0 =A0 =A0);
>
> @b =3D ( ['id', 'sex'],
> =A0 =A0 =A0 =A0 =A0 =A0['1', 'm' ],
> =A0 =A0 =A0 =A0 =A0 =A0['2', 'm'],
> =A0 =A0 =A0 =A0 =A0);
>
> I want to join these two AoA, based on id, so the resulting array will
> look like this
>
> @c =3D ( ['id', 'name', 'age', 'sex'],
> =A0 =A0 =A0 =A0 =A0 =A0['1', 'Fred', '24', 'm' ],
> =A0 =A0 =A0 =A0 =A0 =A0['2', 'Frank', '42', 'm'],
> =A0 =A0 =A0 =A0 =A0);
>
> Any Ideas?

I'm not sure how much control you have over the structure of the data,
but it seems to me that you would be better served if the data were
stored in hashes to begin with:

use strict; use warnings;
use Data::Dumper;

my %people =3D (
  1 =3D> { name =3D> 'Fred',  age =3D> 24 },
  2 =3D> { name =3D> 'Frank', age =3D> 42 },
);

my %gender =3D (
  1 =3D> { sex =3D> 'm' },
  2 =3D> { sex =3D> 'm' },
);

=2E..then it's a simple matter to combine the two structures, keyed by
the id.

for my $id ( keys %people ) {
    $people{$id}{sex} =3D $gender{$id}{sex};
}



print Dumper( \%people ), "\n";




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

Date: Tue, 22 Apr 2008 15:30:37 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Merging/Joining AoA
Message-Id: <ful0as$44v$1@ml.accsnet.ne.jp>

On Tue, 22 Apr 2008 16:24:19 +0200, Hartmut Camphausen wrote:

> Prints   [1, Fred, 24, m]
>          [2, Frank, 42, m]
>          [id, name, age, sex]

Yes, I know. So what?

> Take care of the 'sort' ;-)

I don't care about the order of these results. The original poster can 
figure out all the details if he wants to.

> Alternatively, if you want to take care of the IDs of /both/ arrays, you
> could write:

Yes, but I have no way to really guess in detail what the original poster 
wanted, so why spend a lot of time trying to cover every possibility? I 
wrote that initial answer in only a minute or two, and I think it's good 
enough to get the poster on track towards an answer.



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

Date: Tue, 22 Apr 2008 08:51:18 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Merging/Joining AoA
Message-Id: <15df2e7c-f60b-4096-9f29-4208a23d274e@s50g2000hsb.googlegroups.com>

On Apr 22, 11:11=A0am, nolo contendere <simon.c...@fmr.com> wrote:
> On Apr 22, 2:35=A0am, Vishal G <v3gu...@gmail.com> wrote:
>
>
>
> > Hi Guys,
>
> > I have a little complicated problem...
>
> > I have two arrays
>
> > @a =3D ( ['id', 'name', 'age'],
> > =A0 =A0 =A0 =A0 =A0 =A0['1', 'Fred', '24'],
> > =A0 =A0 =A0 =A0 =A0 =A0['2', 'Frank', '42'],
> > =A0 =A0 =A0 =A0 =A0);
>
> > @b =3D ( ['id', 'sex'],
> > =A0 =A0 =A0 =A0 =A0 =A0['1', 'm' ],
> > =A0 =A0 =A0 =A0 =A0 =A0['2', 'm'],
> > =A0 =A0 =A0 =A0 =A0);
>
> > I want to join these two AoA, based on id, so the resulting array will
> > look like this
>
> > @c =3D ( ['id', 'name', 'age', 'sex'],
> > =A0 =A0 =A0 =A0 =A0 =A0['1', 'Fred', '24', 'm' ],
> > =A0 =A0 =A0 =A0 =A0 =A0['2', 'Frank', '42', 'm'],
> > =A0 =A0 =A0 =A0 =A0);
>
> > Any Ideas?
>
> I'm not sure how much control you have over the structure of the data,
> but it seems to me that you would be better served if the data were
> stored in hashes to begin with:
>
> use strict; use warnings;
> use Data::Dumper;
>
> my %people =3D (
> =A0 1 =3D> { name =3D> 'Fred', =A0age =3D> 24 },
> =A0 2 =3D> { name =3D> 'Frank', age =3D> 42 },
> );
>
> my %gender =3D (
> =A0 1 =3D> { sex =3D> 'm' },
> =A0 2 =3D> { sex =3D> 'm' },
> );
>
> ...then it's a simple matter to combine the two structures, keyed by
> the id.
>
> for my $id ( keys %people ) {
> =A0 =A0 $people{$id}{sex} =3D $gender{$id}{sex};
>
> }
>
> print Dumper( \%people ), "\n";

One more thing, are you certain that you wanted to quote the age
values in your data? in most cases perl is smart enough to dwym, but
for clarity i think it would be better to leave them as numbers rather
than strings.


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

Date: Sat, 19 Apr 2008 21:11:54 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: mod_perl and parallel Perl versions
Message-Id: <66uuc4F2md4unU1@mid.individual.net>

I have installed Perl 5.10.0 on my Linux box to be available together 
with the vendor supplied Perl 5.8.1. When running programs under 
mod_perl, the old Perl version is utilized.

How can I make mod_perl use Perl 5.10.0? Can mod_perl be configured so I 
can select Perl version on-the-fly?

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


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

Date: Sat, 19 Apr 2008 22:43:43 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <fl5qd5-q5e.ln1@osiris.mauzo.dyndns.org>


Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> I have installed Perl 5.10.0 on my Linux box to be available together 
> with the vendor supplied Perl 5.8.1. When running programs under 
> mod_perl, the old Perl version is utilized.
> 
> How can I make mod_perl use Perl 5.10.0? Can mod_perl be configured so I 
> can select Perl version on-the-fly?

5.10 is not binary-compatible with 5.8, so you will need to rebuild
mod_perl against 5.10. AIUI, mod_perl needs to be rebuilt against a new
version of perl anyway, as it does a lot of poking around in
undocumented parts of perls guts.

Ben



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

Date: Sat, 19 Apr 2008 18:21:51 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <m1lk39o58g.fsf@dot-app.org>

Gunnar Hjalmarsson <noreply@gunnar.cc> writes:

> I have installed Perl 5.10.0 on my Linux box to be available together
> with the vendor supplied Perl 5.8.1. When running programs under
> mod_perl, the old Perl version is utilized.
>
> How can I make mod_perl use Perl 5.10.0?

Recompile & reinstall mod_perl.

> Can mod_perl be configured so
> I can select Perl version on-the-fly?

No, the Apache module is linked to libperl, so it's specific to that Perl
for the reason that an XS module is - libperl exports a different set of
public symbols from one version to the next, and hides the differences
behind an API that's almost entirely cpp macros.

If you're looking for a more performant CGI replacement, you might look
at FastCGI instead. The cost in terms of IPC between Apache and the app
server are minimal, and like mod_perl it's a persistent environment, but
like CGI, you simply use the #! line to choose a language interpreter.

sherm-

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Sat, 19 Apr 2008 20:20:51 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <m1y779peak.fsf@dot-app.org>

Ben Morrow <ben@morrow.me.uk> writes:

> Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
>> I have installed Perl 5.10.0 on my Linux box to be available together 
>> with the vendor supplied Perl 5.8.1. When running programs under 
>> mod_perl, the old Perl version is utilized.
>> 
>> How can I make mod_perl use Perl 5.10.0? Can mod_perl be configured so I 
>> can select Perl version on-the-fly?
>
> 5.10 is not binary-compatible with 5.8, so you will need to rebuild
> mod_perl against 5.10. AIUI, mod_perl needs to be rebuilt against a new
> version of perl anyway, as it does a lot of poking around in
> undocumented parts of perls guts.

That appears to no longer be the case - mod_perl 2.0.4 was released just a
couple days ago, and one of the listed changes is that "it works with 5.10."

  <http://mail-archives.apache.org/mod_mbox/perl-modperl/200804.mbox/browser>

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Sun, 20 Apr 2008 02:42:09 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <66vhnbF2jkb6sU1@mid.individual.net>

Sherman Pendley wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>> I have installed Perl 5.10.0 on my Linux box to be available together 
>> with the vendor supplied Perl 5.8.1. When running programs under 
>> mod_perl, the old Perl version is utilized.
>>
>> How can I make mod_perl use Perl 5.10.0?
> 
> Recompile & reinstall mod_perl.

Yep, it proved to be that simple.

>> Can mod_perl be configured so I can select Perl version on-the-fly?
> 
> No, the Apache module is linked to libperl, so it's specific to that Perl 
> for the reason that an XS module is - libperl exports a different set of 
> public symbols from one version to the next, and hides the differences 
> behind an API that's almost entirely cpp macros.

I noticed that /usr/lib/httpd/modules/mod_perl.so was overwritten during 
the installation; guess that's part of it...

> If you're looking for a more performant CGI replacement, you might look 
> at FastCGI instead. The cost in terms of IPC between Apache and the app 
> server are minimal, and like mod_perl it's a persistent environment, but 
> like CGI, you simply use the #! line to choose a language interpreter.

Maybe I should have a look at FastCGI. Thanks for the tip!

And thanks both Ben and Sherman for your help.

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


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

Date: Sun, 20 Apr 2008 02:34:07 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <f5jqd5-hih.ln1@osiris.mauzo.dyndns.org>


Quoth Sherman Pendley <spamtrap@dot-app.org>:
> Ben Morrow <ben@morrow.me.uk> writes:
> 
> > Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> >> I have installed Perl 5.10.0 on my Linux box to be available together 
> >> with the vendor supplied Perl 5.8.1. When running programs under 
> >> mod_perl, the old Perl version is utilized.
> >> 
> >> How can I make mod_perl use Perl 5.10.0? Can mod_perl be configured so I 
> >> can select Perl version on-the-fly?
> >
> > 5.10 is not binary-compatible with 5.8, so you will need to rebuild
> > mod_perl against 5.10. AIUI, mod_perl needs to be rebuilt against a new
> > version of perl anyway, as it does a lot of poking around in
> > undocumented parts of perls guts.
> 
> That appears to no longer be the case - mod_perl 2.0.4 was released just a
> couple days ago, and one of the listed changes is that "it works with 5.10."

Read what I said again. I said you will need to *rebuild* mod_perl
against 5.10: attempting to use a version built against 5.8 with perl
5.10 definitely won't work (this applies generally to any XS module).
The fact that versions <2.0.4 won't work with 5.10 even then I didn't
address (because I didn't know :) ).

Ben



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

Date: Sun, 20 Apr 2008 16:10:37 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <m1ve2cs2wy.fsf@dot-app.org>

Ben Morrow <ben@morrow.me.uk> writes:

> Quoth Sherman Pendley <spamtrap@dot-app.org>:
>> Ben Morrow <ben@morrow.me.uk> writes:
>> 
>> > Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
>> >> I have installed Perl 5.10.0 on my Linux box to be available together 
>> >> with the vendor supplied Perl 5.8.1. When running programs under 
>> >> mod_perl, the old Perl version is utilized.
>> >> 
>> >> How can I make mod_perl use Perl 5.10.0? Can mod_perl be configured so I 
>> >> can select Perl version on-the-fly?
>> >
>> > 5.10 is not binary-compatible with 5.8, so you will need to rebuild
>> > mod_perl against 5.10. AIUI, mod_perl needs to be rebuilt against a new
>> > version of perl anyway, as it does a lot of poking around in
>> > undocumented parts of perls guts.
>> 
>> That appears to no longer be the case - mod_perl 2.0.4 was released just a
>> couple days ago, and one of the listed changes is that "it works with 5.10."
>
> Read what I said again.

What you said makes no sense when taken at face value.

Ordinary XS modules are not binary-compatible, and need to be rebuilt - but
that's *always* the case, and it's not the result of using any undocumented
calls. Mod_perl does use undocumented calls, but it needed to be ported as
a result of that, not simply rebuilt.

I chose the most charitable interpretation that made sense - that you're
aware of the situation and simply mistyped "rebuild" when you were actually
referring to the porting effort.

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 22 Apr 2008 20:48:19 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: mod_perl and parallel Perl versions
Message-Id: <31s1e5-3051.ln1@osiris.mauzo.dyndns.org>


Quoth Sherman Pendley <spamtrap@dot-app.org>:
> Ben Morrow <ben@morrow.me.uk> writes:
> > Quoth Sherman Pendley <spamtrap@dot-app.org>:
> >> Ben Morrow <ben@morrow.me.uk> writes:
> >> >
> >> > 5.10 is not binary-compatible with 5.8, so you will need to rebuild
> >> > mod_perl against 5.10. AIUI, mod_perl needs to be rebuilt against a new
> >> > version of perl anyway, as it does a lot of poking around in
> >> > undocumented parts of perls guts.
> >> 
> >> That appears to no longer be the case - mod_perl 2.0.4 was released
> >> just a couple days ago, and one of the listed changes is that "it
> >> works with 5.10."
> >
> > Read what I said again.
> 
> What you said makes no sense when taken at face value.
> 
> Ordinary XS modules are not binary-compatible, and need to be rebuilt - but
> that's *always* the case, and it's not the result of using any undocumented
> calls. Mod_perl does use undocumented calls, but it needed to be ported as
> a result of that, not simply rebuilt.

OK, perhaps I should be clearer.

Perl versions 5.8.1 through 5.8.8 were considered 'binary-compatible' by
p5p. Most XS modules built against 5.8.1 will work correctly with 5.8.8
without rebuilding. This is not true of mod_perl: since it uses
undocumented calls, it requires rebuilding for *any* change in perl
version, even one advertised by p5p as 'binary-compatible'.

Perl version 5.10 is considered by p5p to break binary compatibility.
All XS modules, mod_perl included, will need to be rebuilt. Perl
versions 5.10.x will, almost certainly, be binary-compatible with
5.10.0, so again modules *other* than mod_perl won't need to be rebuilt.

In my original reply I confused the '5.10 is binary-incompatible with
5.8' and the 'mod_perl is never binary-compatible under any change in
perl version' parts of the above.

> I chose the most charitable interpretation that made sense - that you're
> aware of the situation and simply mistyped "rebuild" when you were actually
> referring to the porting effort.

Thank you for your charity :), but I wasn't and didn't. The
clarification is appreciated.

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


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