Loading ...
Sorry, an error occurred while loading the content.

RE: [soaplite] variable host names and port numbers

Expand Messages
  • Dan Muey
    ... I do this and it works for me : my $soap = SOAP::Lite - uri( http://www.simplemood.com/Uri_$uri_prxy ) - proxy( $http_prot ://$domain/$uri_prxy.cgi ) -
    Message 1 of 15 , Jan 29, 2003
    View Source
    • 0 Attachment
      >
      > Why can't I programatically define the host name and port
      > number? Statically it works, but dynamically I get the error:
      >
      > IO::Socket::INET: Bad hostname ':'
      >
      > -------- snip ----------
      >
      > #!/usr/bin/perl
      >
      > $host = 'localhost';
      > $port = 2000;
      >
      > use SOAP::Lite
      > +autodispatch =>
      > uri => 'http://wecan.com/',
      > proxy => "tcp://localhost:2000", # <--- works
      > #proxy => "tcp://$host:$port", # <--- NO work
      > on_fault => sub {
      > my($soap, $res) = @_;
      > die ref $res ? $res->faultdetail :
      > $soap->transport->status, "\n";
      > };

      I do this and it works for me :

      my $soap = SOAP::Lite
      -> uri("http://www.simplemood.com/Uri_$uri_prxy")
      -> proxy("$http_prot\://$domain/$uri_prxy.cgi")
      -> on_fault(sub { my($soap, $res) = @_;
      die ref $res ? $res->faultdetail :
      $soap->transport->status, "\n";
      });

      Only difference is I'm not doing autodispatch and I used ()
      instead of => which you may have to with autodispatch.
      Also I'm doing http and tcp.
      Not sure if any of those differences matter or not but that code works perfect for me.

      Dan

      >
      > my $child1 = Child->new('Fulko');
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
    • Keanan Smith
      A better way to do it would be: BEGIN { $host = localhost ; $port = 2000; } use SOAP::Lite +autodispatch = uri = http://wecan.com/ , proxy
      Message 2 of 15 , Jan 29, 2003
      View Source
      • 0 Attachment
        A better way to do it would be:


        BEGIN {
        $host = 'localhost';
        $port = 2000;
        }
        use SOAP::Lite
        +autodispatch =>
        uri => 'http://wecan.com/',
        proxy => "tcp://localhost:2000", # <--- works
        #proxy => "tcp://$host:$port", # <--- NO work
        on_fault => sub {
        my($soap, $res) = @_;
        die ref $res ? $res->faultdetail :
        $soap->transport->status, "\n";
        };



        That way your 'use' still happens at compile time (And compile-time errors
        are still caught at compile time), and the BEGIN block specifies that the
        host and port definition happen at compile time, before the 'use'

        Dan's example is a completely different approach, which is not using
        autodispatch, and is using the object oriented soap (Which means the SOAP
        pacakge gets compiled at compile time, but the proxy/port etc are done
        through methods at run time, rather than as arguments at compile time, and
        as a side effect, all of his definitions are local to his '$soap' object,
        whereas fulkohew is specifying defaults for *all* soap calls, the two are
        apples and oranges (Although yes, you have to use -> for method calls and =>
        to seperate arguments (Or alternately a comma))

        The eval method is one that works, but using evals unnessecarily is slower,
        and prone to bad quoting problems, there are good reasons to use evals, like
        when something that must be compiled isn't known at compile time, but
        overall, it's best to leave compile time tasks to their proper location :)


        -----Original Message-----
        From: Dan Muey [mailto:dmuey@...]
        Sent: Wednesday, January 29, 2003 8:04 AM
        To: fulkohew@...; soaplite@yahoogroups.com
        Subject: RE: [soaplite] variable host names and port numbers





        >
        > Why can't I programatically define the host name and port
        > number? Statically it works, but dynamically I get the error:
        >
        > IO::Socket::INET: Bad hostname ':'
        >
        > -------- snip ----------
        >
        > #!/usr/bin/perl
        >
        > $host = 'localhost';
        > $port = 2000;
        >
        > use SOAP::Lite
        > +autodispatch =>
        > uri => 'http://wecan.com/',
        > proxy => "tcp://localhost:2000", # <--- works
        > #proxy => "tcp://$host:$port", # <--- NO work
        > on_fault => sub {
        > my($soap, $res) = @_;
        > die ref $res ? $res->faultdetail :
        > $soap->transport->status, "\n";
        > };

        I do this and it works for me :

        my $soap = SOAP::Lite
        -> uri("http://www.simplemood.com/Uri_$uri_prxy")
        -> proxy("$http_prot\://$domain/$uri_prxy.cgi")
        -> on_fault(sub { my($soap, $res) = @_;
        die ref $res ? $res->faultdetail :
        $soap->transport->status, "\n";
        });

        Only difference is I'm not doing autodispatch and I used ()
        instead of => which you may have to with autodispatch.
        Also I'm doing http and tcp.
        Not sure if any of those differences matter or not but that code works
        perfect for me.

        Dan

        >
        > my $child1 = Child->new('Fulko');
        >
        >
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >
        >

        To unsubscribe from this group, send an email to:
        soaplite-unsubscribe@yahoogroups.com



        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • Sean.Meisner@VerizonWireless.com
        Now personally I don t like this approach because I like to put use strict as the first line after my shebang in every new perl file I start. This approach
        Message 3 of 15 , Jan 29, 2003
        View Source
        • 0 Attachment
          Now personally I don't like this approach because I like to put
          "use strict" as the first line after my shebang in every new perl
          file I start. This approach with the BEGIN violates strictures so
          you have to be sure to place the "use strict" after the "use SOAP::Lite".

          Generally I am suspicious of things that violate strictures. Not
          to say that this is an invalid way to do it, just that I personally
          wouldn't do it that way. I think the performance penalty of a single
          eval is negligible and to my mind the eval code is more "correct" as it
          does not violate strictures. Now if this snippet were in a loop somehow,
          you might see a noticable performance hit and in that case I would be more
          open to doing it without using eval.

          But I also see your point about the eval being prone to quoting problems :o)


          Cheers,

          Sean


          > -----Original Message-----
          > From: Keanan Smith [mailto:KSmith@...]
          > Sent: Wednesday, January 29, 2003 11:35 AM
          > To: soaplite@yahoogroups.com
          > Subject: RE: [soaplite] variable host names and port numbers
          >
          >
          > A better way to do it would be:
          >
          >
          > BEGIN {
          > $host = 'localhost';
          > $port = 2000;
          > }
          > use SOAP::Lite
          > +autodispatch =>
          > uri => 'http://wecan.com/',
          > proxy => "tcp://localhost:2000", # <--- works
          > #proxy => "tcp://$host:$port", # <--- NO work
          > on_fault => sub {
          > my($soap, $res) = @_;
          > die ref $res ? $res->faultdetail :
          > $soap->transport->status, "\n";
          > };
          >
          >
          >
          > That way your 'use' still happens at compile time (And
          > compile-time errors
          > are still caught at compile time), and the BEGIN block
          > specifies that the
          > host and port definition happen at compile time, before the 'use'
          >
          > Dan's example is a completely different approach, which is not using
          > autodispatch, and is using the object oriented soap (Which
          > means the SOAP
          > pacakge gets compiled at compile time, but the proxy/port etc are done
          > through methods at run time, rather than as arguments at
          > compile time, and
          > as a side effect, all of his definitions are local to his
          > '$soap' object,
          > whereas fulkohew is specifying defaults for *all* soap calls,
          > the two are
          > apples and oranges (Although yes, you have to use -> for
          > method calls and =>
          > to seperate arguments (Or alternately a comma))
          >
          > The eval method is one that works, but using evals
          > unnessecarily is slower,
          > and prone to bad quoting problems, there are good reasons to
          > use evals, like
          > when something that must be compiled isn't known at compile time, but
          > overall, it's best to leave compile time tasks to their
          > proper location :)
          >
          >
          > -----Original Message-----
          > From: Dan Muey [mailto:dmuey@...]
          > Sent: Wednesday, January 29, 2003 8:04 AM
          > To: fulkohew@...; soaplite@yahoogroups.com
          > Subject: RE: [soaplite] variable host names and port numbers
          >
          >
          >
          >
          >
          > >
          > > Why can't I programatically define the host name and port
          > > number? Statically it works, but dynamically I get the error:
          > >
          > > IO::Socket::INET: Bad hostname ':'
          > >
          > > -------- snip ----------
          > >
          > > #!/usr/bin/perl
          > >
          > > $host = 'localhost';
          > > $port = 2000;
          > >
          > > use SOAP::Lite
          > > +autodispatch =>
          > > uri => 'http://wecan.com/',
          > > proxy => "tcp://localhost:2000", # <--- works
          > > #proxy => "tcp://$host:$port", # <--- NO work
          > > on_fault => sub {
          > > my($soap, $res) = @_;
          > > die ref $res ? $res->faultdetail :
          > > $soap->transport->status, "\n";
          > > };
          >
          > I do this and it works for me :
          >
          > my $soap = SOAP::Lite
          > -> uri("http://www.simplemood.com/Uri_$uri_prxy")
          > -> proxy("$http_prot\://$domain/$uri_prxy.cgi")
          > -> on_fault(sub { my($soap, $res) = @_;
          > die ref $res ? $res->faultdetail :
          > $soap->transport->status, "\n";
          > });
          >
          > Only difference is I'm not doing autodispatch and I used ()
          > instead of => which you may have to with autodispatch.
          > Also I'm doing http and tcp.
          > Not sure if any of those differences matter or not but that code works
          > perfect for me.
          >
          > Dan
          >
          > >
          > > my $child1 = Child->new('Fulko');
          > >
          > >
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@yahoogroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > > http://docs.yahoo.com/info/terms/
          > >
          > >
          > >
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/


          To unsubscribe from this group, send an email to:
          soaplite-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        • fulkohew <fulkohew@yahoo.com>
          Why can t I programatically define the host name and port number? Statically it works, but dynamically I get the error: IO::Socket::INET: Bad hostname : ...
          Message 4 of 15 , Jan 29, 2003
          View Source
          • 0 Attachment
            Why can't I programatically define the host name and port number?
            Statically it works, but dynamically I get the error:

            IO::Socket::INET: Bad hostname ':'

            -------- snip ----------

            #!/usr/bin/perl

            $host = 'localhost';
            $port = 2000;

            use SOAP::Lite
            +autodispatch =>
            uri => 'http://wecan.com/',
            proxy => "tcp://localhost:2000", # <--- works
            #proxy => "tcp://$host:$port", # <--- NO work
            on_fault => sub {
            my($soap, $res) = @_;
            die ref $res ? $res->faultdetail :
            $soap->transport->status, "\n";
            };

            my $child1 = Child->new('Fulko');
          • Keanan Smith
            Heh, so me and Sean.Meisner were discussing how this example could be fixed up to work with use strict basically the crux of the issue is that $host and
            Message 5 of 15 , Jan 29, 2003
            View Source
            • 0 Attachment
              Heh, so me and Sean.Meisner were discussing how this example could be fixed
              up to work with 'use strict' basically the crux of the issue is that
              $host and $port are global variables, but under 'use strict' you need to
              either fully-qualify all global variable names (I.e. change them all to
              $main::host and $main::port) or have the variable be under the influence of
              an 'our' (Which is the equivalent of a 'my' but for global variables)
              The simplest and cleanest way is probably:

              use strict;
              our ($host,$port);
              BEGIN {
              $host = 'localhost';
              $port = 2000;
              }
              use SOAP::Lite
              +autodispatch =>
              uri => 'http://wecan.com/',
              proxy => "tcp://localhost:2000", # <--- works
              #proxy => "tcp://$host:$port", # <--- NO work
              on_fault => sub {
              my($soap, $res) = @_;
              die ref $res ? $res->faultdetail :
              $soap->transport->status, "\n";
              };

              Which is odd, because the 'our' keyword is *outside* the BEGIN block, and
              you would think that would imply that the 'our' would only happen at
              run-time, so you would be back to square 1, but 'our' (and 'my' for that
              matter) happen at compile-time (weirdly, but it's obvious that scope
              definitions need to happen at compile-time if you think about it)

              To make things even slightly more obfuscated
              use strict;
              BEGIN {
              our ($host,$port);
              $host = 'localhost';
              $port = 2000;
              }

              Breaks, because the 'our' is trying to be lexically scoped inside of the
              BEGIN block, meaning the variables in question should be imported into it
              (Which is nonsensical in this context, but nevertheless that's what's
              expected by 'use strict') (And to boot, the $host and $port used later on
              aren't under the influence of the 'our' because they fall outside of it's
              scope, weird eh?)

              Anyway, 'use strict' is often times too strict for the casual Perl user
              (Which many of the people who post to this group are) and I think we're
              getting a little carried away with details that most people won't care a bit
              about :)

              -----Original Message-----
              From: Keanan Smith [mailto:KSmith@...]
              Sent: Wednesday, January 29, 2003 9:35 AM
              To: soaplite@yahoogroups.com
              Subject: RE: [soaplite] variable host names and port numbers


              A better way to do it would be:


              BEGIN {
              $host = 'localhost';
              $port = 2000;
              }
              use SOAP::Lite
              +autodispatch =>
              uri => 'http://wecan.com/',
              proxy => "tcp://localhost:2000", # <--- works
              #proxy => "tcp://$host:$port", # <--- NO work
              on_fault => sub {
              my($soap, $res) = @_;
              die ref $res ? $res->faultdetail :
              $soap->transport->status, "\n";
              };



              That way your 'use' still happens at compile time (And compile-time errors
              are still caught at compile time), and the BEGIN block specifies that the
              host and port definition happen at compile time, before the 'use'

              Dan's example is a completely different approach, which is not using
              autodispatch, and is using the object oriented soap (Which means the SOAP
              pacakge gets compiled at compile time, but the proxy/port etc are done
              through methods at run time, rather than as arguments at compile time, and
              as a side effect, all of his definitions are local to his '$soap' object,
              whereas fulkohew is specifying defaults for *all* soap calls, the two are
              apples and oranges (Although yes, you have to use -> for method calls and =>
              to seperate arguments (Or alternately a comma))

              The eval method is one that works, but using evals unnessecarily is slower,
              and prone to bad quoting problems, there are good reasons to use evals, like
              when something that must be compiled isn't known at compile time, but
              overall, it's best to leave compile time tasks to their proper location :)


              -----Original Message-----
              From: Dan Muey [mailto:dmuey@...]
              Sent: Wednesday, January 29, 2003 8:04 AM
              To: fulkohew@...; soaplite@yahoogroups.com
              Subject: RE: [soaplite] variable host names and port numbers





              >
              > Why can't I programatically define the host name and port
              > number? Statically it works, but dynamically I get the error:
              >
              > IO::Socket::INET: Bad hostname ':'
              >
              > -------- snip ----------
              >
              > #!/usr/bin/perl
              >
              > $host = 'localhost';
              > $port = 2000;
              >
              > use SOAP::Lite
              > +autodispatch =>
              > uri => 'http://wecan.com/',
              > proxy => "tcp://localhost:2000", # <--- works
              > #proxy => "tcp://$host:$port", # <--- NO work
              > on_fault => sub {
              > my($soap, $res) = @_;
              > die ref $res ? $res->faultdetail :
              > $soap->transport->status, "\n";
              > };

              I do this and it works for me :

              my $soap = SOAP::Lite
              -> uri("http://www.simplemood.com/Uri_$uri_prxy")
              -> proxy("$http_prot\://$domain/$uri_prxy.cgi")
              -> on_fault(sub { my($soap, $res) = @_;
              die ref $res ? $res->faultdetail :
              $soap->transport->status, "\n";
              });

              Only difference is I'm not doing autodispatch and I used ()
              instead of => which you may have to with autodispatch.
              Also I'm doing http and tcp.
              Not sure if any of those differences matter or not but that code works
              perfect for me.

              Dan

              >
              > my $child1 = Child->new('Fulko');
              >
              >
              >
              > To unsubscribe from this group, send an email to:
              > soaplite-unsubscribe@yahoogroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to
              > http://docs.yahoo.com/info/terms/
              >
              >
              >

              To unsubscribe from this group, send an email to:
              soaplite-unsubscribe@yahoogroups.com



              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


              To unsubscribe from this group, send an email to:
              soaplite-unsubscribe@yahoogroups.com



              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            • Dan Muey
              I have a quick question about a SOPA::Lite Server. Is therea way to set variables for the whole package so that they can be used by any subroutine? Example ::
              Message 6 of 15 , Jan 29, 2003
              View Source
              • 0 Attachment
                I have a quick question about a SOPA::Lite Server.

                Is therea way to set variables for the whole package so that they can be used by any subroutine?

                Example ::

                package JoeMama;

                my $user = $ENV{'REMOTE_USER'};
                my ($this, $that, $the_other) = set_defaults($user);

                sub hello {
                return "$the_other is $this";
                }

                sub goodbye {
                return "$this is $that";
                }

                sub set_defaults {

                Blah blah blah
                }

                So that when they call the routines they can use those vars without me having to set them each time within the routine.

                IE

                sub hello {
                my $user = $ENV{'REMOTE_USER'};
                my ($this, $that, $the_other) = set_defaults($user);
                return "$the_other is $this";
                }

                sub goodbye {
                my $user = $ENV{'REMOTE_USER'};
                my ($this, $that, $the_other) = set_defaults($user);
                return "$this is $that";
                }

                This will work it's just harder to manage a package that may have 50 routines in it. That'd be 100 lines of code in the second example vs. 2 lines in the top example or at least 50 if you made it into a single line call.

                I could have the client call a routine to set them and then pass them to each routine called after that but that too would be more overhead and make more room for errors.

                Thanks!

                Dan
              • Dan Muey
                Thanks I ll give that a go and see how it does!
                Message 7 of 15 , Jan 29, 2003
                View Source
                • 0 Attachment
                  Thanks I'll give that a go and see how it does!

                  > -----Original Message-----
                  > From: Keanan Smith [mailto:KSmith@...]
                  > Sent: Wednesday, January 29, 2003 12:35 PM
                  > To: soaplite@yahoogroups.com
                  > Subject: RE: [soaplite] variable host names and port numbers
                  >
                  >
                  > Try this in your SOAP::Lite creation:
                  >
                  > use SOAP::Transport::Whatever
                  > on_action =>
                  > sub {
                  > $JoeMama::user = $ENV{'REMOTE_USER'};
                  > ($JoeMama::this, $JoeMama::that, $JoeMama::the_other) =
                  > set_defaults($JoeMama::user);
                  > };
                  >
                  > I'm not sure if it will work, but simply setting it in the
                  > package will
                  > *not* work reliably, as the package isn't always re-read
                  > during each soap call (Depending on your server
                  > implementation), but the on_action is called every time a
                  > SOAP request happens.
                  >
                  > -----Original Message-----
                  > From: Dan Muey [mailto:dmuey@...]
                  > Sent: Wednesday, January 29, 2003 11:08 AM
                  > To: Keanan Smith; soaplite@yahoogroups.com
                  > Subject: RE: [soaplite] variable host names and port numbers
                  >
                  >
                  > I have a quick question about a SOPA::Lite Server.
                  >
                  > Is therea way to set variables for the whole package so that
                  > they can be used by any subroutine?
                  >
                  > Example ::
                  >
                  > package JoeMama;
                  >
                  > my $user = $ENV{'REMOTE_USER'};
                  > my ($this, $that, $the_other) = set_defaults($user);
                  >
                  > sub hello {
                  > return "$the_other is $this";
                  > }
                  >
                  > sub goodbye {
                  > return "$this is $that";
                  > }
                  >
                  > sub set_defaults {
                  >
                  > Blah blah blah
                  > }
                  >
                  > So that when they call the routines they can use those vars
                  > without me having to set them each time within the routine.
                  >
                  > IE
                  >
                  > sub hello {
                  > my $user = $ENV{'REMOTE_USER'};
                  > my ($this, $that, $the_other) = set_defaults($user);
                  > return "$the_other is $this";
                  > }
                  >
                  > sub goodbye {
                  > my $user = $ENV{'REMOTE_USER'};
                  > my ($this, $that, $the_other) = set_defaults($user);
                  > return "$this is $that";
                  > }
                  >
                  > This will work it's just harder to manage a package that may
                  > have 50 routines in it. That'd be 100 lines of code in the
                  > second example vs. 2 lines in the top example or at least 50
                  > if you made it into a single line call.
                  >
                  > I could have the client call a routine to set them and then
                  > pass them to each routine called after that but that too
                  > would be more overhead and make more room for errors.
                  >
                  > Thanks!
                  >
                  > Dan
                  >
                  > To unsubscribe from this group, send an email to:
                  > soaplite-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to
                  > http://docs.yahoo.com/info/terms/
                  >
                  >
                  >
                • Keanan Smith
                  Try this in your SOAP::Lite creation: use SOAP::Transport::Whatever on_action = sub { $JoeMama::user = $ENV{ REMOTE_USER }; ($JoeMama::this, $JoeMama::that,
                  Message 8 of 15 , Jan 29, 2003
                  View Source
                  • 0 Attachment
                    Try this in your SOAP::Lite creation:

                    use SOAP::Transport::Whatever
                    on_action =>
                    sub {
                    $JoeMama::user = $ENV{'REMOTE_USER'};
                    ($JoeMama::this, $JoeMama::that, $JoeMama::the_other) =
                    set_defaults($JoeMama::user);
                    };

                    I'm not sure if it will work, but simply setting it in the package will
                    *not* work reliably, as the package isn't always re-read during each soap
                    call (Depending on your server implementation), but the on_action is called
                    every time a SOAP request happens.

                    -----Original Message-----
                    From: Dan Muey [mailto:dmuey@...]
                    Sent: Wednesday, January 29, 2003 11:08 AM
                    To: Keanan Smith; soaplite@yahoogroups.com
                    Subject: RE: [soaplite] variable host names and port numbers


                    I have a quick question about a SOPA::Lite Server.

                    Is therea way to set variables for the whole package so that they can be
                    used by any subroutine?

                    Example ::

                    package JoeMama;

                    my $user = $ENV{'REMOTE_USER'};
                    my ($this, $that, $the_other) = set_defaults($user);

                    sub hello {
                    return "$the_other is $this";
                    }

                    sub goodbye {
                    return "$this is $that";
                    }

                    sub set_defaults {

                    Blah blah blah
                    }

                    So that when they call the routines they can use those vars without me
                    having to set them each time within the routine.

                    IE

                    sub hello {
                    my $user = $ENV{'REMOTE_USER'};
                    my ($this, $that, $the_other) = set_defaults($user);
                    return "$the_other is $this";
                    }

                    sub goodbye {
                    my $user = $ENV{'REMOTE_USER'};
                    my ($this, $that, $the_other) = set_defaults($user);
                    return "$this is $that";
                    }

                    This will work it's just harder to manage a package that may have 50
                    routines in it. That'd be 100 lines of code in the second example vs. 2
                    lines in the top example or at least 50 if you made it into a single line
                    call.

                    I could have the client call a routine to set them and then pass them to
                    each routine called after that but that too would be more overhead and make
                    more room for errors.

                    Thanks!

                    Dan
                  • fulkohew <fulkohew@yahoo.com>
                    ... Thanks! That indeed works. I had tried everything under the sun, but I had forgotten about the scopping issue with the braces, so I tried making them main
                    Message 9 of 15 , Jan 30, 2003
                    View Source
                    • 0 Attachment
                      > A better way to do it would be:
                      >
                      > our ($host, $port);
                      > BEGIN {
                      > $host = 'localhost';
                      > $port = 2000;
                      > }

                      Thanks! That indeed works. I had tried everything under the sun, but
                      I had forgotten about the scopping issue with the braces, so I tried
                      making them main package scopped using $::host, then I my'ed them, but
                      the real answer is to use 'our'.

                      So then I thought I'd have them out in a file I'd 'require' in so I
                      could have the same definition file for both client and server apps

                      But you'd have to put the require into a BEGIN block and that
                      effectively puts the 'our' into a nested begin block, and then we're
                      back to where we started from. :-(

                      As for:

                      use strict;
                      use warnings;

                      Yes, of course, but I was trying to give the shortest possible
                      snippet of code, but...

                      If I use warnings, then every class method invoked as a remote call
                      generates a warning msg:

                      Use of inherited AUTOLOAD for non-method Child::get_count() is
                      deprecated at ./client line 45.

                      Comments?
                    • Sean.Meisner@VerizonWireless.com
                      What version of Perl are you using, on what OS? I m not seeing that behaviour in the autodispatching client I run on Linux and Solaris, using 5.6.1 and 5.6.0
                      Message 10 of 15 , Jan 30, 2003
                      View Source
                      • 0 Attachment
                        What version of Perl are you using, on what OS?

                        I'm not seeing that behaviour in the autodispatching client I
                        run on Linux and Solaris, using 5.6.1 and 5.6.0 respectively.

                        Cheers,

                        Sean


                        > -----Original Message-----
                        > From: fulkohew <fulkohew@...> [mailto:fulkohew@...]
                        > Sent: Thursday, January 30, 2003 9:51 AM
                        > To: soaplite@yahoogroups.com
                        > Subject: [soaplite] Re: variable host names and port numbers
                        >
                        >
                        > > A better way to do it would be:
                        > >
                        > > our ($host, $port);
                        > > BEGIN {
                        > > $host = 'localhost';
                        > > $port = 2000;
                        > > }
                        >
                        > Thanks! That indeed works. I had tried everything under the sun, but
                        > I had forgotten about the scopping issue with the braces, so I tried
                        > making them main package scopped using $::host, then I my'ed them, but
                        > the real answer is to use 'our'.
                        >
                        > So then I thought I'd have them out in a file I'd 'require' in so I
                        > could have the same definition file for both client and server apps
                        >
                        > But you'd have to put the require into a BEGIN block and that
                        > effectively puts the 'our' into a nested begin block, and then we're
                        > back to where we started from. :-(
                        >
                        > As for:
                        >
                        > use strict;
                        > use warnings;
                        >
                        > Yes, of course, but I was trying to give the shortest possible
                        > snippet of code, but...
                        >
                        > If I use warnings, then every class method invoked as a remote call
                        > generates a warning msg:
                        >
                        > Use of inherited AUTOLOAD for non-method Child::get_count() is
                        > deprecated at ./client line 45.
                        >
                        > Comments?
                        >
                        >
                        >
                        > To unsubscribe from this group, send an email to:
                        > soaplite-unsubscribe@yahoogroups.com
                        >
                        >
                        >
                        > Your use of Yahoo! Groups is subject to
                        > http://docs.yahoo.com/info/terms/
                        >
                        >
                      • fulkohew <fulkohew@yahoo.com>
                        ... I m currently developing on 5.6.1 on Linux (RedHat 7.2) I ll try to get and post another code snippet to show as an example.
                        Message 11 of 15 , Jan 30, 2003
                        View Source
                        • 0 Attachment
                          --- In soaplite@yahoogroups.com, Sean.Meisner@V... wrote:

                          > What version of Perl are you using, on what OS?
                          >
                          > I'm not seeing that behaviour in the autodispatching client I
                          > run on Linux and Solaris, using 5.6.1 and 5.6.0 respectively.

                          I'm currently developing on 5.6.1 on Linux (RedHat 7.2)
                          I'll try to get and post another code snippet to show as an example.

                          ... snip ...

                          > > From: fulkohew <fulkohew@y...> [mailto:fulkohew@y...]
                          > > Sent: Thursday, January 30, 2003 9:51 AM

                          > > As for:
                          > >
                          > > use strict;
                          > > use warnings;
                          > >
                          > > Yes, of course, but I was trying to give the shortest possible
                          > > snippet of code, but...
                          > >
                          > > If I use warnings, then every class method invoked as a remote
                          > > call generates a warning msg:
                          > >
                          > > Use of inherited AUTOLOAD for non-method Child::get_count() is
                          > > deprecated at ./client line 45.
                        • quinn@fetter.org
                          ... The problem is that autodispatch relies on AUTOLOAD. If a function or method can t be found in your local code, SOAP::Lite s AUTOLOAD gets invoked and
                          Message 12 of 15 , Jan 30, 2003
                          View Source
                          • 0 Attachment
                            On Thu, Jan 30, 2003 at 02:50:57PM -0000, fulkohew <fulkohew@...> wrote:

                            > If I use warnings, then every class method invoked as a remote call
                            > generates a warning msg:
                            >
                            > Use of inherited AUTOLOAD for non-method Child::get_count() is
                            > deprecated at ./client line 45.

                            The problem is that autodispatch relies on AUTOLOAD. If a function or
                            method can't be found in your local code, SOAP::Lite's AUTOLOAD gets
                            invoked and sends it as a SOAP call. However, the use of AUTOLOAD for
                            vanilla subroutines (as opposed to methods) is deprecated as of Perl
                            5.6.

                            Luckily, Perl 5.6 introduces different "classes" of warnings, so you can
                            selectively turn off deprecated warnings like this:

                            use warnings;
                            #Don't warn me about the use of AUTOLOAD for non-method subroutines,
                            #because SOAP::Lite's autodispatch depends on that "accidental feature"
                            no warnings "deprecated";
                            use strict;

                            That's what I do in my code, which is running in Perl 5.6.1 on Solaris.
                            An unfortunate side effect is that you won't see warnings for any other
                            deprecated features, either. :(

                            I understand that Perl 5.8 actually does away with this behavior of AUTOLOAD
                            --that is, it invokes AUTOLOAD only when dispatching methods, not when
                            "dispatching" or resolving regular subroutines. Does anyone know how
                            SOAP::Lite works around this?

                            ---
                            qw (Quinn Weaver); #President, San Francisco Perl Mongers
                            =for information, visit http://sf.pm.org/ =cut
                          Your message has been successfully submitted and would be delivered to recipients shortly.