DTA-CAB

 view release on metacpan or  search on metacpan

CAB/Analyzer.pm  view on Meta::CPAN

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## File: DTA::CAB::Analyzer.pm
## Author: Bryan Jurish <moocow@cpan.org>
## Description: generic analyzer API
 
use DTA::CAB::Datum ':all';
use DTA::CAB::Utils ':minmax', ':files', ':time';
use File::Basename qw(basename dirname);
use Scalar::Util qw(weaken);
use Carp;
use strict;
 
##==============================================================================
## Globals
##==============================================================================
 
our @ISA = qw(Exporter DTA::CAB::Persistent);

CAB/Analyzer.pm  view on Meta::CPAN

520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
}
 
## \&closure = $anl->getAnalyzeClosure($which)
##  + returns closure \&closure for analyzing data of type "$which"
##    (e.g. Word, Type, Token, Sentence, Document, ...)
##  + default implementation calls $anl->getAnalyze"${which}"Closure() if
##    available, otherwise croak()s
sub getAnalyzeClosure {
  my ($anl,$which) = @_;
  my $getsub = $anl->can("getAnalyze${which}Closure");
  weaken($anl);
  return $getsub->($anl) if ($getsub);
  $anl->logconfess("getAnalyzeClosure('$which'): no getAnalyze${which}Closure() method defined!");
}
 
##------------------------------------------------------------------------
## Methods: Analysis: (Token-)Accessor Closures
 
## $closure = $anl->accessClosure( $methodName, %opts);
## $closure = $anl->accessClosure(\&codeRef,    %opts);
## $closure = $anl->accessClosure( $codeString, %opts);

CAB/Analyzer.pm  view on Meta::CPAN

569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
           .($code =~ /\bsub\b/ ? $code : "sub { $code }")
          );
 
  print STDERR
    ((ref($anl)||$anl), "->accessClosure():\n$code\n") if (0 || (ref($anl) && $anl->{debugAccessClosure}));
 
  my $do_cache = !exists($opts{cache}) || $opts{cache};
  my $sub      = ($do_cache ? $CLOSURE_CACHE{$anl}{$code} : undef);
  my $cached   = $sub ? 1 : 0;
 
  weaken($anl);
  $sub       ||= eval $code;
  $anl->logcluck("accessClosure(): could not compile closure {$code}: $@") if (!$sub);
  $CLOSURE_CACHE{$anl}{$code} = $sub if ($do_cache && !$cached);
 
  return $sub;
}
 
## PACKAGE::_am_xlit($tokvar='$_')
##  + access-closure macro (EXPR): get text (xlit.latin1Text << text) for token $$tokvar
##  + evaluates to a string:

Makefile.PL  view on Meta::CPAN

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'XML::LibXML' => 2.0001,
'Template' =>0,
'LWP::UserAgent' =>0,
'HTTP::Daemon' =>0,
'HTTP::Daemon::UNIX' =>0, #0.06
##--
'Log::Log4perl' => 1.07,
'Unicode::String' => 2.09,
'RPC::XML' => 0.59,
##
'Scalar::Util' => 0, ##-- for weaken()
##
#'Log::Dispatch' => 2.22, ##-- for cab servers, FileRotate
##--
#'DocClassify' => 0.04,
#'Lingua::LangId' => 0.01,
##--
#'Text::Unidecode' => 0.04,
#'Tie::Cache'=>0,
#'Unicode::UCD' =>0,
#'Unicode::CharName' =>0,



( run in 0.329 second using v1.01-cache-2.11-cpan-e9199f4ba4c )