DiaColloDB

 view release on metacpan or  search on metacpan

DiaColloDB/Compat.pm  view on Meta::CPAN


## $bool = $that->usecompat($pkg)
##  + attempts to "use DiaColloDB::Compat::$pkg", throwing an error on failure
sub usecompat {
  my $that = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
  my $pkg  = shift;
  (my $file = $pkg) =~ s{::}{/}g;
  $file   .= ".pm" if ($file !~ /\.pm$/);
  $file    = "DiaColloDB/Compat/$file" if ($file !~ m{^DiaColloDB/Compat/});
  my ($rc);
  eval { $rc = require $file };
  $that->logconfess("failed to load compatibility package $pkg".($@ ? ": $@" : '')) if ($@ || !$rc);
  return $rc;
}

## \&dummyMethodCode = $that->nocompat($methodName)
##   + wrapper for subclasses which do not implement some API methods
sub nocompat {
  my $that   = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : undef;
  my $method = shift;
  return sub {



( run in 0.351 second using v1.01-cache-2.11-cpan-0d8aa00de5b )