| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## | ||
| 3 | ## File: DTA::CAB::Analyzer::Cache::Static::BDB.pm | ||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 5 | ## Description: DTA static cache | ||
| 6 | |||
| 7 | ##============================================================================== | ||
| 8 | ## Package: Cache::Static: BDB | ||
| 9 | ##============================================================================== | ||
| 10 | package DTA::CAB::Analyzer::Cache::Static::BDB; | ||
| 11 | use DTA::CAB::Analyzer ':child'; | ||
| 12 | use DTA::CAB::Analyzer::Dict::JsonDB; | ||
| 13 | use Carp; | ||
| 14 | use strict; | ||
| 15 | our @ISA = qw(DTA::CAB::Analyzer::Dict::JsonDB); | ||
| 16 | |||
| 17 | ## $obj = CLASS_OR_OBJ->new(%args) | ||
| 18 | sub new { | ||
| 19 | my $that = shift; | ||
| 20 | my $dic = $that->SUPER::new( | ||
| 21 | ##-- overrides | ||
| 22 | label => 'cache', | ||
| 23 | typeKeys => undef, ##-- see below | ||
| 24 | analyzeCode =>join("\n", | ||
| 25 | ( | ||
| 26 | 'return if (!defined($val=$dhash->{' | ||
| 27 | #._am_xlit('$_') | ||
| 28 | .'$_->{text}' | ||
| 29 | .'}));' | ||
| 30 | ), | ||
| 31 | '$val=$jxs->decode($val);', | ||
| 32 | '@$_{keys %$val}=(values %$val);', | ||
| 33 | ), | ||
| 34 | |||
| 35 | ##-- user args | ||
| 36 | @_ | ||
| 37 | ); | ||
| 38 | |||
| 39 | ##-- set type keys from DTA::CAB::Chain::DTA if possible and not already set | ||
| 40 | $dic->{typeKeys} = [DTA::CAB::Chain::DTA->new->typeKeys()] if (!$dic->{typeKeys} && DTA::CAB::Chain::DTA->can('new')); | ||
| 41 | return $dic; | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; ##-- be happy | ||
| 45 | |||
| 46 | __END__ |