On Sun, Jan 26, 2003 at 10:23:51PM +0000, Matt Sergeant wrote:
> On Sunday, Jan 26, 2003, at 21:49 Europe/London, Nik Clayton wrote:
> 
> >The entries in the log file from a freshly started Apache look like
> >this:
> >
> >    [AxKit] fast handler called for /pics/Boat/
> >    [AxKit] Running plugin: Apache::AxKit::Plugin::QueryStringCache
> >    [AxKit] Running plugin: AxKit::App::Gallery::Plugin
> >    In the plugin handler
> >    [AxKit] Plugin returned non-OK value
> >    File does not exist: /home/nik/src/AxKit-Gallery/web/Boat/
> 
> Here you're returning DECLINED for a directory. Don't do that. Only 
> ever return DECLINED for a file.

Ah ha!  One down, one to go :-)  The plugin now works, and variations of
foo.jpg?size=mumble does the right thing.

I've followed your suggestions for the provider.  Since my custom
provider will be generating XML each time, and the XML won't be stored
on disk, I figure that subclassing from the pre-existing ::Provider::Scalar 
and relying on it to do almost all the work makes most sense.  So that's 
what I've done.

My Provider.pm looks like this:

    package AxKit::App::Gallery::Provider;

    use Apache::AxKit::Provider::Scalar;
    use base qw(Apache::AxKit::Provider::Scalar);

    sub get_strref {
        my $self = shift;
        my $r    = $self->{apache};
        
        # Not sure if this test is necessary -- the plugin should 
        # already have refused to handle the request if the content
        # type wasn't right
        return $self->SUPER::get_strref()
            unless substr($r->content_type(), 0, 6) eq 'image/';

        # Some test XML to make sure things work and this XML makes
        # it back to the browser
        my $xml = <<EOXML;
<?xml version="1.0"?>
<foo><bar/></foo>
EOXML

        return \$xml;
    }

    1;

With the following line in httpd.conf

    AxContentProvider AxKit::App::Gallery::Provider

With a fresh server ('apachectl stop; sleep 2; apachectl start'), and
requesting a .jpg file from a directory that's covered by the axkit
Apache config, gives an internal server error, and the following log.

[Tue Jan 28 20:25:49 2003] [notice] Apache/1.3.27 (Unix) AxKit/1.6_02 mod_perl/1.27 
configured -- resuming normal operations
[Tue Jan 28 20:25:49 2003] [notice] Accept mutex: flock (Default: flock)
[Tue Jan 28 20:25:56 2003] [warn] [client 127.0.0.1] [AxKit] fast handler called for 
/pics/Boat/P0000425.JPG
[Tue Jan 28 20:25:56 2003] [warn] [client 127.0.0.1] [AxKit] Running plugin: 
Apache::AxKit::Plugin::QueryStringCache
[Tue Jan 28 20:25:56 2003] [warn] [client 127.0.0.1] [AxKit] Running plugin: 
AxKit::App::Gallery::Plugin
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] Content Provider 
Override: AxKit::App::Gallery::Provider
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] checking if we process 
this resource
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] media: screen, preferred 
style: #default
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] Cache: key = 
3b5196deefdce733e55dd19d81f5ef66
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] getting styles and 
external entities from the XML
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] styles not cached - 
calling $provider->get_styles()
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] resetting cache with no 
preferred style (#default ne )
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] Cache: key = 
2181741297a986f1b062e081d52510e1
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] cache doesn't exist
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] some condition failed. 
recreating output
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] styles: ()
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] Style Provider Override: 
Apache::AxKit::Provider::File
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] decoding from UTF-8
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] [req] File Provider given 
$r: /home/nik/src/AxKit-Gallery/web/Boat/P0000425.JPG
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] about to execute: 
::handler
[Tue Jan 28 20:25:57 2003] [warn] [client 127.0.0.1] [AxKit] Caught an exception
[Tue Jan 28 20:25:57 2003] [error] [client 127.0.0.1] [AxKit] [Error] 
AxKit::load_module failed: Can't locate .pm in @INC (@INC contains: 
/home/nik/src/AxKit-Gallery/lib /usr/local/lib/site_perl/5.6.1/i386-freebsd 
/home/nik/lib/lib/site_perl/5.6.0 /home/nik/lib/lib/site_perl/site_perl/5.6.0 
/usr/local/lib/perl5/site_perl/5.6.1/mach /usr/local/lib/perl5/site_perl/5.6.1 
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 
/usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.6.1/BSDPAN 
/usr/local/lib/perl5/5.6.1/mach /usr/local/lib/perl5/5.6.1 . /usr/local/ 
/usr/local/lib/perl) at (eval 14) line 1.

[Tue Jan 28 20:25:57 2003] [error] [client 127.0.0.1] [AxKit] From: 
/usr/local/lib/perl5/site_perl/5.6.1/mach/Apache/AxKit/Exception.pm : 9
[Tue Jan 28 20:25:57 2003] [error] [client 127.0.0.1] [AxKit] [Backtrace] 
AxKit::load_module failed: Can't locate .pm in @INC (@INC contains: 
/home/nik/src/AxKit-Gallery/lib /usr/local/lib/site_perl/5.6.1/i386-freebsd 
/home/nik/lib/lib/site_perl/5.6.0 /home/nik/lib/lib/site_perl/site_perl/5.6.0 
/usr/local/lib/perl5/site_perl/5.6.1/mach /usr/local/lib/perl5/site_perl/5.6.1 
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 
/usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.6.1/BSDPAN 
/usr/local/lib/perl5/5.6.1/mach /usr/local/lib/perl5/5.6.1 . /usr/local/ 
/usr/local/lib/perl) at (eval 14) line 1.
        Apache::AxKit::Exception::new('Apache::AxKit::Exception::Error', '-text', 
'AxKit::load_module failed: Can\'t locate .pm in @INC (@INC conta...') called at 
/usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 966
        AxKit::prep_exception('AxKit::load_module failed: Can\'t locate .pm in @INC 
(@INC conta...') called at /usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 162
        AxKit::__ANON__('AxKit::load_module failed: Can\'t locate .pm in @INC (@INC 
conta...') called at /usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 708
        AxKit::process_request('AxKit::Apache=SCALAR(0x82c8860)', 
'AxKit::App::Gallery::Provider=HASH(0x82c8974)', 'ARRAY(0x82a63a8)', undef) called at 
/usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 461
        AxKit::run_axkit_engine('AxKit::Apache=SCALAR(0x82c8860)', 
'AxKit::App::Gallery::Provider=HASH(0x82c8974)') called at 
/usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 288
        eval {...} called at /usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 
279
        AxKit::main_handler('AxKit::Apache=SCALAR(0x82c8860)', 
'AxKit::App::Gallery::Provider=HASH(0x82c8974)') called at 
/usr/local/lib/perl5/site_perl/5.6.1/mach/AxKit.pm line 193
        AxKit::fast_handler('AxKit::Apache=SCALAR(0x82c8860)') called at /dev/null 
line 0
        eval {...} called at /dev/null line 0


I figure the problem is the "about to execute ::handler" line, where
AxKit's not worked out which handler to call (?)

Feel free to tell me that this is more suited to the -devel list, and
I'll take it over there.  I'm also planning on writing this up for
improved docs, once I understand how everything hangs together :-)

N
-- 
FreeBSD: The Power to Serve      http://www.freebsd.org/               (__)
FreeBSD Documentation Project    http://www.freebsd.org/docproj/    \\\'',)
                                                                      \/  \ ^
   --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---         .\._/_)

Attachment: msg02514/pgp00000.pgp
Description: PGP signature

Reply via email to