EPrints Technical Mailing List Archive

Message: #09153


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

[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
PROMPT:
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".


#!/usr/bin/perl

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');

$record->commit;

}

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

-- 
Christopher Gutteridge, Research Application Support, University of Southampton