| 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
| |||||||||||
| 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; | |||||||||