line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
439
|
use v5.10; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
507
|
use Form::Tiny::Inline; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
5
|
1
|
|
|
1
|
|
569
|
use Types::Common::String qw(SimpleStr); |
|
1
|
|
|
|
|
62925
|
|
|
1
|
|
|
|
|
12
|
|
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; |