Commit | Line | Data |
a798dbf2 |
1 | package O; |
2 | use B qw(minus_c); |
3 | use Carp; |
4 | |
5 | sub import { |
6 | my ($class, $backend, @options) = @_; |
7 | eval "use B::$backend ()"; |
8 | if ($@) { |
9 | croak "use of backend $backend failed: $@"; |
10 | } |
11 | my $compilesub = &{"B::${backend}::compile"}(@options); |
12 | if (ref($compilesub) eq "CODE") { |
13 | minus_c; |
14 | eval 'END { &$compilesub() }'; |
15 | } else { |
16 | die $compilesub; |
17 | } |
18 | } |
19 | |
20 | 1; |
21 | |
7f20e9dd |
22 | __END__ |
23 | |
24 | =head1 NAME |
25 | |
26 | O - Generic interface to Perl Compiler backends |
27 | |
28 | =head1 SYNOPSIS |
29 | |
30 | perl -MO=Backend[,OPTIONS] foo.pl |
31 | |
32 | =head1 DESCRIPTION |
33 | |
34 | See F<ext/B/README>. |
35 | |
36 | =head1 AUTHOR |
37 | |
38 | Malcolm Beattie, C<mbeattie@sable.ox.ac.uk> |
39 | |
40 | =cut |