Lo,

I've had a look at the webmail example and am not much the wiser.
Could someone have a look at my plugin and give me a big kick in
the right direction so I can make it use continuations please?

I've made a bit of a start, but am confused as to the correct way
of doing things...

use Firstb2b::Acme;
use Data::Dumper;

sub init {
    &{$Firstb2b::Acme::subref};
}

sub register {
    my $self = shift;
    $self->register_hook('xmlresponse' => 'hook_xmlresponse1');
    $self->register_hook('xmlresponse' => 'hook_xmlresponse2');
}

sub hook_xmlresponse2 {
    my ($self, $input) = @_;
    $self->log(LOGDEBUG, "\n\nXMLRESPONSE 2\n\n");
    if ($self->client->notes('xml_response') == OK) {
        return OK, $input;
    }
    return $self->client->notes('xml_response');
}

sub hook_xmlresponse1 {

    my ($self, $input) = @_;

    my ( $dom, $sub, $bl, $uri );

    my $client = $self->client;

    $self->log(LOGDEBUG, "\n\nXMLRESPONSE 1\n\n");

    $client->notes('xml_response', DECLINED);

    if ( $client->headers_in->filename =~ 
/\.(?i:png|gif|css|jpg|js|html)$/ ) {
        $self->log(LOGDEBUG, 'Declined: '.
$client->headers_in->filename);
        return DECLINED;
    }

    $bl = Firstb2b::Acme->new( $self );

    $sub = 'state_'.$bl->get_state;

    $dom = $bl->$sub;

    return REDIRECT if $dom == REDIRECT;

    $input->dom( $dom );

    my $styles = $bl->get_stylesheets( { state      => $bl->get_state,
                                         is_pop     => scalar 
$self->client->param( 'is_pop'  ) ,
                                         pop_id     => scalar 
$self->client->param( 'pop_id'  ) ,
                                         pop_text   => scalar 
$self->client->param( 'pop_text') ,
                                         use_pop_js => scalar 
$self->client->param( 'use_pop_js') } );

    my $out = $input->transform(map XSLT( $_->{style}, %{$_->{params}} 
), @{$styles});

    return OK, $out;

} # hook_xmlresponse1



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

Reply via email to