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

potential bug?

Expand Messages
  • Adam Weiss
    I ve been trying to use the dispatch_to static deployment method for a CGI server. Here is my server code: use SOAP::Transport::HTTP; use Mr::Module;
    Message 1 of 1 , May 22 11:57 PM
    • 0 Attachment
      I've been trying to use the dispatch_to static deployment method for a CGI
      server. Here is my server code:

      use SOAP::Transport::HTTP;


      use Mr::Module;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Mr::Module')
      -> handle;

      Whenever I hit it, I get a denied access to method in package main error.

      It's my understanding that if you use the static dispatch_to method,
      SOAPAction and the URI are pretty much irrelevant, as the dispatch_to
      method defines which module/package to dispatch to.

      The problem I'm encountering is that it appears that this isn't the case.
      Or there's a bug in Lite.pm that is preventing dispatch_to from working
      properly.

      From Lite.pm, line 2119: (my comments preceeded by ##>>)

      my($class, $static);
      ##>> $class is defined and is now empty

      # try to bind directly
      ##>> dispatch_with not defined, skip to else clause
      if (defined($class = $self->dispatch_with->{$method_uri}
      || $self->dispatch_with->{$action}
      || ($action =~ /^"(.+)"$/ ? $self->dispatch_with->{$1}
      : undef))) {
      # return object, nothing else to do here
      return ($class, $method_uri, $method_name) if ref $class;
      $static = 1;
      } else {

      ##>> pass this
      die "URI path shall map to class" unless defined ($class =
      URI->new($method_uri)->path);

      ##>> this sets $class to 'main'

      for ($class) { s!^/|/$!!g; s!/!::!g; s/^$/main/; }
      die "Failed to access class ($class)" unless $class =~ /^(\w[\w:]*)$/;

      my $fullname = "$class\::$method_name";

      ##>> finally we get to the part i'm interested in

      foreach ($self->dispatch_to) {
      ##>> $class is "main", the if statement here fails,
      ##>> this causes this return to be skipped and i think this is the
      ##>> section that appears to do the type of dispatching i'm
      ##>> interested in.
      ##>>
      ##>> if i comment out the end of the line, starting with the 'if'
      ##>> it fixes it. is this a bug?
      return ($_, $method_uri, $method_name) if ref eq $class; #

      ##>> this fixes it
      ##>> return ($_, $method_uri, $method_name); # if ref eq $class; #

      next if ref; # skip other objects
      # will ignore errors, because it may complain on
      # d:\foo\bar, which is PATH and not regexp
      eval {
      $static ||=
      $class =~ /^$_$/ || # MODULE
      $fullname =~ /^$_$/ || # MODULE::method
      $method_name =~ /^$_$/ && ($class eq 'main') # method ('main'
      assumed)
      ;
      };
      }
      }

      Either I don't understand this completely, or this is really a bug. Could
      someone please shed some light on the situation for me?

      Thanks in advance,

      --adam
    Your message has been successfully submitted and would be delivered to recipients shortly.