Ian Langworth wrote:
I've written a provider and it appears that AxKit likes to call
it (rather, &init and &strref) twice when I POST to a URI that
it handles. There's no redirection and the $r->{args} and such
are all the same.

Is there a simple explanation for this, or should I provide
a few more buckets of detail?


Hi Ian,


The short answer is that get_strref() is called once when the Provider base class examines the source XML for its root element name, doctype, xml-stylesheet processing instructions, and so on while finding matching styles to apply, and once when the content is pulled in by the first Language module in the processing chain. This is a known issue that will be addressed in the next release. In the meantime, I suggest something like the following:

sub get_strref {
    my $self = shift;
    if ( defined( $self->{_RESULT_} )) {
        return $self->{_RESULT_};
    }

# code that generates XML and stores it in $string

    $self->{_RESULT_} = \$string;
    return \$string;
}

or, you could generate the result during the process() method, save it as class data in $self and just return a reference to it from get_strref().

Either way, get_strref() will still get called twice (until the fix is released) but you can avoid the overhead of generating the content twice.

I haven't seen a case where init() gets called twice, we'll have to investigate and get back to you.

Cheers,
-kip


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to