EPrints Technical Mailing List Archive

Message: #07677


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Modifying Details.pm/Overwriting module


Morning Alan,

Thanks for this piece of advice. It's good to know how to do it the proper way!

I added the line to plugins, and after a tiny amount of confusion, got it working.

Thanks,
James

On Wed, Jan 30, 2019 at 8:35 AM Alan.Stiles via Eprints-tech <eprints-tech@ecs.soton.ac.uk> wrote:

James,

Have a look at plugins.pl in cfg.d , specifically the section starting at line 46 : https://github.com/eprints/eprints/blob/3.3/lib/defaultcfg/cfg.d/plugins.pl#L46

 

This shows how to tell eprints to replace the existing function with the new one, and not create duplicates or fill your server log with ‘redefined’ warnings.

 

Alan

 

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of James Kerwin via Eprints-tech
Sent: 30 January 2019 07:59
To: eprints-tech@ecs.soton.ac.uk
Subject: Re: [EP-tech] Modifying Details.pm/Overwriting module

 

Apologies, ignore the previous email. I think I've done it.

 

It seems if I put the file in the suitable archive location and keep this line the same:

 

package EPrints::Plugin::Screen::EPrint::Details;

 

If I change the file name to something different (e.g. Detailz.pm) it appears to overwrite the original Details.pm.

 

Previously I was changing both the package name and the filename and it was including both.

 

Thanks,

James

 

On Wed, Jan 30, 2019 at 7:50 AM James Kerwin <jkerwin2101@gmail.com> wrote:

Hi All,

 

Could somebody please tell me how to overwrite an existing Perl module in EPrints?

 

I recently made some changes to Details.pm. I know better than to modify it in-situ, so I took a copy and moved it to my specific EPrint archive.

 

Original:

eprints3/perl_lib/EPrints/Plugin/Screen/EPrint/Details.pm

 

New edited version:

eprints3/archives/uolrepo/cfg/plugins/EPrints/Plugin/Screen/EPrint/Details.pm

 

EPrints didn't pick up my changes (even after a server restart) unless I named the edited module something different so I called it:

 

Detailz.pm (package EPrints::Plugin::Screen::EPrint::Detailz;)

 

I've made the changes to how the page renders, but my problem now is I have a "Details" and "Details2" tab on the staff view of an EPrint. I want only my new Details.pm module to be brought in. I did follow Adam Field's YouTube video that touched on this, but it wasn't quite the same problem and didn't work.

 

Thanks,

James

 

 

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.
*** 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/
*** EPrints developers Forum: http://forum.eprints.org/