| 1 | package LCC::Documents; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # Make sure we do everything by the book | ||||||||||||||||||||
| 4 | # Set modules to inherit from | ||||||||||||||||||||
| 5 | # Set version information | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | @LCC::Documents::ISA = qw(LCC); | |||||||||||||||||||
| 9 | 1 | $LCC::Documents::VERSION = '0.02'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # Return true value for use | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | 1; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | # The following methods are class methods | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | # The following methods change the object | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | # IN: 1 instantiated object | ||||||||||||||||||||
| 26 | # 2 reference to subroutine | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | sub browse_url { shift->_variable( 'browse_url',@_ ) } #browse_url | ||||||||||||||||||
|
Subroutine
browse_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | # IN: 1 instantiated object | ||||||||||||||||||||
| 33 | # 2 reference to subroutine | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | ▶ | sub conceptual_url { shift->_variable( 'conceptual_url',@_ ) } #conceptual_url | ||||||||||||||||||
|
Subroutine
conceptual_url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | # IN: 1 instantiated object | ||||||||||||||||||||
| 40 | # 2 reference to subroutine | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | sub fetch_url { shift->_variable( 'fetch_url',@_ ) } #fetch_url | ||||||||||||||||||
|
Subroutine
fetch_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | # IN: 1 instantiated object | ||||||||||||||||||||
| 47 | # 2 servername to be used (default: `hostname`) | ||||||||||||||||||||
| 48 | # 3 extension to be used (default: 'html') | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | sub server { | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | # Obtain the object | ||||||||||||||||||||
| 53 | # Set default browse_url subroutine | ||||||||||||||||||||
| 54 | # Set default conceptual_url subroutine | ||||||||||||||||||||
| 55 | # Set default fetch_url subroutine | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
server: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 58 | 0 | $self->browse_url( $self->_browse_url ); | |||||||||||||||||||
| 59 | 0 | $self->conceptual_url( $self->_conceptual_url ); | |||||||||||||||||||
| 60 | 0 | $self->fetch_url( $self->_fetch_url( @_ ) ); | |||||||||||||||||||
| 61 | } #server | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | # The following subroutines are for internal use only | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | # IN: 1 instantiated object | ||||||||||||||||||||
| 70 | # OUT: 1 code reference for default browse URL handler | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 0 | ▶ | sub _browse_url { sub {undef} } #_browse_url | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_browse_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | # IN: 1 instantiated object | ||||||||||||||||||||
| 77 | # OUT: 1 code reference for default conceptual URL handler | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 0 | ▶ | sub _conceptual_url { sub {$_[0]} } #_conceptual_url | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_conceptual_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | # IN: 1 instantiated object | ||||||||||||||||||||
| 84 | # 2 servername to be used (default: `hostname`) | ||||||||||||||||||||
| 85 | # 3 extension to be used (default: 'html') | ||||||||||||||||||||
| 86 | # OUT: 1 code reference for default fetch URL handler | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | sub _fetch_url { | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | # Obtain the object | ||||||||||||||||||||
| 91 | # Obtain the hostname, make sure it's clean | ||||||||||||||||||||
| 92 | # Obtain the extension | ||||||||||||||||||||
| 93 | # Return the code reference | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
_fetch_url: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 96 | 0 | ▶ | chomp( my $server = shift || `hostname` ); | ||||||||||||||||||
|
Condition0%0/3
shift() || `hostname`
MC/DC0%0/2
shift() || `hostname`
shift()
`hostname`
Truth table0%0/3
A || B
A= shift()B= `hostname`
| |||||||||||||||||||||
| 97 | 0 | ▶ | my $extension = shift || 'html'; | ||||||||||||||||||
|
Condition0%0/2
shift() || 'html'
MC/DC0%0/1
shift() || 'html'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||
| 98 | 0 | ▶ | return sub {"http://$server/$_[0].$extension"}; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 99 | } #_fetch_url | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | # The following subroutines deal with standard Perl features | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | #------------------------------------------------------------------------ | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | __END__ | ||||||||||||||||||||