- or download this
sub _detect_type {
... # logic to determine type
return \&_open_unzipped if $rule1;
return \&_open_zipped if $rule2;
return undef;
}
- or download this
package Import;
use Exporter;
...
sub _open_zipped {...}
sub _open_unzipped {...}
1;
- or download this
use Test::More qw(no_plan);
use Import qw(:TEST);
...
is($test1, $result1);
is($test2, $result2);
...
- or download this
is(_detect_type('unzipped.txt'), \&open_unzipped);
is(_detect_type('zipped.zip'), \&open_zipped);