| 1 | package List::Filter::Library::FileExtensions; | ||||||||||||||||||||
| 2 | 1 | ▶ | use base qw( Class::Base ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | List::Filter::Library::FileExtensions - filters that select for certain file extensions | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | # This is a plugin, not intended for direct use. | ||||||||||||||||||||
| 11 | # See: L<List::Filter::Storage::CODE> | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | List::Filter::Library::FileExtensions is a library of L<List::Filter> filters | ||||||||||||||||||||
| 16 | that select for certain types of files based on standard file extensions. | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | These definitions are all borrowed from internal definitions in L<App::Ack>. | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | See L<List::Filter::Library::Documentation> for a information | ||||||||||||||||||||
| 21 | about the filters defined here. | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | =head2 METHODS | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | =over | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | =cut | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 1 | ▶ | use 5.8.0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 30 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | 1 | ▶ | use Hash::Util qw( lock_keys unlock_keys ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||
| 37 | 1 | my $DEBUG = 0; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | # needed for accessor generation | ||||||||||||||||||||
| 40 | 1 | our $AUTOLOAD; | |||||||||||||||||||
| 41 | 1 | my %ATTRIBUTES = (); | |||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =item new | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | Creates a new List::Filter::Library::FileExtensions object. | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | With no arguments, the newly created object will have undefined | ||||||||||||||||||||
| 49 | attributes (which can all be set later using accessors named | ||||||||||||||||||||
| 50 | according to the "set_*" convention). | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | Inputs: | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | An optional hashref, with named fields identical to the names of | ||||||||||||||||||||
| 55 | the object attributes. The attributes, in order of likely utility: | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | =over | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =item new | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | =back | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | Takes an optional hashref as an argument, with named fields | ||||||||||||||||||||
| 64 | identical to the names of the object attributes. | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | # Note: "new" is inherited from Class::Base and | ||||||||||||||||||||
| 69 | # calls the following "init" routine automatically. | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | =item init | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | Initialize object attributes and then lock them down to prevent | ||||||||||||||||||||
| 74 | accidental creation of new ones. | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 4 | ▶ | sub init { | ||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 79 | 4 | my $self = shift; | |||||||||||||||||||
| 80 | 4 | my $args = shift; | |||||||||||||||||||
| 81 | 4 | unlock_keys( %{ $self } ); | |||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 4 | my $lfs = List::Filter::Storage->new( storage => | |||||||||||||||||||
| 84 | { format => 'MEM', } ); | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | # define new attributes | ||||||||||||||||||||
| 87 | my $attributes = { | ||||||||||||||||||||
| 88 | 4 | ▶ | storage_handler => $args->{ storage_handler } || $lfs, | ||||||||||||||||||
|
Condition33%1/3
$args->{'storage_handler'} || $lfs
MC/DC0%0/2
$args->{'storage_handler'} || $lfs
$args->{'storage_handler'}
$lfs
Truth table33%1/3
A || B
A= $args->{'storage_handler'}B= $lfs
| |||||||||||||||||||||
| 89 | }; | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | # add attributes to object | ||||||||||||||||||||
| 92 | 4 | my @fields = (keys %{ $attributes }); | |||||||||||||||||||
| 93 | 4 | @{ $self }{ @fields } = @{ $attributes }{ @fields }; # hash slice | |||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 4 | lock_keys( %{ $self } ); | |||||||||||||||||||
| 96 | 4 | return $self; | |||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | =item define_filters_href | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | Returns a hash reference (keyed by filter name) of filter hash references. | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | =cut | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 4 | ▶ | sub define_filters_href { | ||||||||||||||||||
|
Subroutine
define_filters_href: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 106 | 4 | my $self = shift; | |||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 4 | my $filters = | |||||||||||||||||||
| 109 | { | ||||||||||||||||||||
| 110 | ':tcl' => { | ||||||||||||||||||||
| 111 | 'terms' => [ | ||||||||||||||||||||
| 112 | '\\.tcl$' | ||||||||||||||||||||
| 113 | ], | ||||||||||||||||||||
| 114 | 'modifiers' => '', | ||||||||||||||||||||
| 115 | 'method' => 'find_any', | ||||||||||||||||||||
| 116 | 'description' => 'Select for tcl files (borrowed from ack)' | ||||||||||||||||||||
| 117 | }, | ||||||||||||||||||||
| 118 | ':vim' => { | ||||||||||||||||||||
| 119 | 'terms' => [ | ||||||||||||||||||||
| 120 | '\\.vim$' | ||||||||||||||||||||
| 121 | ], | ||||||||||||||||||||
| 122 | 'modifiers' => '', | ||||||||||||||||||||
| 123 | 'method' => 'find_any', | ||||||||||||||||||||
| 124 | 'description' => 'Select for vim files (borrowed from ack)' | ||||||||||||||||||||
| 125 | }, | ||||||||||||||||||||
| 126 | ':js' => { | ||||||||||||||||||||
| 127 | 'terms' => [ | ||||||||||||||||||||
| 128 | '\\.js$' | ||||||||||||||||||||
| 129 | ], | ||||||||||||||||||||
| 130 | 'modifiers' => '', | ||||||||||||||||||||
| 131 | 'method' => 'find_any', | ||||||||||||||||||||
| 132 | 'description' => 'Select for js files (borrowed from ack)' | ||||||||||||||||||||
| 133 | }, | ||||||||||||||||||||
| 134 | ':html' => { | ||||||||||||||||||||
| 135 | 'terms' => [ | ||||||||||||||||||||
| 136 | '\\.htm$', | ||||||||||||||||||||
| 137 | '\\.html$', | ||||||||||||||||||||
| 138 | '\\.shtml$' | ||||||||||||||||||||
| 139 | ], | ||||||||||||||||||||
| 140 | 'modifiers' => '', | ||||||||||||||||||||
| 141 | 'method' => 'find_any', | ||||||||||||||||||||
| 142 | 'description' => 'Select for html files (borrowed from ack)' | ||||||||||||||||||||
| 143 | }, | ||||||||||||||||||||
| 144 | ':shell' => { | ||||||||||||||||||||
| 145 | 'terms' => [ | ||||||||||||||||||||
| 146 | '\\.sh$', | ||||||||||||||||||||
| 147 | '\\.bash$', | ||||||||||||||||||||
| 148 | '\\.csh$', | ||||||||||||||||||||
| 149 | '\\.ksh$', | ||||||||||||||||||||
| 150 | '\\.zsh$' | ||||||||||||||||||||
| 151 | ], | ||||||||||||||||||||
| 152 | 'modifiers' => '', | ||||||||||||||||||||
| 153 | 'method' => 'find_any', | ||||||||||||||||||||
| 154 | 'description' => 'Select for shell files (borrowed from ack)' | ||||||||||||||||||||
| 155 | }, | ||||||||||||||||||||
| 156 | ':tex' => { | ||||||||||||||||||||
| 157 | 'terms' => [ | ||||||||||||||||||||
| 158 | '\\.tex$', | ||||||||||||||||||||
| 159 | '\\.cls$', | ||||||||||||||||||||
| 160 | '\\.sty$' | ||||||||||||||||||||
| 161 | ], | ||||||||||||||||||||
| 162 | 'modifiers' => '', | ||||||||||||||||||||
| 163 | 'method' => 'find_any', | ||||||||||||||||||||
| 164 | 'description' => 'Select for tex files (borrowed from ack)' | ||||||||||||||||||||
| 165 | }, | ||||||||||||||||||||
| 166 | ':lisp' => { | ||||||||||||||||||||
| 167 | 'terms' => [ | ||||||||||||||||||||
| 168 | '\\.lisp$' | ||||||||||||||||||||
| 169 | ], | ||||||||||||||||||||
| 170 | 'modifiers' => '', | ||||||||||||||||||||
| 171 | 'method' => 'find_any', | ||||||||||||||||||||
| 172 | 'description' => 'Select for lisp files (borrowed from ack)' | ||||||||||||||||||||
| 173 | }, | ||||||||||||||||||||
| 174 | ':python' => { | ||||||||||||||||||||
| 175 | 'terms' => [ | ||||||||||||||||||||
| 176 | '\\.py$' | ||||||||||||||||||||
| 177 | ], | ||||||||||||||||||||
| 178 | 'modifiers' => '', | ||||||||||||||||||||
| 179 | 'method' => 'find_any', | ||||||||||||||||||||
| 180 | 'description' => 'Select for python files (borrowed from ack)' | ||||||||||||||||||||
| 181 | }, | ||||||||||||||||||||
| 182 | ':java' => { | ||||||||||||||||||||
| 183 | 'terms' => [ | ||||||||||||||||||||
| 184 | '\\.java$' | ||||||||||||||||||||
| 185 | ], | ||||||||||||||||||||
| 186 | 'modifiers' => '', | ||||||||||||||||||||
| 187 | 'method' => 'find_any', | ||||||||||||||||||||
| 188 | 'description' => 'Select for java files (borrowed from ack)' | ||||||||||||||||||||
| 189 | }, | ||||||||||||||||||||
| 190 | ':tt' => { | ||||||||||||||||||||
| 191 | 'terms' => [ | ||||||||||||||||||||
| 192 | '\\.tt$', | ||||||||||||||||||||
| 193 | '\\.tt2$' | ||||||||||||||||||||
| 194 | ], | ||||||||||||||||||||
| 195 | 'modifiers' => '', | ||||||||||||||||||||
| 196 | 'method' => 'find_any', | ||||||||||||||||||||
| 197 | 'description' => 'Select for tt files (borrowed from ack)' | ||||||||||||||||||||
| 198 | }, | ||||||||||||||||||||
| 199 | ':perl' => { | ||||||||||||||||||||
| 200 | 'terms' => [ | ||||||||||||||||||||
| 201 | '\\.pl$', | ||||||||||||||||||||
| 202 | '\\.pm$', | ||||||||||||||||||||
| 203 | '\\.pod$', | ||||||||||||||||||||
| 204 | '\\.tt$', | ||||||||||||||||||||
| 205 | '\\.ttml$', | ||||||||||||||||||||
| 206 | '\\.t$' | ||||||||||||||||||||
| 207 | ], | ||||||||||||||||||||
| 208 | 'modifiers' => '', | ||||||||||||||||||||
| 209 | 'method' => 'find_any', | ||||||||||||||||||||
| 210 | 'description' => 'Select for perl files (borrowed from ack)' | ||||||||||||||||||||
| 211 | }, | ||||||||||||||||||||
| 212 | ':mason' => { | ||||||||||||||||||||
| 213 | 'terms' => [ | ||||||||||||||||||||
| 214 | '\\.mas$' | ||||||||||||||||||||
| 215 | ], | ||||||||||||||||||||
| 216 | 'modifiers' => '', | ||||||||||||||||||||
| 217 | 'method' => 'find_any', | ||||||||||||||||||||
| 218 | 'description' => 'Select for mason files (borrowed from ack)' | ||||||||||||||||||||
| 219 | }, | ||||||||||||||||||||
| 220 | ':css' => { | ||||||||||||||||||||
| 221 | 'terms' => [ | ||||||||||||||||||||
| 222 | '\\.css$' | ||||||||||||||||||||
| 223 | ], | ||||||||||||||||||||
| 224 | 'modifiers' => '', | ||||||||||||||||||||
| 225 | 'method' => 'find_any', | ||||||||||||||||||||
| 226 | 'description' => 'Select for css files (borrowed from ack)' | ||||||||||||||||||||
| 227 | }, | ||||||||||||||||||||
| 228 | ':elisp' => { | ||||||||||||||||||||
| 229 | 'terms' => [ | ||||||||||||||||||||
| 230 | '\\.el$' | ||||||||||||||||||||
| 231 | ], | ||||||||||||||||||||
| 232 | 'modifiers' => '', | ||||||||||||||||||||
| 233 | 'method' => 'find_any', | ||||||||||||||||||||
| 234 | 'description' => 'Select for elisp files (borrowed from ack)' | ||||||||||||||||||||
| 235 | }, | ||||||||||||||||||||
| 236 | ':csharp' => { | ||||||||||||||||||||
| 237 | 'terms' => [ | ||||||||||||||||||||
| 238 | '\\.cs$' | ||||||||||||||||||||
| 239 | ], | ||||||||||||||||||||
| 240 | 'modifiers' => '', | ||||||||||||||||||||
| 241 | 'method' => 'find_any', | ||||||||||||||||||||
| 242 | 'description' => 'Select for csharp files (borrowed from ack)' | ||||||||||||||||||||
| 243 | }, | ||||||||||||||||||||
| 244 | ':asm' => { | ||||||||||||||||||||
| 245 | 'terms' => [ | ||||||||||||||||||||
| 246 | '\\.s$', | ||||||||||||||||||||
| 247 | '\\.S$' | ||||||||||||||||||||
| 248 | ], | ||||||||||||||||||||
| 249 | 'modifiers' => '', | ||||||||||||||||||||
| 250 | 'method' => 'find_any', | ||||||||||||||||||||
| 251 | 'description' => 'Select for asm files (borrowed from ack)' | ||||||||||||||||||||
| 252 | }, | ||||||||||||||||||||
| 253 | ':ruby' => { | ||||||||||||||||||||
| 254 | 'terms' => [ | ||||||||||||||||||||
| 255 | '\\.rb$', | ||||||||||||||||||||
| 256 | '\\.rhtml$', | ||||||||||||||||||||
| 257 | '\\.rjs$' | ||||||||||||||||||||
| 258 | ], | ||||||||||||||||||||
| 259 | 'modifiers' => '', | ||||||||||||||||||||
| 260 | 'method' => 'find_any', | ||||||||||||||||||||
| 261 | 'description' => 'Select for ruby files (borrowed from ack)' | ||||||||||||||||||||
| 262 | }, | ||||||||||||||||||||
| 263 | ':php' => { | ||||||||||||||||||||
| 264 | 'terms' => [ | ||||||||||||||||||||
| 265 | '\\.php$', | ||||||||||||||||||||
| 266 | '\\.phpt$' | ||||||||||||||||||||
| 267 | ], | ||||||||||||||||||||
| 268 | 'modifiers' => '', | ||||||||||||||||||||
| 269 | 'method' => 'find_any', | ||||||||||||||||||||
| 270 | 'description' => 'Select for php files (borrowed from ack)' | ||||||||||||||||||||
| 271 | }, | ||||||||||||||||||||
| 272 | ':sql' => { | ||||||||||||||||||||
| 273 | 'terms' => [ | ||||||||||||||||||||
| 274 | '\\.sql$', | ||||||||||||||||||||
| 275 | '\\.ctl$' | ||||||||||||||||||||
| 276 | ], | ||||||||||||||||||||
| 277 | 'modifiers' => '', | ||||||||||||||||||||
| 278 | 'method' => 'find_any', | ||||||||||||||||||||
| 279 | 'description' => 'Select for sql files (borrowed from ack)' | ||||||||||||||||||||
| 280 | }, | ||||||||||||||||||||
| 281 | ':parrot' => { | ||||||||||||||||||||
| 282 | 'terms' => [ | ||||||||||||||||||||
| 283 | '\\.pir$', | ||||||||||||||||||||
| 284 | '\\.pasm$', | ||||||||||||||||||||
| 285 | '\\.pmc$', | ||||||||||||||||||||
| 286 | '\\.ops$', | ||||||||||||||||||||
| 287 | '\\.pod$', | ||||||||||||||||||||
| 288 | '\\.pg$', | ||||||||||||||||||||
| 289 | '\\.tg$' | ||||||||||||||||||||
| 290 | ], | ||||||||||||||||||||
| 291 | 'modifiers' => '', | ||||||||||||||||||||
| 292 | 'method' => 'find_any', | ||||||||||||||||||||
| 293 | 'description' => 'Select for parrot files (borrowed from ack)' | ||||||||||||||||||||
| 294 | }, | ||||||||||||||||||||
| 295 | ':cc' => { | ||||||||||||||||||||
| 296 | 'terms' => [ | ||||||||||||||||||||
| 297 | '\\.c$', | ||||||||||||||||||||
| 298 | '\\.h$', | ||||||||||||||||||||
| 299 | '\\.xs$' | ||||||||||||||||||||
| 300 | ], | ||||||||||||||||||||
| 301 | 'modifiers' => '', | ||||||||||||||||||||
| 302 | 'method' => 'find_any', | ||||||||||||||||||||
| 303 | 'description' => 'Select for cc files (borrowed from ack)' | ||||||||||||||||||||
| 304 | }, | ||||||||||||||||||||
| 305 | ':cpp' => { | ||||||||||||||||||||
| 306 | 'terms' => [ | ||||||||||||||||||||
| 307 | '\\.cpp$', | ||||||||||||||||||||
| 308 | '\\.m$', | ||||||||||||||||||||
| 309 | '\\.h$', | ||||||||||||||||||||
| 310 | '\\.C$', | ||||||||||||||||||||
| 311 | '\\.H$' | ||||||||||||||||||||
| 312 | ], | ||||||||||||||||||||
| 313 | 'modifiers' => '', | ||||||||||||||||||||
| 314 | 'method' => 'find_any', | ||||||||||||||||||||
| 315 | 'description' => 'Select for cpp files (borrowed from ack)' | ||||||||||||||||||||
| 316 | }, | ||||||||||||||||||||
| 317 | ':ocaml' => { | ||||||||||||||||||||
| 318 | 'terms' => [ | ||||||||||||||||||||
| 319 | '\\.ml$', | ||||||||||||||||||||
| 320 | '\\.mli$' | ||||||||||||||||||||
| 321 | ], | ||||||||||||||||||||
| 322 | 'modifiers' => '', | ||||||||||||||||||||
| 323 | 'method' => 'find_any', | ||||||||||||||||||||
| 324 | 'description' => 'Select for ocaml files (borrowed from ack)' | ||||||||||||||||||||
| 325 | }, | ||||||||||||||||||||
| 326 | ':xml' => { | ||||||||||||||||||||
| 327 | 'terms' => [ | ||||||||||||||||||||
| 328 | '\\.xml$', | ||||||||||||||||||||
| 329 | '\\.dtd$', | ||||||||||||||||||||
| 330 | '\\.xslt$' | ||||||||||||||||||||
| 331 | ], | ||||||||||||||||||||
| 332 | 'modifiers' => '', | ||||||||||||||||||||
| 333 | 'method' => 'find_any', | ||||||||||||||||||||
| 334 | 'description' => 'Select for xml files (borrowed from ack)' | ||||||||||||||||||||
| 335 | }, | ||||||||||||||||||||
| 336 | ':scheme' => { | ||||||||||||||||||||
| 337 | 'terms' => [ | ||||||||||||||||||||
| 338 | '\\.scm$' | ||||||||||||||||||||
| 339 | ], | ||||||||||||||||||||
| 340 | 'modifiers' => '', | ||||||||||||||||||||
| 341 | 'method' => 'find_any', | ||||||||||||||||||||
| 342 | 'description' => 'Select for scheme files (borrowed from ack)' | ||||||||||||||||||||
| 343 | }, | ||||||||||||||||||||
| 344 | ':haskell' => { | ||||||||||||||||||||
| 345 | 'terms' => [ | ||||||||||||||||||||
| 346 | '\\.hs$', | ||||||||||||||||||||
| 347 | '\\.lhs$' | ||||||||||||||||||||
| 348 | ], | ||||||||||||||||||||
| 349 | 'modifiers' => '', | ||||||||||||||||||||
| 350 | 'method' => 'find_any', | ||||||||||||||||||||
| 351 | 'description' => 'Select for haskell files (borrowed from ack)' | ||||||||||||||||||||
| 352 | }, | ||||||||||||||||||||
| 353 | ':yaml' => { | ||||||||||||||||||||
| 354 | 'terms' => [ | ||||||||||||||||||||
| 355 | '\\.yaml$', | ||||||||||||||||||||
| 356 | '\\.yml$' | ||||||||||||||||||||
| 357 | ], | ||||||||||||||||||||
| 358 | 'modifiers' => '', | ||||||||||||||||||||
| 359 | 'method' => 'find_any', | ||||||||||||||||||||
| 360 | 'description' => 'Select for yaml files (borrowed from ack)' | ||||||||||||||||||||
| 361 | } | ||||||||||||||||||||
| 362 | }; | ||||||||||||||||||||
| 363 | } | ||||||||||||||||||||
| 364 | |||||||||||||||||||||
| 365 | |||||||||||||||||||||
| 366 | =back | ||||||||||||||||||||
| 367 | |||||||||||||||||||||
| 368 | =head2 basic setters and getters | ||||||||||||||||||||
| 369 | |||||||||||||||||||||
| 370 | =over | ||||||||||||||||||||
| 371 | |||||||||||||||||||||
| 372 | =item storage_handler | ||||||||||||||||||||
| 373 | |||||||||||||||||||||
| 374 | Getter for object attribute storage_handler | ||||||||||||||||||||
| 375 | |||||||||||||||||||||
| 376 | =cut | ||||||||||||||||||||
| 377 | |||||||||||||||||||||
| 378 | 0 | ▶ | sub storage_handler { | ||||||||||||||||||
|
Subroutine
storage_handler: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 379 | 0 | my $self = shift; | |||||||||||||||||||
| 380 | 0 | my $lfs = $self->{ storage_handler }; | |||||||||||||||||||
| 381 | 0 | return $lfs; | |||||||||||||||||||
| 382 | } | ||||||||||||||||||||
| 383 | |||||||||||||||||||||
| 384 | =item set_storage_handler | ||||||||||||||||||||
| 385 | |||||||||||||||||||||
| 386 | Setter for object attribute set_storage_handler | ||||||||||||||||||||
| 387 | |||||||||||||||||||||
| 388 | =cut | ||||||||||||||||||||
| 389 | |||||||||||||||||||||
| 390 | 0 | ▶ | sub set_storage_handler { | ||||||||||||||||||
|
Subroutine
set_storage_handler: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 391 | 0 | my $self = shift; | |||||||||||||||||||
| 392 | 0 | my $lfs = shift; | |||||||||||||||||||
| 393 | 0 | $self->{ storage_handler } = $lfs; | |||||||||||||||||||
| 394 | 0 | return $lfs; | |||||||||||||||||||
| 395 | } | ||||||||||||||||||||
| 396 | |||||||||||||||||||||
| 397 | |||||||||||||||||||||
| 398 | # =back | ||||||||||||||||||||
| 399 | |||||||||||||||||||||
| 400 | # =head2 automatic generation of accessors | ||||||||||||||||||||
| 401 | |||||||||||||||||||||
| 402 | # =over | ||||||||||||||||||||
| 403 | |||||||||||||||||||||
| 404 | # =item AUTOLOAD | ||||||||||||||||||||
| 405 | |||||||||||||||||||||
| 406 | # =back | ||||||||||||||||||||
| 407 | |||||||||||||||||||||
| 408 | # =cut | ||||||||||||||||||||
| 409 | |||||||||||||||||||||
| 410 | # sub AUTOLOAD { | ||||||||||||||||||||
| 411 | # return if $AUTOLOAD =~ /DESTROY$/; # skip calls to DESTROY () | ||||||||||||||||||||
| 412 | |||||||||||||||||||||
| 413 | # my ($name) = $AUTOLOAD =~ /([^:]+)$/; # extract method name | ||||||||||||||||||||
| 414 | # (my $field = $name) =~ s/^set_//; | ||||||||||||||||||||
| 415 | |||||||||||||||||||||
| 416 | # # check that this is a valid accessor call | ||||||||||||||||||||
| 417 | # croak("Unknown method '$AUTOLOAD' called") | ||||||||||||||||||||
| 418 | # unless defined( $ATTRIBUTES{ $field } ); | ||||||||||||||||||||
| 419 | |||||||||||||||||||||
| 420 | # { no strict 'refs'; | ||||||||||||||||||||
| 421 | |||||||||||||||||||||
| 422 | # # create the setter and getter and install them in the symbol table | ||||||||||||||||||||
| 423 | |||||||||||||||||||||
| 424 | # if ( $name =~ /^set_/ ) { | ||||||||||||||||||||
| 425 | |||||||||||||||||||||
| 426 | # *$name = sub { | ||||||||||||||||||||
| 427 | # my $self = shift; | ||||||||||||||||||||
| 428 | # $self->{ $field } = shift; | ||||||||||||||||||||
| 429 | # return $self->{ $field }; | ||||||||||||||||||||
| 430 | # }; | ||||||||||||||||||||
| 431 | |||||||||||||||||||||
| 432 | # goto &$name; # jump to the new method. | ||||||||||||||||||||
| 433 | # } elsif ( $name =~ /^get_/ ) { | ||||||||||||||||||||
| 434 | # carp("Apparent attempt at using a getter with unneeded 'get_' prefix."); | ||||||||||||||||||||
| 435 | # } | ||||||||||||||||||||
| 436 | |||||||||||||||||||||
| 437 | # *$name = sub { | ||||||||||||||||||||
| 438 | # my $self = shift; | ||||||||||||||||||||
| 439 | # return $self->{ $field }; | ||||||||||||||||||||
| 440 | # }; | ||||||||||||||||||||
| 441 | |||||||||||||||||||||
| 442 | # goto &$name; # jump to the new method. | ||||||||||||||||||||
| 443 | # } | ||||||||||||||||||||
| 444 | # } | ||||||||||||||||||||
| 445 | |||||||||||||||||||||
| 446 | |||||||||||||||||||||
| 447 | 1 | 1; | |||||||||||||||||||
| 448 | |||||||||||||||||||||
| 449 | =back | ||||||||||||||||||||
| 450 | |||||||||||||||||||||
| 451 | =head1 SEE ALSO | ||||||||||||||||||||
| 452 | |||||||||||||||||||||
| 453 | Mention other useful documentation such as the documentation of | ||||||||||||||||||||
| 454 | related modules or operating system documentation (such as man pages | ||||||||||||||||||||
| 455 | in UNIX), or any relevant external documentation such as RFCs or | ||||||||||||||||||||
| 456 | standards. | ||||||||||||||||||||
| 457 | |||||||||||||||||||||
| 458 | If you have a mailing list set up for your module, mention it here. | ||||||||||||||||||||
| 459 | |||||||||||||||||||||
| 460 | If you have a web site set up for your module, mention it here. | ||||||||||||||||||||
| 461 | |||||||||||||||||||||
| 462 | =head1 AUTHOR | ||||||||||||||||||||
| 463 | |||||||||||||||||||||
| 464 | Joseph Brenner, E<lt>doom@kzsu.stanford.eduE<gt>, | ||||||||||||||||||||
| 465 | 18 Jun 2007 | ||||||||||||||||||||
| 466 | |||||||||||||||||||||
| 467 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 468 | |||||||||||||||||||||
| 469 | Copyright (C) 2007 by Joseph Brenner | ||||||||||||||||||||
| 470 | |||||||||||||||||||||
| 471 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||
| 472 | it under the same terms as Perl itself, either Perl version 5.8.2 or, | ||||||||||||||||||||
| 473 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||
| 474 | |||||||||||||||||||||
| 475 | =head1 BUGS | ||||||||||||||||||||
| 476 | |||||||||||||||||||||
| 477 | None reported... yet. | ||||||||||||||||||||
| 478 | |||||||||||||||||||||
| 479 | =cut | ||||||||||||||||||||