EPrints Technical Mailing List Archive

Message: #04282


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

[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).

Running:

$ 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.
-- 
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