Yenta/Customize.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 39 CC 3 SCAR 19.5
CC
3
Cov
0%
customize
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-Jan-26 10:37 (EST)
6 # Function: connect user provided implementation
7 #
8 # $Id$
9  
10 package AC::Yenta::Customize;
11 use strict;
12  
13 sub customize {
14 my $class = shift;
15 my $implby = shift;
16  
17 (my $default = $class) =~ s/(.*)::([^:]+)$/$1::Default::$2/;
18  
19 # load user's implemantation + default
20 for my $p ($implby, $default){
21 eval "require $p" if $p;
22 die $@ if $@;
23 }
24  
25 # import/export
26 no strict;
27 no warnings;
28 for my $f ( @{$class . '::CUSTOM'} ){
29 *{$class . '::' . $f} = ($implby && $implby->can($f)) || $default->can($f);
30 }
31 }
32  
33 1;