Initial check-in of perl compiler.
[p5sagit/p5-mst-13.2.git] / O.pm
1 package O;
2 use B qw(minus_c);
3 use Carp;    
4
5 my $compilesub;
6
7 sub import {
8     my ($class, $backend, @options) = @_;
9     eval "use B::$backend ()";
10     if ($@) {
11         croak "use of backend $backend failed: $@";
12     }
13     $compilesub = &{"B::${backend}::compile"}(@options);
14     if (ref($compilesub) eq "CODE") {
15         minus_c;
16         eval 'END { &$compilesub() }';
17     } else {
18         die $compilesub;
19     }
20 }
21
22 1;
23