Commits

Toby Inkster committed 42193d4

lexical subs

  • Participants
  • Parent commits 490f9b5

Comments (0)

Files changed (2)

File lib/Smart/Dispatch.pm

 	@EXPORT    = qw/dispatcher match match_using otherwise dispatch failover/;
 }
 
+use namespace::clean ();
 use Sub::Exporter -setup => {
 	exports => [
 		dispatcher   => \&_build_dispatcher,
 		tiny         => [qw/dispatcher match/],
 	],
 	collectors => [qw/class/],
+	installer => sub {
+		namespace::clean::->import(
+			-cleanee => $_[0]{into},
+			grep { !ref } @{ $_[1] },
+		);
+		goto \&Sub::Exporter::default_installer;
+	},
 };
 
 sub _build_dispatcher
 
 =head2 Building a Dispatch Table
 
+All the keywords used a build a dispatch table are lexical subs, which
+means that you can import them into a particular code block and they
+will not be available outside that block.
+
 =head3 C<< dispatcher { CODE } >>
 
 A dispatch table is built using the C<dispatcher> function which takes a

File meta/changes.pret

 	label   "Remember, remember";
 	changeset [
 		item "Port from Any::Mouse to Moo."^^Update;
+		item "Use namespace::clean to lexicalize exported subs."^^Change;
 	].