[EP-tech] Re: Adding a custom PerlResponseHandler

John Salter J.Salter at leeds.ac.uk
Wed Nov 14 15:26:03 GMT 2012


Are there any examples of this anywhere?
(Graham, is this used in the newer Symplectic connector?)

Cheers,
John

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Graham Triggs
Sent: 14 November 2012 15:19
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Adding a custom PerlResponseHandler

Hi,

Using EPrints 3.3, you can hang the code off of an EP_TRIGGER_URL_REWRITE trigger (in the config for a specific archive). This also has the advantage that you aren't modifying the EPrints code.

Otherwise, just test for an archive specific value in the Rewrite script, for example, a config parameter that is only set in one archive.

G


On 14 November 2012 14:21, John Salter <J.Salter at leeds.ac.uk<mailto:J.Salter at leeds.ac.uk>> wrote:
Hi,
I'm trying to work out the best way to add a custom handler for a URL to a specific archive within eprints.

I can either set something like this in the vhost (and add '/foo/' to $c->{rewrite_exceptions} ):
<Location "/foo/handler">
    SetHandler perl-script
    PerlResponseHandler Foo::FooHandler
</Location>

 - OR -
I could edit ~/perl_lib/EPrints/Apache/Rewrite.pm, adding something like:
if ( $uri =~ m! ^$urlpath/foo !x )
{
  $r->handler( 'perl-script' );
  $r->set_handlers( PerlResponseHandler => [ 'Foo::FooHandler' ] );
  return OK;
}

BUT I wouldn't /really/ want to do that, as it would affect all archives, not just the one I want it to.

So, what is the *most* sensible way to do this, making it apply to only one archive? Am I missing some magic that will help me?

Cheers,
John

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20121114/982695e3/attachment.html 


More information about the Eprints-tech mailing list