EPrints Technical Mailing List Archive

Message: #04283

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

[EP-tech] Re: epdata_to_dataobj correct syntax

Hi George,

It looks like at some point the order was changed, but in a backwards –compatible way.

See: https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/Plugin/Import.pm#L299-L302

- the method checks which parameter passed in is the DataSet and acts accordingly.


So, either way should work, but a search in GitHub: https://github.com/eprints/eprints/search?utf8=%E2%9C%93&q=epdata_to_dataobj&type=Code

it looks like dataset, data is the more common way.








From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of George Mamalakis
Sent: 03 June 2015 11:18
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] epdata_to_dataobj correct syntax


Hi everybody,

I am trying to understand how the EPrints' DSpace.pm import plugin exactly works and from what I've read from the API and the plugin's code, I got confused as to how epdata_to_dataobj() function should be called. To be honest, the same question holds for the import-plugin-example as well (http://wiki.eprints.org/w/Contribute:_Plugins/ImportPluginsCSV#input_fh).


$ perldoc ~eprints/perl_lib/EPrints/Plugin/Import.pm

mentions about epdata_to_dataobj that:

$dataobj = $plugin->epdata_to_dataobj( $epdata, %opts )
        Turn $epdata into a EPrints::DataObj using the dataset argument passed
        in %opts.

        Uses the "handler" object to perform the actual object creation.

        When sub-classing you must call "epdata_to_dataobj" in order to
        correctly handle the parse-only and test phases during import.

And this is indeed how the function is coded in ~eprints/perl_lib/EPrints/Plugin/Import.pm. On the other hand, the online example as well as the DSpace plugin call the same function like this:

my $dataobj = $self->epdata_to_dataobj( $opts{dataset}, $epdata );

Which, to my understanding, should be the other way around as far as the parameter order is concerned, meaning:

my $dataobj = $self->epdata_to_dataobj($epdata, $opts{dataset});

The truth is that my perl is very rusty, but from a first glance I think that the call to epdata_to_dataobj() function is in both codes (plugin example and DSpace plugin) wrong.

Is it so, or am I losing something very fundamental here?

Thanks for your time,


George Mamalakis
IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)
School of Electrical and Computer Engineering
Aristotle University of Thessaloniki
phone number : +30 (2310) 994379