Although use is being called in an eval it will still be executed
at compile time so that an error can cause the script to abort before
the eval is executed. The eval expression syntax is not checked
so eval block should be preferred.
Use require/import which execute at runtime which is the intention
here.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
checked that, with Libravatar OK things are still OK
);
my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
- $libravatar_enabled = 1;
+if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
+ eval {
+ require Libravatar::URL;
+ Libravatar::URL->import();
+ };
+ if (!$@ ) {
+ $libravatar_enabled = 1;
+ }
}
my $reviews = getreviews( $biblionumber, 1 );
}
my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
- $libravatar_enabled = 1;
+if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
+ eval {
+ require Libravatar::URL;
+ Libravatar::URL->import();
+ };
+ if ( !$@ ) {
+ $libravatar_enabled = 1;
+ }
}
my $reviews = getallreviews(1,$offset,$results_per_page);