line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
471
|
use v5.10; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
590
|
use Form::Tiny::Inline; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
46
|
|
5
|
1
|
|
|
1
|
|
511
|
use Types::Common::String qw(SimpleStr); |
|
1
|
|
|
|
|
59772
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $form = Form::Tiny::Inline->is(qw/strict/)->new( |
8
|
|
|
|
|
|
|
field_defs => [ |
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
name => "input_file", |
11
|
|
|
|
|
|
|
type => SimpleStr, |
12
|
|
|
|
|
|
|
required => 1, |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
name => "output_file", |
16
|
|
|
|
|
|
|
type => SimpleStr, |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
], |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
cleaner => sub { |
21
|
|
|
|
|
|
|
my ($self, $data) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$self->add_error("input and output is the same file") |
24
|
|
|
|
|
|
|
if $data->{output_file} && $data->{input_file} eq $data->{output_file}; |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$form->set_input( |
29
|
|
|
|
|
|
|
{ |
30
|
|
|
|
|
|
|
input_file => "/home/user/test", |
31
|
|
|
|
|
|
|
output_file => "/home/user/test_out", |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
if ($form->valid) { |
36
|
|
|
|
|
|
|
print "Yes, it works\n"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# just for testing |
40
|
|
|
|
|
|
|
$form; |