Perl Example
The only differences between CUE and ACE are the path to the perl binary and the path to the eloglib library. Two complete examples are provided to make it easier to copy and paste one of them as a starting point.
ACE
#!/usr/csite/pubtools/bin/perl
# An example script to make entries from a perl script on the CUE
use lib '/cs/certified/apps/eloglib/lib/rhel-6-ia32/perl2.1';
use eloglib;
use strict;
use warnings;
$|=1;
my $status=0;
# Create a logbook entry and submit it.
eval {
my $log = new eloglib::Logentry('A Test entry', 'TLOG');
$log->setBody('Hello world', $eloglib::LogItem::C_text);
$log->addAttachment('/usr/csmuser/theo/RARlogo.jpg', 'My Caption');
#view the logXml that would be submitted
#print $log->getXML()."\n";
# Submit the entry and see if it was saved or queued
my $result = $log->submit();
if ($result > 0) {
print "The entry was saved as lognumber $result\n";
}else{
print "The entry was queued\n";
}
};
if ($@ ne "") {
warn $@;
$status=1;
}
exit($status);
CUE
#!/apps/bin/perl
# An example script to make entries from a perl script on the CUE
use lib '/apps/eloglib/lib/rhel-6-ia32/perl2.1';
use eloglib;
use strict;
use warnings;
$|=1;
my $status=0;
# Create a logbook entry and submit it.
eval {
my $log = new eloglib::Logentry('A Test entry', 'TLOG');
$log->setBody('Hello world', $eloglib::LogItem::C_text);
$log->addAttachment('/home/theo/RARlogo.jpg', 'My Caption');
#view the logXml that would be submitted
#print $log->getXML()."\n";
# Submit the entry and see if it was saved or queued
my $result = $log->submit();
if ($result > 0) {
print "The entry was saved as lognumber $result\n";
}else{
print "The entry was queued\n";
}
};
if ($@ ne "") {
warn $@;
$status=1;
}
exit($status);