Toby Inkster avatar Toby Inkster committed 34cd3aa

remove smart match feature

Comments (0)

Files changed (5)

lib/Scalar/Does.pm

 	$Scalar::Does::VERSION   = '0.001';
 }
 
+use overload ();
+#	q[~~]    => sub { shift->(@_) },
+#	fallback => 1;
+
 use Carp             0     qw( confess );
 use IO::Detect       0.001 qw( is_filehandle );
-use overload         0     qw();
 use namespace::clean 0.19  qw();
 use Scalar::Util     1.20  qw( blessed reftype );
 
 		default => [qw( does )],
 	},
 	installer => sub {
-		my @subs = grep { !ref } @{ $_[1] };
-		namespace::clean->import( -cleanee => $_[0]{into}, @subs );
+		namespace::clean->import(
+			-cleanee => $_[0]{into},
+			grep { !ref } @{ $_[1] },
+		);
 		goto \&Sub::Exporter::default_installer;
 	},
 };
 	goto \&overload::Method;
 }
 
+use Data::Dumper;
 sub does ($;$)
 {
 	my ($thing, $role) = @_;
 	# curry (kinda)
 	return sub { does($_[0], $thing) } if @_==1;
 	
-#	use Data::Dumper;
 #	warn Dumper(@_);
 	
 	if (my $test = $ROLES{$role})
   does($object, 'HASH');          # true
   does($object, 'ARRAY');         # false
 
-Or the shiny Perl 5.10+ syntax:
-
-  $object ~~does 'Some::Class'    # true
-  $object ~~does '%{}'            # true
-  $object ~~does 'HASH'           # true
-  $object ~~does 'ARRAY'          # false
-
 =head1 DESCRIPTION
 
 It has long been noted that Perl would benefit from a C<< does() >> built-in.
 
 =head2 Functions
 
-This module provides a prototype C<< does() >> function which can be used in
-as a standard function, or using a pseudo-infix notation (via smart match).
-
 =over
 
 =item C<< does($scalar, $role) >>
 =item C<< overloads($scalar, $role) >>
 
 A function C<overloads> (which just checks overloading) is also available.
-It can be called using the same syntax as C<does>.
 
 =item C<< blessed($scalar) >>, C<< reftype($scalar) >>
 
   
   does_array($thing);
   does_hash($thing);
-  $thing ~~does_array;
-  $thing ~~does_hash;
 
 =head1 BUGS
 

meta/changes.pret

 # This file acts as the project's changelog.
 
 `Scalar-Does 0.001 cpan:TOBYINK`
-	issued  2012-08-27;
+	issued  2012-09-02;
 	label   "Initial release".
 
 	:homepage             <https://metacpan.org/release/Scalar-Does>;
 	:download-page        <https://metacpan.org/release/Scalar-Does>;
 	:bug-database         <http://rt.cpan.org/Dist/Display.html?Queue=Scalar-Does>;
-	:created              2012-08-27;
+	:repository           [ a :HgRepository; :browse <https://bitbucket.org/tobyink/p5-scalar-does> ];
+	:created              2012-08-01;
 	:license              <http://dev.perl.org/licenses/>;
 	:maintainer           cpan:TOBYINK;
 	:developer            cpan:TOBYINK.

meta/makefile.pret

 	perl_version_from m`Scalar::Does`;
 	version_from      m`Scalar::Does`;
 	readme_from       m`Scalar::Does`;
-	test_requires     p`Test::More 0.61`  .
+	requires          p`namespace::clean 0.19`;
+	requires          p`IO::Detect 0.001`;
+	requires          p`namespace::clean 0.19`;
+	requires          p`Scalar::Util 1.23`;
+	requires          p`Carp`;
+	requires          p`Sub::Exporter`;
+	test_requires     p`Test::More 0.61`.
 

t/06smartmatch.t

-use if $] < 5.010,
-	'Test::More' => (skip_all => "Perl $] is too old");
-
-use Test::More;
-use Scalar::Does
-	qw( does overloads ),
-	custom => { -role => 'ARRAY', -as => 'does_array' },
-	custom => { -role => 'HASH',  -as => 'does_hash'  };
-
-my $A = +[];
-my $H = +{};
-	
-my $curried = does 'ARRAY';
-
-#use B::Deparse ();
-#note( B::Deparse->new->coderef2text($curried) );
-
-ok(
-	ref $curried eq 'CODE',
-	q(ref $curried eq 'CODE'),
-);
-
-ok(
-	$curried->($A),
-	q($curried->($A)),
-);
-ok(
-	not($curried->($H)),
-	q(not($curried->($H))),
-);
-
-ok(
-	$A ~~ $curried,
-	q($A ~~ $curried),
-);
-ok(
-	not($H ~~ $curried),
-	q(not($H ~~ $curried)),
-);
-
-ok(
-	($A ~~does 'ARRAY'),
-	q(($A ~~does 'ARRAY')),
-);
-
-ok(
-	$A ~~does_array,
-	q($A ~~does_array),
-);
-
-ok(
-	not($H ~~does 'ARRAY'),
-	q(not($H ~~does 'ARRAY')),
-);
-
-ok(
-	not($H ~~does_array),
-	q(not($H ~~does_array)),
-);
-
-ok(
-	($H ~~does 'HASH'),
-	q(($H ~~does 'HASH')),
-);
-
-ok(
-	$H ~~does_hash,
-	q($H ~~does_hash),
-);
-
-ok(
-	not($A ~~does 'HASH'),
-	q(not($A ~~does 'HASH')),
-);
-
-ok(
-	not($A ~~does_hash),
-	q(not($A ~~does_hash)),
-);
-
-ok(
-	not($A ~~overloads 'ARRAY'),
-	q(not($A ~~overloads 'ARRAY')),
-);
-
-done_testing();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.