diff options
author | James Raspass <jraspass@gmail.com> | 2021-12-05 21:12:47 +0000 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-12-16 07:55:37 -0700 |
commit | 59f2a7f55726f30a8eb0e321563f63e1a1672258 (patch) | |
tree | 517790f9dd3d278b729af678bdcd24a4c3612e19 | |
parent | ac4af195cbd8166be0d74dc3a82ae369b6cf98b0 (diff) | |
download | perl-59f2a7f55726f30a8eb0e321563f63e1a1672258.tar.gz |
Modernise File::Compare a little
- Move the version to the package line and bump it.
- Bump use version now that we're using package NAME VER.
- Drop strict now that we get it from use version.
- Switch to non-inheritance based Exporter usage.
- Use defined-or operator.
-rw-r--r-- | lib/File/Compare.pm | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/File/Compare.pm b/lib/File/Compare.pm index 05e1c41d21..d6940d333b 100644 --- a/lib/File/Compare.pm +++ b/lib/File/Compare.pm @@ -1,18 +1,14 @@ -package File::Compare; +package File::Compare 1.1007; -use 5.006; -use strict; +use v5.12; use warnings; -our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Too_Big); -require Exporter; +use Exporter 'import'; -$VERSION = '1.1006'; -@ISA = qw(Exporter); -@EXPORT = qw(compare); -@EXPORT_OK = qw(cmp compare_text); +our @EXPORT = qw(compare); +our @EXPORT_OK = qw(cmp compare_text); -$Too_Big = 1024 * 1024 * 2; +our $Too_Big = 1024 * 1024 * 2; sub croak { require Carp; @@ -127,8 +123,7 @@ sub compare_text { if @_ == 3 && ref($cmp) ne 'CODE'; # Using a negative buffer size puts compare into text_mode too - $cmp = -1 unless defined $cmp; - compare($from, $to, $cmp); + compare($from, $to, $cmp // -1); } 1; @@ -177,6 +172,3 @@ are equal, 1 if the files are unequal, or -1 if an error was encountered. File::Compare was written by Nick Ing-Simmons. Its original documentation was written by Chip Salzenberg. - -=cut - |