<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-family: Verdana,Geneva,sans-serif'>
<p>I meant:</p>
<p>my @creators = @{ $eprint-&gt;value( 'creators' ) || [] };</p>
<p>foreach my $creator (@creators)</p>
<p>...</p>
<p>&nbsp;</p>
<p>Seb</p>
<p>On 17.10.2014 16:31, sf2 wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<p>Hola Lizz,</p>
<p>I would do something like:</p>
<p>my $creators = @{ $eprint-&gt;value( 'creators' ) || [] };</p>
<p>...</p>
<p>push @newcreators, { name =&gt; ... , etc };</p>
<p>...</p>
<p>&nbsp;</p>
<p>in your example you push an array-ref onto the array rather than pushing a single record/row:</p>
<p>push @foo, [ { ... } ] vs push @foo, { ... }</p>
<p>Seb</p>
<p>On 17.10.2014 16:33, Lizz Jennings wrote:</p>
<blockquote style="padding-left: 5px; border-left: #1010ff  2px  solid; margin-left: 5px;"><!-- node type 8 --><!-- node type 8 --><!-- node type 8 -->
<pre>Hi all,

I'm getting in a bit of a tangle.

I'd like to be able to add a function to eprint_fields_automatic for the 
creators field to generate affiliation information based on email 
addresses (where it's obvious e.g. academic institutions). I've hit a 
stumbling block immediately - I can't seem to get this to work without 
overwriting the whole thing with a single row (I've managed several 
variations on this particular theme).

This currently works to overwrite the whole list with the first creator 
and does add in or change the affiliation.

     if ( $type eq "data_collection" ) {
             my $creators = $eprint-&gt;get_value( "creators" );
         my @newcreators;
         foreach my $creator (@$creators) {
             push @newcreators, [{ name =&gt; $creator-&gt;{name}, id =&gt; 
$creator-&gt;{id}, orcid =&gt; $creator-&gt;{orcid}, affiliation =&gt; "bibble", 
contact =&gt; $creator-&gt;{contact} }];
         }
         $eprint-&gt;set_value( "creators", @newcreators );

     }

Any ideas on how to do this properly would be much appreciated.

Lizz
</pre>
</blockquote>
<p>&nbsp;</p>
<div>&nbsp;</div>
<!-- html ignored --><br />
<pre>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
</blockquote>
<p>&nbsp;</p>
<div>&nbsp;</div>
</body></html>