From: Vincent Pit Date: Thu, 22 Jul 2010 14:55:39 +0000 (+0200) Subject: Remove magic LaTeX::TikZ::Interface->import X-Git-Tag: v0.01~15 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=commitdiff_plain;h=af7d6a5aef3bf5fec0c187b3a13a14adc88251fd Remove magic LaTeX::TikZ::Interface->import One should use ->register now. It has been made into a class method. --- diff --git a/lib/LaTeX/TikZ/Formatter.pm b/lib/LaTeX/TikZ/Formatter.pm index 0838e46..aa26ebc 100644 --- a/lib/LaTeX/TikZ/Formatter.pm +++ b/lib/LaTeX/TikZ/Formatter.pm @@ -17,6 +17,8 @@ our $VERSION = '0.01'; use Sub::Name (); +use LaTeX::TikZ::Interface; + use LaTeX::TikZ::Tools; use Any::Moose; @@ -182,11 +184,13 @@ sub thickness { 0.8 * $width * ($tikz->scale / 5); } -use LaTeX::TikZ::Interface formatter => sub { - shift; +LaTeX::TikZ::Interface->register( + formatter => sub { + shift; - __PACKAGE__->new(@_); -}; + __PACKAGE__->new(@_); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Functor.pm b/lib/LaTeX/TikZ/Functor.pm index e302d3f..8c97432 100644 --- a/lib/LaTeX/TikZ/Functor.pm +++ b/lib/LaTeX/TikZ/Functor.pm @@ -19,6 +19,8 @@ use Carp (); use Sub::Name (); +use LaTeX::TikZ::Interface; + use LaTeX::TikZ::Tools; use Any::Moose 'Util' => [ 'does_role' ]; @@ -134,11 +136,13 @@ MOD: }, $class; } -use LaTeX::TikZ::Interface functor => sub { - shift; +LaTeX::TikZ::Interface->register( + functor => sub { + shift; - __PACKAGE__->new(rules => \@_); -}; + __PACKAGE__->new(rules => \@_); + }, +); =head1 AUTHOR diff --git a/lib/LaTeX/TikZ/Interface.pm b/lib/LaTeX/TikZ/Interface.pm index fa5da48..adf63f9 100644 --- a/lib/LaTeX/TikZ/Interface.pm +++ b/lib/LaTeX/TikZ/Interface.pm @@ -17,13 +17,9 @@ our $VERSION = '0.01'; use Sub::Name (); -sub import { +sub register { shift; - register(@_); -} - -sub register { while (@_ >= 2) { my ($name, $code) = splice @_, 0, 2; diff --git a/lib/LaTeX/TikZ/Mod/Clip.pm b/lib/LaTeX/TikZ/Mod/Clip.pm index 3f5454e..69c401e 100644 --- a/lib/LaTeX/TikZ/Mod/Clip.pm +++ b/lib/LaTeX/TikZ/Mod/Clip.pm @@ -20,6 +20,7 @@ use Sub::Name (); use LaTeX::TikZ::Formatter; use LaTeX::TikZ::Mod::Formatted; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use LaTeX::TikZ::Tools; @@ -138,11 +139,13 @@ sub apply { ) } -use LaTeX::TikZ::Interface clip => sub { - shift; +LaTeX::TikZ::Interface->register( + clip => sub { + shift; - __PACKAGE__->new(clip => $_[0]); -}; + __PACKAGE__->new(clip => $_[0]); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Mod/Color.pm b/lib/LaTeX/TikZ/Mod/Color.pm index 47cc8a2..99cfe5f 100644 --- a/lib/LaTeX/TikZ/Mod/Color.pm +++ b/lib/LaTeX/TikZ/Mod/Color.pm @@ -15,6 +15,8 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; + use Any::Moose; with 'LaTeX::TikZ::Mod'; @@ -33,11 +35,13 @@ sub declare { } sub apply { 'color=' . $_[0]->color } -use LaTeX::TikZ::Interface color => sub { - shift; +LaTeX::TikZ::Interface->register( + color => sub { + shift; - __PACKAGE__->new(color => $_[0]); -}; + __PACKAGE__->new(color => $_[0]); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Mod/Fill.pm b/lib/LaTeX/TikZ/Mod/Fill.pm index f729dea..daee627 100644 --- a/lib/LaTeX/TikZ/Mod/Fill.pm +++ b/lib/LaTeX/TikZ/Mod/Fill.pm @@ -15,6 +15,8 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; + use Any::Moose; with 'LaTeX::TikZ::Mod'; @@ -33,11 +35,13 @@ sub declare { } sub apply { 'fill=' . $_[0]->color } -use LaTeX::TikZ::Interface fill => sub { - shift; +LaTeX::TikZ::Interface->register( + fill => sub { + shift; - __PACKAGE__->new(color => $_[0]); -}; + __PACKAGE__->new(color => $_[0]); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Mod/Layer.pm b/lib/LaTeX/TikZ/Mod/Layer.pm index bfab947..0dd0a84 100644 --- a/lib/LaTeX/TikZ/Mod/Layer.pm +++ b/lib/LaTeX/TikZ/Mod/Layer.pm @@ -20,6 +20,8 @@ use List::Util (); use LaTeX::TikZ::Mod::Formatted; +use LaTeX::TikZ::Interface; + use Any::Moose; use Any::Moose 'Util::TypeConstraints'; @@ -193,12 +195,14 @@ sub apply { ) } -use LaTeX::TikZ::Interface layer => sub { - shift; +LaTeX::TikZ::Interface->register( + layer => sub { + shift; - my $name = shift; - __PACKAGE__->new(name => $name, @_); -}; + my $name = shift; + __PACKAGE__->new(name => $name, @_); + }, +); __PACKAGE__->meta->make_immutable( inline_constructor => 0, diff --git a/lib/LaTeX/TikZ/Mod/Pattern.pm b/lib/LaTeX/TikZ/Mod/Pattern.pm index 4260982..ddae7e2 100644 --- a/lib/LaTeX/TikZ/Mod/Pattern.pm +++ b/lib/LaTeX/TikZ/Mod/Pattern.pm @@ -15,6 +15,8 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; + use Any::Moose; with 'LaTeX::TikZ::Mod'; @@ -75,20 +77,22 @@ sub declare { sub apply { 'fill', 'pattern=' . $_[0]->name($_[1]) } -use LaTeX::TikZ::Interface pattern => sub { - my $class = shift; - - my %args = @_; - if (exists $args{class}) { - $class = delete $args{class}; - $class = __PACKAGE__ . '::' . $class unless $class =~ /::/; - (my $pm = $class) =~ s{::}{/}g; - $pm .= '.pm'; - require $pm; - } - - $class->new(%args); -}; +LaTeX::TikZ::Interface->register( + pattern => sub { + my $class = shift; + + my %args = @_; + if (exists $args{class}) { + $class = delete $args{class}; + $class = __PACKAGE__ . '::' . $class unless $class =~ /::/; + (my $pm = $class) =~ s{::}{/}g; + $pm .= '.pm'; + require $pm; + } + + $class->new(%args); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Mod/Raw.pm b/lib/LaTeX/TikZ/Mod/Raw.pm index 1d05720..28b1d1d 100644 --- a/lib/LaTeX/TikZ/Mod/Raw.pm +++ b/lib/LaTeX/TikZ/Mod/Raw.pm @@ -15,6 +15,8 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; + use Any::Moose; with 'LaTeX::TikZ::Mod'; @@ -37,11 +39,13 @@ sub declare { } sub apply { $_[0]->content } -use LaTeX::TikZ::Interface raw_mod => sub { - shift; +LaTeX::TikZ::Interface->register( + raw_mod => sub { + shift; - __PACKAGE__->new(content => $_[0]); -}; + __PACKAGE__->new(content => $_[0]); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Mod/Width.pm b/lib/LaTeX/TikZ/Mod/Width.pm index 345b357..41c5e07 100644 --- a/lib/LaTeX/TikZ/Mod/Width.pm +++ b/lib/LaTeX/TikZ/Mod/Width.pm @@ -15,6 +15,8 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; + use LaTeX::TikZ::Tools; use Any::Moose; @@ -35,11 +37,13 @@ sub declare { } sub apply { sprintf 'line width=%0.1fpt', $_[1]->thickness($_[0]->width) } -use LaTeX::TikZ::Interface width => sub { - shift; +LaTeX::TikZ::Interface->register( + width => sub { + shift; - __PACKAGE__->new(width => $_[0]); -}; + __PACKAGE__->new(width => $_[0]); + }, +); __PACKAGE__->meta->make_immutable; diff --git a/lib/LaTeX/TikZ/Set/Arc.pm b/lib/LaTeX/TikZ/Set/Arc.pm index 3bbe83d..9039cf0 100644 --- a/lib/LaTeX/TikZ/Set/Arc.pm +++ b/lib/LaTeX/TikZ/Set/Arc.pm @@ -24,55 +24,59 @@ use LaTeX::TikZ::Point; use LaTeX::TikZ::Set::Circle; use LaTeX::TikZ::Set::Polyline; +use LaTeX::TikZ::Interface; + use LaTeX::TikZ::Tools; use Any::Moose 'Util::TypeConstraints' => [ 'find_type_constraint' ]; my $ltp_tc = find_type_constraint('LaTeX::TikZ::Point::Autocoerce'); -use LaTeX::TikZ::Interface arc => sub { - shift; - Carp::confess('Tikz->arc($first_point, $second_point, $center)') if @_ < 3; - my ($a, $b, $c) = @_; +LaTeX::TikZ::Interface->register( + arc => sub { + shift; + Carp::confess('Tikz->arc($first_point, $second_point, $center)') if @_ < 3; + my ($a, $b, $c) = @_; - for ($a, $b, $c) { - my $p = $ltp_tc->coerce($_); - $ltp_tc->assert_valid($p); - $_ = Math::Complex->make($p->x, $p->y); - } + for ($a, $b, $c) { + my $p = $ltp_tc->coerce($_); + $ltp_tc->assert_valid($p); + $_ = Math::Complex->make($p->x, $p->y); + } - my $r = abs($a - $c); - Carp::confess("The two first points aren't on a circle of center the last") + my $r = abs($a - $c); + Carp::confess("The two first points aren't on a circle of center the last") unless LaTeX::TikZ::Tools::numeq(abs($b - $c), $r); - my $set = LaTeX::TikZ::Set::Circle->new( - center => $c, - radius => $r, - ); - - my $factor = 1/32; - - my $theta = (($b - $c) / ($a - $c))->arg; - my $points = int(abs($theta) / abs(Math::Trig::acos(0.95))); - $theta /= $points + 1; - my $rho = (1 / cos($theta)) / (1 - $factor); - - my $ua = ($a - $c) * (1 - $factor) + $c; - my $ub = ($b - $c) * (1 - $factor) + $c; - - my @outside = map { $_ * $rho + $c } ( - $a - $c, - (map { ($a - $c) * Math::Complex->emake(1, $_ * $theta) } 1 .. $points), - $b - $c, - ); - - $set->clip( - LaTeX::TikZ::Set::Polyline->new( - points => [ $ua, @outside, $ub ], - closed => 1, - ), - ); -}; + my $set = LaTeX::TikZ::Set::Circle->new( + center => $c, + radius => $r, + ); + + my $factor = 1/32; + + my $theta = (($b - $c) / ($a - $c))->arg; + my $points = int(abs($theta) / abs(Math::Trig::acos(0.95))); + $theta /= $points + 1; + my $rho = (1 / cos($theta)) / (1 - $factor); + + my $ua = ($a - $c) * (1 - $factor) + $c; + my $ub = ($b - $c) * (1 - $factor) + $c; + + my @outside = map { $_ * $rho + $c } ( + $a - $c, + (map { ($a - $c) * Math::Complex->emake(1, $_ * $theta) } 1 .. $points), + $b - $c, + ); + + $set->clip( + LaTeX::TikZ::Set::Polyline->new( + points => [ $ua, @outside, $ub ], + closed => 1, + ), + ); + }, +); =head1 AUTHOR diff --git a/lib/LaTeX/TikZ/Set/Arrow.pm b/lib/LaTeX/TikZ/Set/Arrow.pm index cc10eab..415adff 100644 --- a/lib/LaTeX/TikZ/Set/Arrow.pm +++ b/lib/LaTeX/TikZ/Set/Arrow.pm @@ -21,33 +21,37 @@ use LaTeX::TikZ::Point; use LaTeX::TikZ::Set::Line; +use LaTeX::TikZ::Interface; + use Any::Moose 'Util::TypeConstraints' => [ 'find_type_constraint' ]; my $ltp_tc = find_type_constraint('LaTeX::TikZ::Point::Autocoerce'); -use LaTeX::TikZ::Interface arrow => sub { - shift; - - Carp::confess('Not enough arguments') unless @_ >= 2; - - my $from = $ltp_tc->coerce(shift); - - my $to; - if ($_[0] eq 'dir') { - my $dir = $ltp_tc->coerce($_[1]); - $to = LaTeX::TikZ::Point->new( - x => $from->x + $dir->x, - y => $from->y + $dir->y, - ); - } else { - $to = $_[0]; - } - - LaTeX::TikZ::Set::Line->new( - from => $from, - to => $to, - )->mod('->'); -}; +LaTeX::TikZ::Interface->register( + arrow => sub { + shift; + + Carp::confess('Not enough arguments') unless @_ >= 2; + + my $from = $ltp_tc->coerce(shift); + + my $to; + if ($_[0] eq 'dir') { + my $dir = $ltp_tc->coerce($_[1]); + $to = LaTeX::TikZ::Point->new( + x => $from->x + $dir->x, + y => $from->y + $dir->y, + ); + } else { + $to = $_[0]; + } + + LaTeX::TikZ::Set::Line->new( + from => $from, + to => $to, + )->mod('->'); + }, +); =head1 AUTHOR diff --git a/lib/LaTeX/TikZ/Set/Circle.pm b/lib/LaTeX/TikZ/Set/Circle.pm index a4bc64c..06a692a 100644 --- a/lib/LaTeX/TikZ/Set/Circle.pm +++ b/lib/LaTeX/TikZ/Set/Circle.pm @@ -17,6 +17,7 @@ our $VERSION = '0.01'; use LaTeX::TikZ::Set::Point; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use LaTeX::TikZ::Tools; @@ -51,11 +52,13 @@ sub path { $set->center->path(@_) . ' circle (' . $tikz->len($set->radius) . ')'; } -use LaTeX::TikZ::Interface circle => sub { - shift; +LaTeX::TikZ::Interface->register( + circle => sub { + shift; - __PACKAGE__->new(center => $_[0], radius => $_[1]); -}; + __PACKAGE__->new(center => $_[0], radius => $_[1]); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Line.pm b/lib/LaTeX/TikZ/Set/Line.pm index 819ccb9..ffe5975 100644 --- a/lib/LaTeX/TikZ/Set/Line.pm +++ b/lib/LaTeX/TikZ/Set/Line.pm @@ -17,6 +17,7 @@ our $VERSION = '0.01'; use LaTeX::TikZ::Set::Point; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -43,11 +44,13 @@ sub path { $set->from->path(@_) . ' -- ' . $set->to->path(@_); } -use LaTeX::TikZ::Interface line => sub { - shift; +LaTeX::TikZ::Interface->register( + line => sub { + shift; - __PACKAGE__->new(from => $_[0], to => $_[1]); -}; + __PACKAGE__->new(from => $_[0], to => $_[1]); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Path.pm b/lib/LaTeX/TikZ/Set/Path.pm index 11ea106..5a9e59c 100644 --- a/lib/LaTeX/TikZ/Set/Path.pm +++ b/lib/LaTeX/TikZ/Set/Path.pm @@ -15,6 +15,7 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -57,11 +58,13 @@ sub path { join ' ', map $_->path(@_), $set->ops; } -use LaTeX::TikZ::Interface path => sub { - shift; +LaTeX::TikZ::Interface->register( + path => sub { + shift; - __PACKAGE__->new(ops => \@_); -}; + __PACKAGE__->new(ops => \@_); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Point.pm b/lib/LaTeX/TikZ/Set/Point.pm index 3b43c99..5bf292b 100644 --- a/lib/LaTeX/TikZ/Set/Point.pm +++ b/lib/LaTeX/TikZ/Set/Point.pm @@ -17,6 +17,7 @@ our $VERSION = '0.01'; use LaTeX::TikZ::Point; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -48,14 +49,16 @@ sub path { '(' . $tikz->len($p->x) . ',' . $tikz->len($p->y) . ')'; } -use LaTeX::TikZ::Interface point => sub { - shift; +LaTeX::TikZ::Interface->register( + point => sub { + shift; - my $point = @_ == 0 ? 0 - : @_ == 1 ? $_[0] - : \@_; - __PACKAGE__->new(point => $point); -}; + my $point = @_ == 0 ? 0 + : @_ == 1 ? $_[0] + : \@_; + __PACKAGE__->new(point => $point); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Polyline.pm b/lib/LaTeX/TikZ/Set/Polyline.pm index 76656af..705cac3 100644 --- a/lib/LaTeX/TikZ/Set/Polyline.pm +++ b/lib/LaTeX/TikZ/Set/Polyline.pm @@ -17,6 +17,7 @@ our $VERSION = '0.01'; use LaTeX::TikZ::Set::Point; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -56,17 +57,18 @@ sub path { ($set->closed ? 'cycle' : ()); } -use LaTeX::TikZ::Interface polyline => sub { - shift; +LaTeX::TikZ::Interface->register( + polyline => sub { + shift; - __PACKAGE__->new(points => \@_); -}; + __PACKAGE__->new(points => \@_); + }, + closed_polyline => sub { + shift; -use LaTeX::TikZ::Interface closed_polyline => sub { - shift; - - __PACKAGE__->new(points => \@_, closed => 1); -}; + __PACKAGE__->new(points => \@_, closed => 1); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Raw.pm b/lib/LaTeX/TikZ/Set/Raw.pm index d96fc3b..46d8da1 100644 --- a/lib/LaTeX/TikZ/Set/Raw.pm +++ b/lib/LaTeX/TikZ/Set/Raw.pm @@ -15,6 +15,7 @@ Version 0.01 our $VERSION = '0.01'; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -29,11 +30,13 @@ has 'content' => ( sub path { $_[0]->content } -use LaTeX::TikZ::Interface raw => sub { - shift; +LaTeX::TikZ::Interface->register( + raw => sub { + shift; - __PACKAGE__->new(content => join ' ', @_); -}; + __PACKAGE__->new(content => join ' ', @_); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Rectangle.pm b/lib/LaTeX/TikZ/Set/Rectangle.pm index f70595d..79dda06 100644 --- a/lib/LaTeX/TikZ/Set/Rectangle.pm +++ b/lib/LaTeX/TikZ/Set/Rectangle.pm @@ -17,6 +17,7 @@ our $VERSION = '0.01'; use LaTeX::TikZ::Set::Point; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -87,17 +88,19 @@ Attributes 'width' and 'height' are required when 'to' was not given $class->$orig(@_); }; -use LaTeX::TikZ::Interface rectangle => sub { - shift; - my ($p, $q) = @_; +LaTeX::TikZ::Interface->register( + rectangle => sub { + shift; + my ($p, $q) = @_; - my $is_relative = !blessed($q) && ref($q) eq 'HASH'; + my $is_relative = !blessed($q) && ref($q) eq 'HASH'; - __PACKAGE__->new( - from => $p, - ($is_relative ? (map +($_ => $q->{$_}), qw/width height/) : (to => $q)), - ); -}; + __PACKAGE__->new( + from => $p, + ($is_relative ? (map +($_ => $q->{$_}), qw/width height/) : (to => $q)), + ); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/lib/LaTeX/TikZ/Set/Sequence.pm b/lib/LaTeX/TikZ/Set/Sequence.pm index a92ad89..0bf9222 100644 --- a/lib/LaTeX/TikZ/Set/Sequence.pm +++ b/lib/LaTeX/TikZ/Set/Sequence.pm @@ -19,6 +19,7 @@ use List::Util (); use LaTeX::TikZ::Scope; +use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; use Any::Moose; @@ -66,11 +67,13 @@ sub draw { $set->kids; } -use LaTeX::TikZ::Interface seq => sub { - shift; +LaTeX::TikZ::Interface->register( + seq => sub { + shift; - __PACKAGE__->new(kids => \@_); -}; + __PACKAGE__->new(kids => \@_); + }, +); LaTeX::TikZ::Functor->default_rule( (__PACKAGE__) => sub { diff --git a/t/01-api.t b/t/01-api.t index 3eea9d9..9f00401 100644 --- a/t/01-api.t +++ b/t/01-api.t @@ -46,7 +46,7 @@ require LaTeX::TikZ::Interface; for my $name (undef, ':)') { eval { - LaTeX::TikZ::Interface->import( + LaTeX::TikZ::Interface->register( $name => sub { }, ); }; @@ -54,7 +54,7 @@ for my $name (undef, ':)') { } eval { - LaTeX::TikZ::Interface->import( + LaTeX::TikZ::Interface->register( 'raw' => sub { }, ); }; @@ -62,7 +62,7 @@ like $@, qr/^'raw' is already defined/, 'already defined'; for my $code (undef, [ ]) { eval { - LaTeX::TikZ::Interface->import( + LaTeX::TikZ::Interface->register( 'foo' => $code, ); }; @@ -70,7 +70,7 @@ for my $code (undef, [ ]) { } eval { - LaTeX::TikZ::Interface->import( + LaTeX::TikZ::Interface->register( 'foo' => sub { @_ }, ); }; @@ -79,7 +79,7 @@ ok(Tikz->can('foo'), 'Tikz evaluates to something that ->can(foo)'); is_deeply [ Tikz->foo('hello') ], [ Tikz, 'hello' ], 'Tikz->foo works'; eval { - LaTeX::TikZ::Interface->import( + LaTeX::TikZ::Interface->register( 'bar' => sub { @_ }, 'baz' => undef, );