| 1 | package App::perlrdf::Command::Prefix; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 6 | 1 | ▶ | use utf8; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | |||||||||||||||||||
| 8 | 1 | ▶ | BEGIN { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | 1 | $App::perlrdf::Command::Prefix::AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||
| 10 | 1 | $App::perlrdf::Command::Prefix::VERSION = '0.006'; | |||||||||||||||||
| 11 | } | ||||||||||||||||||
| 12 | |||||||||||||||||||
| 13 | 1 | ▶ | use App::perlrdf -command; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 14 | |||||||||||||||||||
| 15 | 1 | ▶ | use namespace::clean; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | 1 | ▶ | use constant abstract => q (Look up the full URIs for customary prefixes); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 18 | 1 | ▶ | use constant command_names => qw( prefix prefixes pfx ); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 19 | 1 | ▶ | use constant description => <<'DESCRIPTION'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 20 | Given one or more prefixes such as "foaf", "dc", looks up the most | ||||||||||||||||||
| 21 | commonly used full URI. | ||||||||||||||||||
| 22 | DESCRIPTION | ||||||||||||||||||
| 23 | 1 | ▶ | use constant opt_spec => ( | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 24 | [ 'format|f=s' => 'Output format ("turtle", "xmlns", "sparql", "text")' ], | ||||||||||||||||||
| 25 | 1 | ); | |||||||||||||||||
| 26 | 1 | ▶ | use constant usage_desc => '%c prefix %o PREFIX [PREFIX ...]'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 27 | |||||||||||||||||||
| 28 | sub execute | ||||||||||||||||||
| 29 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
execute: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||
| 30 | 0 | require RDF::NS; | |||||||||||||||||
| 31 | |||||||||||||||||||
| 32 | 0 | my ($self, $opt, $arg) = @_; | |||||||||||||||||
| 33 | |||||||||||||||||||
| 34 | 0 | my $method; | |||||||||||||||||
| 35 | 0 | ▶ | for ($opt->{format} // '') | ||||||||||||||||
|
Condition0%0/2
$opt->{"format"} // ""
MC/DC0%0/1
$opt->{"format"} // ""
$opt->{"format"}
Truth table0%0/2
A
A= $opt->{"format"}
| |||||||||||||||||||
| 36 | { | ||||||||||||||||||
| 37 | 0 | ▶ | if (/turtle|ttl/i) { $method = 'TTL' } | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 38 | 0 | elsif (/sparql/i) { $method = 'SPARQL' } | |||||||||||||||||
| 39 | 0 | elsif (/xmlns|xml/i) { $method = 'XMLNS' } | |||||||||||||||||
| 40 | 0 | else { $method = 'TXT' } | |||||||||||||||||
| 41 | } | ||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | 0 | say for RDF::NS->new('any')->$method(join q<,>, @$arg); | |||||||||||||||||
| 44 | } | ||||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | 1 | 1; | |||||||||||||||||
| 47 | |||||||||||||||||||