aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/WidgetClass.pm
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-10-02 23:33:28 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-10-02 23:33:28 +0000
commite716714fb1197850975fcd131149db2f53b07f64 (patch)
treebded70e1e73b0039b612eb0a999c23af59995dfd /lib/Reaction/UI/WidgetClass.pm
parente22de1011c40b639cc4b6e5586a9e0defe855285 (diff)
downloadreaction-e716714fb1197850975fcd131149db2f53b07f64.tar.gz
reaction-e716714fb1197850975fcd131149db2f53b07f64.zip
gridview is so close. so close
Diffstat (limited to 'lib/Reaction/UI/WidgetClass.pm')
-rw-r--r--lib/Reaction/UI/WidgetClass.pm24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/Reaction/UI/WidgetClass.pm b/lib/Reaction/UI/WidgetClass.pm
index 9e40936..83e3076 100644
--- a/lib/Reaction/UI/WidgetClass.pm
+++ b/lib/Reaction/UI/WidgetClass.pm
@@ -65,11 +65,11 @@ class WidgetClass, which {
if (defined($args) && (ref($args) ne 'HASH'));
$sig .= '
- where content spec is [ fragment_name over func(...), \%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) : {});
- # [ blah over func(...), { ... } ] or [ qw(foo bar), { ... } ]
+ # [ blah over (func(...)|$_|$_{keyname}), { ... } ] or [ qw(foo bar), { ... } ]
# predeclare since content_gen gets populated somewhere in an if
# and inner_args_gen wants to be closed over by content_gen
@@ -95,13 +95,23 @@ class WidgetClass, which {
# - if arrayref, render fragment per entry
# - if obj and can('next') call that until undef
# - else scream loudly
- my ($func_key, $func_meth) = @$func;
+ unless ((ref($func) eq 'ARRAY') || ($func =~ /^-topic:(.*)$/)) {
+ confess "over value wrong, should be ${sig}";
+ }
$content_gen = sub {
my ($widget, $args) = @_;
- my $topic = eval { $args->{$func_key}->$func_meth };
- confess "Error calling ${func_meth} on ${func_key} argument "
- .($args->{$func_key}||'').": $@"
- if $@;
+ my $topic;
+ if (ref($func) eq 'ARRAY') {
+ my ($func_key, $func_meth) = @$func;
+ $topic = eval { $args->{$func_key}->$func_meth };
+ confess "Error calling ${func_meth} on ${func_key} argument "
+ .($args->{$func_key}||'').": $@"
+ if $@;
+ } elsif ($func =~ /^-topic:(.*)$/) {
+ $topic = $args->{$1};
+ } else {
+ confess "Shouldn't get here";
+ }
my $iter_sub;
if (ref $topic eq 'ARRAY') {
my @copy = @$topic; # non-destructive on original data