| 1 | package Net::Hadoop::Oozie::Role::Common; | ||||||||||
| 2 | 2 | $Net::Hadoop::Oozie::Role::Common::VERSION = '0.114'; | |||||||||
| 3 | 2 | ▶ | use 5.010; | ||||||||
|
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 Carp qw( | |||||||||
| 8 | confess | ||||||||||
| 9 | 2 | ▶ | ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use Regexp::Common qw( URI number ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | has 'oozie_uri' => ( | ||||||||||
| 17 | is => 'rw', | ||||||||||
| 18 | |||||||||||
| 19 | # The very least we can do to check the URL; since we use -keep we could | ||||||||||
| 20 | # run more checks on the hostname, port, etc | ||||||||||
| 21 | isa => sub { | ||||||||||
| 22 | 0 | ▶ | my $thing = shift; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | ▶ | if ( $thing !~ $RE{URI}{HTTP}{-keep}{ -scheme => 'https?' } ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | Carp::confess "'$thing' is not a valid Oozie URI"; | |||||||||
| 25 | } | ||||||||||
| 26 | }, | ||||||||||
| 27 | default => sub { | ||||||||||
| 28 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 29 | 0 | ▶ | if ( my $env = $ENV{OOZIE_URL} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | # TODO | ||||||||||
| 31 | #if ( $env !~ m{ \A https?:// (.+?) [/] oozie \z }xms ) { | ||||||||||
| 32 | # die "OOZIE_URL=$env is a malformed value!"; | ||||||||||
| 33 | #} | ||||||||||
| 34 | 0 | return $env; | |||||||||
| 35 | } | ||||||||||
| 36 | 0 | Carp::confess "oozie_uri not specified and \$ENV{OOZIE_URL} is not set!"; | |||||||||
| 37 | }, | ||||||||||
| 38 | 2 | lazy => 1, | |||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 2 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||