Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 590a075

Browse files
committed
Avoid criticizable perl code
Using `require` / `->import` instead of `use` avoids the use of a "stringy eval", making for cleaner code that we don't need to silence perlcritic about. Per Andrew Dunstan Discussion: https://postgr.es/m/7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net
1 parent d00a4ad commit 590a075

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
use Test::More;
1010

1111
# Use Test::Differences if installed, and select unified diff output.
12-
# No decent way to select a context line count with this;
13-
# we could use a sub ref to allow that.
1412
BEGIN
1513
{
16-
#<<< protect next line from pgperltidy
17-
if (!eval q{ use Test::Differences; unified_diff(); 1 }) ## no critic (ProhibitStringyEval)
18-
#>>>
19-
{
20-
*eq_or_diff = \&is;
21-
}
14+
eval {
15+
require Test::Differences;
16+
Test::Differences->import;
17+
unified_diff();
18+
};
19+
20+
# No dice -- fall back to 'is'
21+
*eq_or_diff = \&is if $@;
2222
}
2323

2424
my $node = PostgreSQL::Test::Cluster->new('main');

0 commit comments

Comments
 (0)