1. Toby Inkster
  2. p5-scalar-does

Commits

Toby Inkster  committed de9f7dd

take advantage of sub generators in recent Exporter::Tiny

  • Participants
  • Parent commits b8f66e3
  • Branches default

Comments (0)

Files changed (2)

File lib/IO/Detect.pm

View file
  • Ignore whitespace
 		smartmatch => [qw( FileHandle FileName FileUri )],
 	);
 	
-	sub _exporter_expand_sub
-	{
-		my $class = shift;
-		return ducktype      => $class->_build_ducktype(@_[0,1])      if $_[0] eq "ducktype";
-		return as_filehandle => $class->_build_as_filehandle(@_[0,1]) if $_[0] eq "as_filehandle";
-		$class->SUPER::_exporter_expand_sub(@_);
-	}
-	
 	sub _exporter_validate_opts
 	{
 		require B;
 	return true;
 }
 
-sub _build_ducktype
+sub _generate_ducktype
 {
 	my ($class, $name, $arg) = @_;
 	my $methods = $arg->{methods};
 	return;
 }
 
-sub _build_as_filehandle
+sub _generate_as_filehandle
 {
 	my ($class, $name, $arg) = @_;
 	my $default_mode = $arg->{mode} || '<';
 	};
 }
 
-*as_filehandle = __PACKAGE__->_build_as_filehandle('as_filehandle', +{});
+*as_filehandle = __PACKAGE__->_generate_as_filehandle('as_filehandle', +{});
 
 {
 	package IO::Detect::SmartMatcher;

File lib/Scalar/Does.pm

View file
  • Ignore whitespace
 		make           => [ qw( make_role where ) ],
 	);
 	
-	# this can probably be replaced with Exporter::Tiny's new generator stuff
-	sub _exporter_expand_sub
-	{
-		my $class = shift;
-		return custom => $class->_build_custom(@_[0,1]) if $_[0] eq "custom";
-		$class->SUPER::_exporter_expand_sub(@_);
-	}
-	
 	sub _exporter_validate_opts
 	{
 		require B;
 		return;
 	}
 	
-	sub _build_custom
+	sub _generate_custom
 	{
 		my ($class, $name, $arg) = @_;
 		my $role = $arg->{ -role } or confess MISSING_ROLE_MESSAGE;