[EP-tech] Re: Altering DajaObj/Eprint.pm behaviour without altering core code

John Salter J.Salter at leeds.ac.uk
Wed Apr 4 13:21:23 BST 2012

Thanks - I think Seb's answer is what I'm looking for (thanks Seb!).
I need to tweak other methods - like 'remove'.


-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Tim Brody
Sent: 04 April 2012 13:00
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Altering DajaObj/Eprint.pm behaviour without altering core code

On Wed, 2012-04-04 at 12:18 +0100, John Salter wrote:
> I'm trying to do something the 'right way'*.
> This advice: http://wiki.eprints.org/w/Read_Only_Directories says I shouldn't be editing anything under eprints3/perl_lib/ (with a couple of exceptions).
> I need to alter the 'render_fileinfo' subroutine in ~/perl_lib/EPrints/DataObj/EPrint.pm.
> How do I achieve this without:
>  - altering the Eprint.pm file
>  - ending up with some 'Subroutine render_fileinfo redefined' messages
>  - using "no warnings 'redefine';" ;o)
> I've tried various attempts - without success.
> I'm sure it can be done, and I'm sure it's a bit of perl magic I'm missing, and hopefully someone here can help!

You can override the render method in your citation:

<epc:print expr="fileinfo" opts="value=render_fileinfo" />

$c->{render_fileinfo} = sub { ... };

(value becomes "render_value" ... clunky I know)

Check perl_lib/EPrints/Script::print has support for opts if it doesn't


More information about the Eprints-tech mailing list