File Coverage

blib/lib/LCC/Documents.pm
Criterion Covered Total %
statement 3 19 15.7
branch n/a
condition 0 5 0.0
subroutine 1 11 9.0
pod 3 4 75.0
total 7 39 17.9


line stmt bran cond sub pod time code
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     1   5 use strict;
  1         2  
  1         268  
8             @LCC::Documents::ISA = qw(LCC);
9             $LCC::Documents::VERSION = '0.02';
10              
11             # Return true value for use
12              
13             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     0 1   sub browse_url { shift->_variable( 'browse_url',@_ ) } #browse_url
29              
30             #------------------------------------------------------------------------
31              
32             # IN: 1 instantiated object
33             # 2 reference to subroutine
34              
35 0     0 0   sub conceptual_url { shift->_variable( 'conceptual_url',@_ ) } #conceptual_url
36              
37             #------------------------------------------------------------------------
38              
39             # IN: 1 instantiated object
40             # 2 reference to subroutine
41              
42 0     0 1   sub fetch_url { shift->_variable( 'fetch_url',@_ ) } #fetch_url
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     0 1   my $self = shift;
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     0     sub _browse_url { sub {undef} } #_browse_url
  0     0      
73              
74             #------------------------------------------------------------------------
75              
76             # IN: 1 instantiated object
77             # OUT: 1 code reference for default conceptual URL handler
78              
79 0     0     sub _conceptual_url { sub {$_[0]} } #_conceptual_url
  0     0      
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     0     my $self = shift;
96 0   0       chomp( my $server = shift || `hostname` );
97 0   0       my $extension = shift || 'html';
98 0     0     return sub {"http://$server/$_[0].$extension"};
  0            
99             } #_fetch_url
100              
101             #------------------------------------------------------------------------
102              
103             # The following subroutines deal with standard Perl features
104              
105             #------------------------------------------------------------------------
106              
107             __END__