Created
March 9, 2012 23:45
-
-
Save sshaw/2009351 to your computer and use it in GitHub Desktop.
Mojolicious text_area change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my ($c, $name) = (shift, shift); | |
my $cb = sub {''}; | |
if(@_ % 2) { | |
if(ref $_[-1] && ref $_[-1] eq 'CODE') { | |
$cb = pop; | |
} | |
else { | |
my $value = shift; | |
$cb = sub {$value}; | |
} | |
} | |
# Actually, an explicit value given above should override this | |
if (defined(my $value = $c->param($name))) { | |
$cb = sub {$value} | |
} | |
return $self->_tag('textarea', name => $name, @_, $cb); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment