| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package X11::Muralis::Backend; |
|
2
|
|
|
|
|
|
|
$X11::Muralis::Backend::VERSION = '0.1003'; |
|
3
|
3
|
|
|
3
|
|
10
|
use strict; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
64
|
|
|
4
|
3
|
|
|
3
|
|
8
|
use warnings; |
|
|
3
|
|
|
|
|
15
|
|
|
|
3
|
|
|
|
|
61
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
X11::Muralis::Backend - display backend for X11::Muralis |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 0.1003 |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
muralis --use I |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This is the base class for backend modules for X11::Muralis. |
|
21
|
|
|
|
|
|
|
Generally speaking, the only methods that backends need to override |
|
22
|
|
|
|
|
|
|
are "new" and "display". |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
3
|
|
|
3
|
|
29
|
use File::Spec; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
760
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 new |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
There are two parameters that need to be set in "new"; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=over |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item prog |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The name of the program which is used as the backend. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item can_do |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
A hash containing the features that the backend provides. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
|
49
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
50
|
0
|
|
|
|
|
|
my %parameters = @_; |
|
51
|
0
|
|
0
|
|
|
|
my $self = bless ({%parameters}, ref ($class) || $class); |
|
52
|
0
|
|
|
|
|
|
return ($self); |
|
53
|
|
|
|
|
|
|
} # new |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 name |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The name of the backend; this is basically the last component |
|
58
|
|
|
|
|
|
|
of the module name. This works as either a class function or a method. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$name = $self->name(); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$name = X11::Muralis::Backend::name($class); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub name { |
|
67
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
my $fullname = (ref ($class) ? ref ($class) : $class); |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my @bits = split('::', $fullname); |
|
72
|
0
|
|
|
|
|
|
return pop @bits; |
|
73
|
|
|
|
|
|
|
} # name |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 active |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns true if the backend program is available to run. |
|
78
|
|
|
|
|
|
|
This is checked by searching the PATH environment variable and checking |
|
79
|
|
|
|
|
|
|
for the existence of $self->{prog} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub active { |
|
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my @path = split(':', $ENV{PATH}); |
|
87
|
0
|
|
|
|
|
|
my $found = 0; |
|
88
|
0
|
|
|
|
|
|
foreach my $dir (@path) |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
0
|
|
|
|
|
|
my $file = File::Spec->catfile($dir, $self->{prog}); |
|
91
|
0
|
0
|
|
|
|
|
if (-f $file) |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
0
|
|
|
|
|
|
$found = 1; |
|
94
|
0
|
|
|
|
|
|
last; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
0
|
|
|
|
|
|
return $found; |
|
98
|
|
|
|
|
|
|
} # active |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 provides |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns a hash of the features the backend has enabled. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub provides { |
|
107
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my %prov = (); |
|
110
|
0
|
0
|
|
|
|
|
if (defined $self->{can_do}) |
|
111
|
|
|
|
|
|
|
{ |
|
112
|
0
|
|
|
|
|
|
%prov = %{$self->{can_do}}; |
|
|
0
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
} |
|
114
|
0
|
|
|
|
|
|
return %prov; |
|
115
|
|
|
|
|
|
|
} # provides |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 display |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Display the file, with the given options. |
|
120
|
|
|
|
|
|
|
THis must be overridden by the specific backend class. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub display { |
|
125
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
return 0; |
|
128
|
|
|
|
|
|
|
} # display |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 REQUIRES |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
File::Spec |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 INSTALLATION |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
To install this module, run the following commands: |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
perl Build.PL |
|
139
|
|
|
|
|
|
|
./Build |
|
140
|
|
|
|
|
|
|
./Build test |
|
141
|
|
|
|
|
|
|
./Build install |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Or, if you're on a platform (like DOS or Windows) that doesn't like the |
|
144
|
|
|
|
|
|
|
"./" notation, you can do this: |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
perl Build.PL |
|
147
|
|
|
|
|
|
|
perl Build |
|
148
|
|
|
|
|
|
|
perl Build test |
|
149
|
|
|
|
|
|
|
perl Build install |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
In order to install somewhere other than the default, such as |
|
152
|
|
|
|
|
|
|
in a directory under your home directory, like "/home/fred/perl" |
|
153
|
|
|
|
|
|
|
go |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
perl Build.PL --install_base /home/fred/perl |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
as the first step instead. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This will install the files underneath /home/fred/perl. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
You will then need to make sure that you alter the PERL5LIB variable to |
|
162
|
|
|
|
|
|
|
find the modules, and the PATH variable to find the script. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Therefore you will need to change: |
|
165
|
|
|
|
|
|
|
your path, to include /home/fred/perl/script (where the script will be) |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
PATH=/home/fred/perl/script:${PATH} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
the PERL5LIB variable to add /home/fred/perl/lib |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
PERL5LIB=/home/fred/perl/lib:${PERL5LIB} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
perl(1). |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 BUGS |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Please report any bugs or feature requests to the author. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 AUTHOR |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Kathryn Andersen RUBYKAT |
|
184
|
|
|
|
|
|
|
perlkat AT katspace DOT org |
|
185
|
|
|
|
|
|
|
www.katspace.org |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Copyright (c) 2008 by Kathryn Andersen |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
192
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; # End of X11::Muralis::Backend |
|
197
|
|
|
|
|
|
|
__END__ |