Re: Problem to execute "sidecar" Perl scripts when compiling POE::Component::Resolver 0.912 with PAR

[email protected] (Markus Jansen) Fri, 15 Jul 2011 12:17:56 +0200
Newsgroups perl.poe
Message-ID <4682B762ECD8E9428E39B8ED2EEDF3EA016B604506@ESESSCMS0365.eemea.ericsson.se>
Hi Rocco,

based on the excellent input I got so far from you and Steffen, I have now found a simple solution on the POE side
without any assumptions towards PAR (or whatever special system used, even with PAR there is more than one way to do it :-).

The idea is simply to make $sidecar_program configurable, and leave the solution details to the application if special ones are needed.
Find a possible [tested] patch below, and please consider it for integration in POE::Component::Resolver 0.913.

Best regards,

        Markus


> diff -c /vobs/cc/CCA-perl01/perl5_SunOS_sparc________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Resolver.pm perl5/POE/Component/Resolver.pm
*** /vobs/cc/CCA-perl01/perl5_SunOS_sparc________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Resolver.pm        Wed May  4 04:39:59 2011
--- perl5/POE/Component/Resolver.pm     Fri Jul 15 12:10:03 2011
***************
*** 24,31 ****
        croak "new() requires an even number of parameters" if @args % 2;
        my %args = @args;

!       my $max_resolvers = delete($args{max_resolvers}) || 8;
!       my $idle_timeout  = delete($args{idle_timeout})  || 15;

        my $af_order = delete($args{af_order});
        if (defined $af_order and @$af_order) {
--- 24,32 ----
        croak "new() requires an even number of parameters" if @args % 2;
        my %args = @args;

!       my $max_resolvers   = delete($args{max_resolvers}) || 8;
!       my $idle_timeout    = delete($args{idle_timeout})  || 15;
!       my $sidecar_program = delete($args{sidecar_program});

        my $af_order = delete($args{af_order});
        if (defined $af_order and @$af_order) {
***************
*** 73,78 ****
--- 74,80 ----
                        max_resolvers   => $max_resolvers,
                        requests        => { },
                        sidecar_ring    => [ ],
+                       sidecar_program => $sidecar_program,
                }
        );

***************
*** 193,199 ****
                        StderrEvent  => 'sidecar_error',
                        CloseEvent   => 'sidecar_closed',
                        Program      => (
!                               ($^O eq "MSWin32")
                                ? \&POE::Component::Resolver::Sidecar::main
                                : [
                                        $^X,
--- 195,203 ----
                        StderrEvent  => 'sidecar_error',
                        CloseEvent   => 'sidecar_closed',
                        Program      => (
!                               defined $heap->{sidecar_program}
!                               ? $heap->{sidecar_program}
!                               : ($^O eq "MSWin32")
                                ? \&POE::Component::Resolver::Sidecar::main
                                : [
                                        $^X,
***************
*** 444,449 ****
--- 448,454 ----
                max_resolvers => 8,
                idle_timeout  => 5,
                af_order      => [ AF_INET6, AF_INET ],
+               # sidecar_program => $resolver_sidecar_program,
        );

        my @hosts = qw( ipv6-test.com );
***************
*** 496,502 ****
  Create a new resolver.  Returns an object that must be held and used
  to make requests.  See the synopsis.

! Accepts up to two optional named parameters.

  "af_order" may contain an arrayref with the address families to
  permit, in the order in which they're preferred.  Without "af_order",
--- 501,507 ----
  Create a new resolver.  Returns an object that must be held and used
  to make requests.  See the synopsis.

! Accepts up to four optional named parameters.

  "af_order" may contain an arrayref with the address families to
  permit, in the order in which they're preferred.  Without "af_order",
***************
*** 524,529 ****
--- 529,538 ----
        # One at a time, but without the pesky blocking.
        my $r3 = POE::Component::Resolver->new( max_resolvers => 1 );

+ "sidecar_program" controls how to start up a sidecar process;
+ this parameter is needed only in special environments such as PAR.
+ Solutions can be easily derived from the default code.
+
  =head3 resolve

  resolve() begins a new request to resolve a domain.  The request will



Markus Jansen

Ericsson GmbH
Eurolab R&D
Ericsson Allee 1
52134 Herzogenrath, Germany
Phone +49 2407 575 5157
Fax +49 22407 575 150
Mobile +49 172 2742003
[email protected]
www.ericsson.com



Ericsson GmbH. Sitz: Düsseldorf. Registergericht: Amtsgericht Düsseldorf, HRB 33012. Geschäftsführer: Stefan Koetz (Vors.), Nils de Baar, Bernd Schmidt. Aufsichtsratsvorsitzender: Anders Runevad.

This Communication is confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>.
Picture (Metafile) 1.jpg (image/jpeg, 1011 B) - not displayed
Picture (Metafile) 2.jpg (image/jpeg, 2.6 KB) - not displayed