Exactly. Although i was using Apache::Registry, i'm better off using
mod_perl the right way.
I've got my snippet working now. For those curious:
#====#
#!/usr/bin/perl
package XXXX::Getimage;
use strict;
use MogileFS::Client;
our $mogfs = MogileFS::Client->new(domain => 'testdomain',
hosts => [ '192.168.1.1:6001', '192.168.1.2:6001'
],
root => '/var/mogdata',) unless $mogfs;
die "Unable to initialize MogileFS object.\n" unless $mogfs;
#get the hash of the url
my $r = shift;
my %args = $r->argsf;
#get the requested image file
my $image = $mogfs->get_file_data(%args);
#now we got the content, i.e. we will probably cache it here using memcached
#just serve the image directly for now
if ($image) {
print "Content-type: image/jpeg\n\n";
print $$image;
}
else {
print "Content-type: text/plain\n\n";
print "Image not found";
}
#====#
Cheers,
Ferdy
On 21/04/2008, Tomas Doran <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 2008-04-21 at 10:25 +0200, Ferdy Galema wrote:
> > I don't understand the fact that i would be using CGI? Is it because
> > of "use CGI qw(:standard)"? I defined the right properties in
> > httpd.conf. What should i use instead to request the id parameter?
>
>
> Sorry, the question I should have asked is 'are you using
> Apache::Registry'? - that's using mod_perl in 'fake CGI' mode ;)
>
> Assuming that you are, then storing an instance of MogileFS::Client in a
> closure will work fine, and avoid the TCP 3-way handshake startup time
> of connecting to the Mogile trackers for most of your hits.
>
> Cheers
> Tom
>
>