From: Arthur Axel 'fREW' Schmidt Date: Sat, 22 Feb 2014 15:32:27 +0000 (-0600) Subject: Stop depending on XS module Sub::Identify X-Git-Tag: v0.006003~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=527954ee23433ebf4bdb5e8690c6edccf74e0fb3;hp=d3cd53e7806b02953c5b9795b181628b46821bfb;p=p5sagit%2FLog-Contextual.git Stop depending on XS module Sub::Identify --- diff --git a/Changes b/Changes index d31cd84..dce51d8 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - Stop depending on XS module Sub::Identify 0.006002 2014-02-20 16:05:20CST-0600 America/Chicago - Fix missing POD diff --git a/cpanfile b/cpanfile index c6d4c43..9de00a8 100644 --- a/cpanfile +++ b/cpanfile @@ -3,7 +3,6 @@ requires 'Exporter::Declare' => 0.111; requires 'Carp' => 0; requires 'Scalar::Util' => 0; requires 'Moo' => 1.003000; -requires 'Sub::Identify' => 0.04; on test => sub { requires 'Test::Fatal'; diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index 0370a5b..54f33f4 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -11,7 +11,19 @@ use Exporter::Declare; use Exporter::Declare::Export::Generator; use Data::Dumper::Concise; use Scalar::Util 'blessed'; -use Sub::Identify 'stash_name'; + +use B qw(svref_2object); + +sub stash_name { + my ($coderef) = @_; + ref $coderef or return; + my $cv = B::svref_2object($coderef); + $cv->isa('B::CV') or return; + # bail out if GV is undefined + $cv->GV->isa('B::SPECIAL') and return; + + return $cv->GV->STASH->NAME; +} my @dlog = ((map "Dlog_$_", @levels), (map "DlogS_$_", @levels));