From: Arthur Axel 'fREW' Schmidt Date: Tue, 31 Jul 2012 13:57:34 +0000 (-0500) Subject: warn re complex usage of S::E::P is now exception X-Git-Tag: v0.001002~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=113a844be22f287481afa1fcde48cf09c5a85922;p=p5sagit%2FSub-Exporter-Progressive.git warn re complex usage of S::E::P is now exception --- diff --git a/Changes b/Changes index 9fee3e6..bd24e53 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ Revision history for {{$dist->name}} {{$NEXT}} - Make Sub::Exporter an optional dep (which is kinda the whole point) + - warning about too complex usage of Sub::Exporter::Progressive is now + an exception 0.001001 2012-07-29 19:58:40 America/Chicago - Fix '-all' option for the default group diff --git a/lib/Sub/Exporter/Progressive.pm b/lib/Sub/Exporter/Progressive.pm index 0e8d042..be1815b 100644 --- a/lib/Sub/Exporter/Progressive.pm +++ b/lib/Sub/Exporter/Progressive.pm @@ -15,37 +15,32 @@ sub import { my $inner_target = caller(0); my ($TOO_COMPLICATED, $export_data) = sub_export_options(@args); - if ($TOO_COMPLICATED) { - warn <<'WARNING'; + die <<'DEATH' if $TOO_COMPLICATED; You are using Sub::Exporter::Progressive, but the features your program uses from Sub::Exporter cannot be implemented without Sub::Exporter, so you might as well just use vanilla Sub::Exporter -WARNING - require Sub::Exporter; - goto \&Sub::Exporter::import; - } - else { - my $full_exporter; - no strict; - @{"${inner_target}::EXPORT_OK"} = @{$export_data->{exports}}; - @{"${inner_target}::EXPORT"} = @{$export_data->{defaults}}; - *{"${inner_target}::import"} = sub { - use strict; - my ($self, @args) = @_; - - if (first { ref || !m/^\w+$/ } @args) { - die 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed' - unless eval { require Sub::Exporter }; - $full_exporter ||= - Sub::Exporter::build_exporter($export_data->{original}); - - goto $full_exporter; - } else { - require Exporter; - goto \&Exporter::import; - } - }; - } +DEATH + + my $full_exporter; + no strict; + @{"${inner_target}::EXPORT_OK"} = @{$export_data->{exports}}; + @{"${inner_target}::EXPORT"} = @{$export_data->{defaults}}; + *{"${inner_target}::import"} = sub { + use strict; + my ($self, @args) = @_; + + if (first { ref || !m/^\w+$/ } @args) { + die 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed' + unless eval { require Sub::Exporter }; + $full_exporter ||= + Sub::Exporter::build_exporter($export_data->{original}); + + goto $full_exporter; + } else { + require Exporter; + goto \&Exporter::import; + } + }; } sub sub_export_options {