Skip to content

Commit

Permalink
Clean imported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kfly8 committed Aug 18, 2024
1 parent e3ce3b0 commit 84527f4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/kura.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use feature qw(state);

our $VERSION = "0.01";

use Carp qw(croak);
use Sub::Util qw(set_subname);
use Scalar::Util qw(blessed reftype);
use Carp ();
use Sub::Util ();
use Scalar::Util ();

my %forbidden_kura_name = map { $_ => 1 } qw{
BEGIN CHECK DESTROY END INIT UNITCHECK
Expand Down Expand Up @@ -44,9 +44,9 @@ sub kura_import_into {
return 'checker is required';
}

return if blessed($checker) && $checker->can('check');
return if Scalar::Util::blessed($checker) && $checker->can('check');

my $ref = reftype($checker) // '';
my $ref = Scalar::Util::reftype($checker) // '';

return if $ref eq 'CODE';

Expand All @@ -56,7 +56,7 @@ sub kura_import_into {
state $checker_to_code = sub {
my ($checker) = @_;

if (reftype($checker) eq 'CODE') {
if (Scalar::Util::reftype($checker) eq 'CODE') {
require Type::Tiny;
$checker = Type::Tiny->new(
constraint => $checker,
Expand All @@ -77,7 +77,7 @@ sub kura_import_into {

{
no strict "refs";
*{"$caller\::$name"} = set_subname( "$caller\::$name", $code);
*{"$caller\::$name"} = Sub::Util::set_subname( "$caller\::$name", $code);
push @{"$caller\::EXPORT_OK"}, $name;
}

Expand All @@ -102,16 +102,16 @@ sub kura_import_into {
my $err;

$err = $validate_name->($name);
croak $err if $err;
Carp::croak $err if $err;

$err = $validate_checker->($checker);
croak $err if $err;
Carp::croak $err if $err;

$err = $install_checker->($name, $checker, $caller);
croak $err if $err;
Carp::croak $err if $err;

$err = $setup_exporter->($caller);
croak $err if $err;
Carp::croak $err if $err;
}

1;
Expand Down

0 comments on commit 84527f4

Please sign in to comment.