EPrints Technical Mailing List Archive

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

Message: #10065


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

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


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