diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-11-09 14:38:37 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-11-09 14:38:37 +0000 |
commit | 2e3dcc8dc99e79c1b41dcc28061f1f54d36672a2 (patch) | |
tree | 21160aa610a9391d5d6337efe4ed1f7253d281a8 /lib/Reaction/UI/WidgetClass.pm | |
parent | 6bc27bd310ba396fb925212fe78298ab859275cd (diff) | |
download | reaction-2e3dcc8dc99e79c1b41dcc28061f1f54d36672a2.tar.gz reaction-2e3dcc8dc99e79c1b41dcc28061f1f54d36672a2.zip |
switch over to sub style from AUTOLOAD style (WidgetClass changes)
Diffstat (limited to 'lib/Reaction/UI/WidgetClass.pm')
-rw-r--r-- | lib/Reaction/UI/WidgetClass.pm | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Reaction/UI/WidgetClass.pm b/lib/Reaction/UI/WidgetClass.pm index 413b7cf..3e28300 100644 --- a/lib/Reaction/UI/WidgetClass.pm +++ b/lib/Reaction/UI/WidgetClass.pm @@ -25,6 +25,7 @@ class WidgetClass, which { string => sub (&) { -string => [ @_ ] }, # meh (maybe &;@ later?) wrap => sub { $self->do_wrap_sub($package, @_); }, # should have class. fragment => sub (@) { }, # placeholder rewritten by do_import + over => sub { -over => @_ }, ); }; @@ -51,19 +52,6 @@ class WidgetClass, which { local $FRAGMENT_CLOSURE = sub { $self->do_renders_meth($package, $class, @_); }; - #local *renders::AUTOLOAD = sub { - # our $AUTOLOAD; - # shift; - # $AUTOLOAD =~ /^renders::(.*)$/; - # $self->do_renders_meth($package, $class, $1, @_); - #}; - # intercepts 'foo over ...' - local *over::AUTOLOAD = sub { - our $AUTOLOAD; - shift; - $AUTOLOAD =~ /^over::(.*)$/; - $self->do_over_meth($package, $class, $1, @_); - }; # $_ returns '-topic:_', $_{foo} returns '-topic:foo' local $_ = '-topic:_'; my %topichash; @@ -85,7 +73,7 @@ class WidgetClass, which { if (defined($args) && (ref($args) ne 'HASH')); $sig .= ' -where content spec is [ fragment_name over (func(...)|$_|$_{keyname}), \%args? ] +where content spec is [ fragment_name => over (func(...)|$_|$_{keyname}), \%args? ] or [ qw(list of fragment names), \%args ]'; # explain the mistake, yea my $inner_args = ((ref($content->[-1]) eq 'HASH') ? pop(@$content) : {}); @@ -101,6 +89,13 @@ where content spec is [ fragment_name over (func(...)|$_|$_{keyname}), \%args? ] confess "Content spec invalid, ${sig}" unless defined($content->[0]) && !ref($content->[0]); + # new-style over gives 'frag, -over, $func'. massage. + + if (defined($content->[1]) && !ref($content->[1]) + && ($content->[1] eq '-over')) { + @$content[0,1] = @$content[1,0]; + } + if (my ($key) = ($content->[0] =~ /^-(.*)?/)) { # if first content value is -foo, pull it off the front and then |