Command/webload.pm

filter: Statementstmt 35.0% 7 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 1 / 3 Podpod 0.0% 0 / 1 totaltotal 30.7% 8 / 26 CC 2 SCAR 12.6
CC
2
Cov
32%
run
6.0
__ANON__
1.1
BEGIN
1.0
CRAP 3.5
« Command/verify.pm ↑ Summary Command/delete.pm »
1 package PMLTQ::Command::webload;
2 1 our $AUTHORITY = 'cpan:MATY';
3 1 $PMLTQ::Command::webload::VERSION = '2.0.3';
4 # ABSTRACT: Register treebank in web interface
5  
6 1 ▶use PMLTQ::Base 'PMLTQ::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶has usage => sub { shift->extract_usage };
Subroutine __ANON__: not called CC=1 SCAR=1.2
9  
10 0 ▶sub run {
Subroutine run: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my $self = shift;
12 0 my $ua = $self->ua;
13 0 $self->login($ua);
14
15 0 my $json = JSON->new;
16 0 my $treebank = $self->get_treebank($ua);
17 0 my $treebank_param = $self->create_treebank_param();
18 0 ▶ if($treebank) { # EDITING EXISTING TREEBANK
Branch: 1 branch
BranchTrueFalseTotal
if ($treebank) { } 0 0 0
19 0 $self->request_treebank($treebank,$ua,'PUT',{%$treebank_param,id => $treebank->{id}});
20 } else { # CREATING NEW TREEBANK
21 0 my $url = URI::WithBase->new('/',$self->config->{web_api}->{url});
22 0 $url->path_segments('api', 'admin', 'treebanks');
23 0 my $data;
24 0 (undef,$data) = $self->request($ua, 'POST', $url->abs->as_string, $treebank_param);
25 }
26 }
27  
28 =head1 SYNOPSIS
29  
30 pmltq webload <treebank_config>
31  
32 =head1 DESCRIPTION
33  
34 Register treebank in web interface.
35  
36 =head1 OPTIONS
37  
38 =head1 PARAMS
39  
40 =over 5
41  
42 =item B<treebank_config>
43  
44 Path to configuration file. If a treebank_config is --, config is readed from STDIN.
45  
46 =back
47  
48 =cut
49  
50 1 1;
« Command/verify.pm ↑ Summary Command/delete.pm »