| 1 | package Perinci::Access::Perl; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use 5.010001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 2 | ▶ | use URI::Split qw(uri_split); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 2 | ▶ | use parent qw(Perinci::Access::Schemeless); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 2 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||
| 12 | 2 | our $DATE = '2023-10-24'; # DATE | |||||||||||
| 13 | 2 | our $DIST = 'Perinci-Access-Perl'; # DIST | |||||||||||
| 14 | 2 | our $VERSION = '0.900'; # VERSION | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 17 | 1 | my $class = shift; | |||||||||||
| 18 | |||||||||||||
| 19 | 1 | my $self = $class->SUPER::new(@_); | |||||||||||
| 20 | |||||||||||||
| 21 | # The pl: uri scheme has a 1:1 mapping between Perl package and path, so | ||||||||||||
| 22 | # /Foo/Bar/ must mean the Foo::Bar package. We don't allow package_prefix or | ||||||||||||
| 23 | # anything fancy like that. | ||||||||||||
| 24 | 1 | delete $self->{package_prefix}; | |||||||||||
| 25 | |||||||||||||
| 26 | 1 | $self->{allow_schemes} = ['pl', '']; | |||||||||||
| 27 | 1 | $self->{deny_schemes} = undef; | |||||||||||
| 28 | |||||||||||||
| 29 | 1 | $self; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 2 | ▶ | sub parse_url { | ||||||||||
|
Subroutine
parse_url: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 33 | 2 | my ($self, $uri) = @_; | |||||||||||
| 34 | 2 | ▶ | die "Please specify url" unless $uri; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | |||||||||||||
| 36 | 2 | my ($sch, $auth, $path) = uri_split($uri); | |||||||||||
| 37 | 2 | ▶ | $sch //= ""; | ||||||||||
|
Condition100%2/2
$sch //= ""
MC/DC100%1/1
$sch //= ""
$sch
Truth table100%2/2
A
A= $sch
| |||||||||||||
| 38 | |||||||||||||
| 39 | 2 | ▶ | die "Only pl uri scheme is supported" unless $sch eq 'pl'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | 1 | {proto=>"pl", path=>$path}; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | 2 | 1; | |||||||||||
| 44 | # ABSTRACT: Access Perl module, functions, variables through Riap | ||||||||||||
| 45 | |||||||||||||
| 46 | __END__ | ||||||||||||