Mojolicious/Plugin/MoreTagHelpers.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 2 SCAR 12.0
CC
2
Cov
0%
register
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package Mojolicious::Plugin::MoreTagHelpers;
2  
3 use strict;
4 use warnings;
5  
6 use base 'Mojolicious::Plugin';
7  
8 use Mojo::ByteStream;
9  
10 sub register {
11 my ($self, $app) = @_;
12  
13 $app->renderer->add_helper(
14 select_tag => sub {
15 my ($c, $name, $options, $selected) = @_;
16 $selected ||= "";
17  
18 my $opts = join("",
19 map {
20 qq(<option name="$_") .
21 ($_ eq $selected ?
22 qq(selected="selected") : "") .
23 qq(>$_</option>)
24 } @$options);
25 return Mojo::ByteStream->new(qq(<select name="$name">$opts</select>));
26 }
27 );
28 }
29  
30 1;