EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #10066


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

Re: [EP-tech] EPC: calling a function stored in nested config hash


Hi John,

Possibly not the neatest solution but I would add a run_hefce_os_deduce_panels to EPrints::Script::Compiled, which can be done by adding a

package EPrints::Script::Compiled;

to an archive level cfg.d file and then adding the run_... function.  Then rather than using epc:print you can just call the function like:

hefce_oa_deduce_panels($item)

Regards 

David Newman


From: eprints-tech-request@ecs.soton.ac.uk <eprints-tech-request@ecs.soton.ac.uk> on behalf of John Salter <J.Salter@leeds.ac.uk>
Sent: Thursday, March 27, 2025 4:34:25 PM
To: eprints-tech@ecs.soton.ac.uk <eprints-tech@ecs.soton.ac.uk>
Subject: [EP-tech] EPC: calling a function stored in nested config hash
 
CAUTION: This e-mail originated outside the University of Southampton.
CAUTION: This e-mail originated outside the University of Southampton.

Hi,
I’m trying to display some information in a workflow. That information would come from a method in a config hash[1], that should be passed an EPrint.

 

The method is something like this:

$c->{hefce_oa}->{deduce_panel} = sub {

    my( $eprint ) = @_;

    # do stuff

    return “A value”;

};

 

I can get the function itself e.g. adding this to the workflow:

    <component type="XHTML">

            <epc:print expr="$config{hefce_oa}{deduce_panel}()"/>

    </component>

Results in:

CODE(0x5595701ec338)

 

This makes sense – as you can get a ‘value’ from the nested config [2].

 

I’m trying to find a way to call this method. If I try other combinations of brackets/dots/

  <epc:print expr="$config{hefce_oa}{deduce_panel}.($item)"/>

  <epc:print expr="{$config{hefce_oa}{deduce_panel}}.($item)"/>

I either get the code reference, or an EPScript error.

 

Am I overlooking something? Is there a way to do this?

Or should I just inject a new run_eprint_deduce_panel wrapper method into EPrints::Script::Compiled?

 

Cheers,

John

 

[1] https://wiki.eprints.org/w/EPScript/Data_Types#Hashes

[2] https://wiki.eprints.org/w/EPScript/Introduction


 

John Salter

https://orcid.org/0000-0002-8611-8266

 

White Rose Libraries Technical Officer
Library and Research Management team, IT
University of Leeds