Skip to content

Commit

Permalink
avoid dependency on Carp
Browse files Browse the repository at this point in the history
Carp’s output was different up to 1.24, so tests fail on old perls. I do
not wish to condone this upstream change by changing my tests, much less
condone it at the expense of users by depending on a newer Carp, which
leaves me to in-house the tiny fraction of functionality from Carp that
I actually need. Thanks to the Carp maintainer for his service.
  • Loading branch information
ap committed Sep 30, 2017
1 parent 72c4b33 commit 7c6a13b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Revision history for Bencode

- No test failures under Carp < 1.25

1.500 Wed 27 Sep 2017
- New $undef_mode parameter to properly handle undefs during encoding

Expand Down
1 change: 0 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
requires 'perl', '5.006';
requires 'strict';
requires 'warnings';
requires 'Carp';
requires 'Exporter::Tidy';

on test => sub {
Expand Down
8 changes: 7 additions & 1 deletion lib/Bencode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ package Bencode;

# ABSTRACT: BitTorrent serialisation format

use Carp;
use Exporter::Tidy all => [qw( bencode bdecode )];

our ( $DEBUG, $do_lenient_decode, $max_depth, $undef_encoding );

sub croak {
my ( @c, $i );
1 while ( @c = caller $i++ ) and $c[0] eq __PACKAGE__;
@c or @c = caller;
die @_, " at $c[1] line $c[2].\n";
}

sub _msg { sprintf "@_", pos() || 0 }

sub _bdecode_string {
Expand Down

0 comments on commit 7c6a13b

Please sign in to comment.