| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## | ||
| 3 | ## File: DTA::CAB::Analyzer::Null.pm | ||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 5 | ## Description: null analyzer (dummy) | ||
| 6 | |||
| 7 | package DTA::CAB::Analyzer::Null; | ||
| 8 | use DTA::CAB::Analyzer; | ||
| 9 | use Carp; | ||
| 10 | use strict; | ||
| 11 | our @ISA = qw(DTA::CAB::Analyzer); | ||
| 12 | |||
| 13 | ## $obj = CLASS_OR_OBJ->new(%args) | ||
| 14 | ## + object structure, %args | ||
| 15 | ## sleepfor => $seconds, ##-- sleep for $seconds seconds on AnalyzeLocal() | ||
| 16 | ## analyzeGet => $codestr, ##-- accessor: coderef or string: source text (default=$DEFAULT_ANALYZE_GET) | ||
| 17 | sub new { | ||
| 18 | my $that = shift; | ||
| 19 | my $a = $that->SUPER::new( | ||
| 20 | ##-- analysis selection | ||
| 21 | label => 'null', | ||
| 22 | ##-- user args | ||
| 23 | @_ | ||
| 24 | ); | ||
| 25 | return $a; | ||
| 26 | } | ||
| 27 | |||
| 28 | ## $doc = $anl->analyzeLocal($doc,\%opts) | ||
| 29 | ## + perform analyzer-local document-level analysis of $doc | ||
| 30 | ## + default implementation sleeps if $anl->{sleepfor} is defined | ||
| 31 | sub analyzeLocal { | ||
| 32 | my ($anl,$doc,$opts) = @_; | ||
| 33 | my $sleep = defined($opts->{sleepfor}) ? $opts->{sleepfor} : $anl->{sleepfor}; | ||
| 34 | if ($sleep) { | ||
| 35 | $anl->vlog('trace', (ref($anl)||$anl)."::analyzeLocal(): sleepfor=$sleep"); | ||
| 36 | sleep($sleep); | ||
| 37 | } | ||
| 38 | return $doc; | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | 1; ##-- be happy | ||
| 43 | |||
| 44 | __END__ |