Mic

 view release on metacpan or  search on metacpan

lib/Mic/Bind.pm  view on Meta::CPAN

package Mic::Bind;
use strict;

sub import {
    my (undef, %binding) = @_;

    foreach my $class ( keys %binding ) {
        $Mic::Bound_implementation_of{$class} = $binding{$class};
    }
    strict->import();
}

1;

__END__

=head1 NAME

Mic::Bind

=head1 SYNOPSIS

    use Mic::Bind
        'Foo' => 'Foo::Fake', 
        'Bar' => 'Bar::Fake', 
    ;
    use Foo;
    use Bar;

=head1 DESCRIPTION

The implementation of a class can be easily changed from user code e.g. after the above code runs, 
Foo and bar will be bound to fake implementations (e.g. to aid with testing), instead of the implementations defined in
their respective modules.



( run in 2.546 seconds using v1.01-cache-2.11-cpan-0bb4e1dffa6 )