Skip to content

Instantly share code, notes, and snippets.

@sshaw
Created March 9, 2012 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshaw/2009351 to your computer and use it in GitHub Desktop.
Save sshaw/2009351 to your computer and use it in GitHub Desktop.
Mojolicious text_area change
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