| 1 | package Wikibase::Datatype::Print; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 3 | ▶ | use base qw(Exporter); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | |||||||||||||||||||||||
| 7 | 3 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | 3 | ▶ | use Readonly; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | 3 | ▶ | use Wikibase::Datatype::Print::Item; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 10 | 3 | ▶ | use Wikibase::Datatype::Print::Lexeme; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 11 | 3 | ▶ | use Wikibase::Datatype::Print::Mediainfo; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 12 | 3 | ▶ | use Wikibase::Datatype::Print::Property; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | 3 | Readonly::Array our @EXPORT_OK => qw(print); | |||||||||||||||||||||
| 15 | |||||||||||||||||||||||
| 16 | 3 | our $VERSION = 0.21; | |||||||||||||||||||||
| 17 | |||||||||||||||||||||||
| 18 | 10 | ▶ | sub print { | ||||||||||||||||||||
|
Subroutine
print: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||
| 19 | 10 | my ($obj, $opts_hr) = @_; | |||||||||||||||||||||
| 20 | |||||||||||||||||||||||
| 21 | 10 | my @ret; | |||||||||||||||||||||
| 22 | 10 | ▶ | if ($obj->isa('Wikibase::Datatype::Item')) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 23 | 3 | @ret = Wikibase::Datatype::Print::Item::print($obj, $opts_hr); | |||||||||||||||||||||
| 24 | } elsif ($obj->isa('Wikibase::Datatype::Lexeme')) { | ||||||||||||||||||||||
| 25 | 2 | @ret = Wikibase::Datatype::Print::Lexeme::print($obj, $opts_hr); | |||||||||||||||||||||
| 26 | } elsif ($obj->isa('Wikibase::Datatype::Mediainfo')) { | ||||||||||||||||||||||
| 27 | 2 | @ret = Wikibase::Datatype::Print::Mediainfo::print($obj, $opts_hr); | |||||||||||||||||||||
| 28 | } elsif ($obj->isa('Wikibase::Datatype::Property')) { | ||||||||||||||||||||||
| 29 | 2 | @ret = Wikibase::Datatype::Print::Property::print($obj, $opts_hr); | |||||||||||||||||||||
| 30 | } else { | ||||||||||||||||||||||
| 31 | 1 | my $ref = ref $obj; | |||||||||||||||||||||
| 32 | 1 | ▶ | err "Unsupported Wikibase::Datatype object.", | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 33 | defined $ref ? ('Reference', $ref) : (), | ||||||||||||||||||||||
| 34 | ; | ||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||
| 36 | |||||||||||||||||||||||
| 37 | 8 | ▶ | return wantarray ? @ret : (join "\n", @ret); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||
| 39 | |||||||||||||||||||||||
| 40 | 3 | 1; | |||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||