Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from blib/lib/Inline.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Inline; | |
5 | ||
6 | #line 605 "blib/lib/Inline.pm (autosplit into blib/lib/auto/Inline/receive_code.al)" | |
7 | #============================================================================== | |
8 | # Get the source code | |
9 | #============================================================================== | |
10 | sub receive_code { | |
11 | my $o = shift; | |
12 | my $code = shift; | |
13 | ||
14 | croak M02_usage() unless (defined $code and $code); | |
15 | ||
16 | if (ref $code eq 'CODE') { | |
17 | $o->{API}{code} = &$code; | |
18 | } | |
19 | elsif (ref $code eq 'ARRAY') { | |
20 | $o->{API}{code} = join '', @$code; | |
21 | } | |
22 | elsif ($code =~ m|[/\\:]| and | |
23 | $code =~ m|^[/\\:\w.\-\ \$\[\]<>]+$|) { | |
24 | if (-f $code) { | |
25 | local ($/, *CODE); | |
26 | open CODE, "< $code" or croak M06_code_file_failed_open($code); | |
27 | $o->{API}{code} = <CODE>; | |
28 | } | |
29 | else { | |
30 | croak M07_code_file_does_not_exist($code); | |
31 | } | |
32 | } | |
33 | else { | |
34 | $o->{API}{code} = $code; | |
35 | } | |
36 | } | |
37 | ||
38 | # end of Inline::receive_code | |
39 | 1; |