[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] ChatGPT

So, it seems that EPrints is well documented enough online that ChatGPT 
can write simple EPrints scripts and functions. I'm frankly astounded at 
what this tool can do. It can't do complex stuff but it's still impressive.

Christopher Gutteridge
please suggest a perl script to operate on an EPrints repository. It 
should find all the records with no title and set the title to "NO TITLE".


use EPrints;

  Initialize the repository

my $repo = EPrints->new->repository('your_repository_id');

  Find all records with no title

my $records = $repo->search({ match => 'AND', filters => [ { meta_fields 
=> [ 'title' ], value => '', match => 'EQ' }, ], });

  Set the title of each record to "NO TITLE"

foreach my $record ($records->get_records) {

$record->set_value('title', 'NO TITLE');



print "Finished setting titles of records with no title to 'NO TITLE'\n";

Christopher Gutteridge, Research Application Support, University of Southampton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20230108/decac889/attachment.html