[Catalyst] Clash of the plugins: SubRequest vs Static::Simple

Marcus Ramberg marcus at thefeed.no
Wed Oct 5 09:25:40 CEST 2005


if this patch solves things for everyone involved, I'd be happy to apply it
and release a new version of subrequest. I imagine a patched NEXT will take
a little longer.

Please report back ;)

Marcus

On 10/5/05, Andy Grundman <andy at hybridized.org> wrote:
>
> Andy Grundman wrote:
> > Johan Lindström wrote:
> >
> >> At 00:29 2005-10-05, Andy Grundman wrote:
> >>
> >>> I'll try to duplicate this and write a failing test for
> >>> Static::Simple. Just looking at the code, I can't see anything
> >>> wrong, though.
> >>
> >>
> >>
> >> Attached is a simple Cat project that demonstrates the behaviour
> >> (note: Windows newlines).
> >>
> >> perl script\smurf_test.pl /bar/baz
> >> [just outputs text]
> >> ...
> >> in Bar::baz
> >>
> >> perl script\smurf_test.pl /bar/foo
> >> [calls /bar/baz as a subrequest and outputs some text with the result]
> >> ...
> >> in Bar::foo with subreq: (in Bar::baz)
> >>
> >> If you edit Smurf.pm <http://Smurf.pm> and add the Static::Simple, you
> get this instead:
> >> in Bar::foo with subreq: ()
> >>
> >> And if you'll trace after the breakpoint you'll see how
> >> Smurf::dispatch() is never called.
> >
> >
> > Thanks. I worked up a test that duplicates the issue which I just
> > committed. Unfortunately, it appears to be an issue with NEXT. When
> > subrequest calls $c->dispatch, NEXT has already seen the dispatch method
> > and therefore refuses to call it a second time.
> >
> > Tried this in sub_request():
> >
> > {
> > local $NEXT::SEEN = {};
> > $c->dispatch();
> > }
> >
> > but with no luck. There is probably a solution here with localizing the
> > proper NEXT data structure.
> >
> > I also changed my calls to NEXT::ACTUAL so it will die if it can't call
> > the dispatch method, rather than appearing to work and just returning
> > nothing.
>
> Aha! Thanks to mst, try this patch to SubRequest.pm and let me know if
> it works in your app.
>
> -Andy
>
>
> Index: SubRequest.pm
> ===================================================================
> --- SubRequest.pm (revision 1234)
> +++ SubRequest.pm (working copy)
> @@ -52,7 +52,12 @@
> $c->prepare_action();
> $c->log->debug("Subrequest to $path , action is ". $c->req->action )
> if $c->debug;
> - $c->dispatch();
> +
> + # hack NEXT so we can call all the dispatch methods
> + {
> + local $NEXT::NEXT{$c,'dispatch'};
> + $c->dispatch();
> + }
> my $output = $c->res->output;
> $c->req->{params}=$old_req{params};
> $c->req->arguments($old_req{args});
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
>
>


--
With regards
Marcus Ramberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051005/d293b68e/attachment-0001.htm


More information about the Catalyst mailing list