| 1 | package | ||||||||||
| 2 | XS::Install::FrozenShit::ParseXS::Eval; | ||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '3.57'; | |||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | XS::Install::FrozenShit::ParseXS::Eval - Clean package to evaluate code in | ||||||||||
| 11 | |||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||
| 13 | |||||||||||
| 14 | use XS::Install::FrozenShit::ParseXS::Eval; | ||||||||||
| 15 | my $rv = XS::Install::FrozenShit::ParseXS::Eval::eval_typemap_code( | ||||||||||
| 16 | $parsexs_obj, "some Perl code" | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | =head1 SUBROUTINES | ||||||||||
| 20 | |||||||||||
| 21 | =head2 $pxs->eval_output_typemap_code($typemapcode, $other_hashref) | ||||||||||
| 22 | |||||||||||
| 23 | Sets up various bits of previously global state | ||||||||||
| 24 | (formerly XS::Install::FrozenShit::ParseXS package variables) | ||||||||||
| 25 | for eval'ing output typemap code that may refer to these | ||||||||||
| 26 | variables. | ||||||||||
| 27 | |||||||||||
| 28 | Warns the contents of C<$@> if any. | ||||||||||
| 29 | |||||||||||
| 30 | Not all these variables are necessarily considered "public" wrt. use in | ||||||||||
| 31 | typemaps, so beware. Variables set up from the XS::Install::FrozenShit::ParseXS object: | ||||||||||
| 32 | |||||||||||
| 33 | $Package $ALIAS $func_name $Full_func_name $pname | ||||||||||
| 34 | |||||||||||
| 35 | Variables set up from C<$other_hashref>: | ||||||||||
| 36 | |||||||||||
| 37 | $var $type $ntype $subtype $arg | ||||||||||
| 38 | |||||||||||
| 39 | =cut | ||||||||||
| 40 | |||||||||||
| 41 | 2 | ▶ | sub eval_output_typemap_code { | ||||||||
|
Subroutine
eval_output_typemap_code: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 42 | 2 | my ($_pxs, $_code, $_other) = @_; | |||||||||
| 43 | |||||||||||
| 44 | my ($Package, $ALIAS, $func_name, $Full_func_name, $pname) | ||||||||||
| 45 | 2 | = @{$_pxs}{qw(PACKAGE_name xsub_seen_ALIAS xsub_func_name | |||||||||
| 46 | xsub_func_full_C_name xsub_func_full_perl_name)}; | ||||||||||
| 47 | |||||||||||
| 48 | my ($var, $type, $ntype, $subtype, $arg) | ||||||||||
| 49 | 2 | = @{$_other}{qw(var type ntype subtype arg)}; | |||||||||
| 50 | |||||||||||
| 51 | 2 | my $rv = eval $_code; | |||||||||
| 52 | 2 | ▶ | warn $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 2 | return $rv; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | =head2 $pxs->eval_input_typemap_code($typemapcode, $other_hashref) | ||||||||||
| 57 | |||||||||||
| 58 | Sets up various bits of previously global state | ||||||||||
| 59 | (formerly XS::Install::FrozenShit::ParseXS package variables) | ||||||||||
| 60 | for eval'ing output typemap code that may refer to these | ||||||||||
| 61 | variables. | ||||||||||
| 62 | |||||||||||
| 63 | Warns the contents of C<$@> if any. | ||||||||||
| 64 | |||||||||||
| 65 | Not all these variables are necessarily considered "public" wrt. use in | ||||||||||
| 66 | typemaps, so beware. Variables set up from the XS::Install::FrozenShit::ParseXS object: | ||||||||||
| 67 | |||||||||||
| 68 | $Package $ALIAS $func_name $Full_func_name $pname | ||||||||||
| 69 | |||||||||||
| 70 | Variables set up from C<$other_hashref>: | ||||||||||
| 71 | |||||||||||
| 72 | $var $type $ntype $subtype $num $init $printed_name $arg $argoff | ||||||||||
| 73 | |||||||||||
| 74 | =cut | ||||||||||
| 75 | |||||||||||
| 76 | 4 | ▶ | sub eval_input_typemap_code { | ||||||||
|
Subroutine
eval_input_typemap_code: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 77 | 4 | my ($_pxs, $_code, $_other) = @_; | |||||||||
| 78 | |||||||||||
| 79 | my ($Package, $ALIAS, $func_name, $Full_func_name, $pname) | ||||||||||
| 80 | 4 | = @{$_pxs}{qw(PACKAGE_name xsub_seen_ALIAS xsub_func_name | |||||||||
| 81 | xsub_func_full_C_name xsub_func_full_perl_name)}; | ||||||||||
| 82 | |||||||||||
| 83 | my ($var, $type, $num, $init, $printed_name, $arg, $ntype, $argoff, $subtype) | ||||||||||
| 84 | 4 | = @{$_other}{qw(var type num init printed_name arg ntype argoff subtype)}; | |||||||||
| 85 | |||||||||||
| 86 | 4 | my $rv = eval $_code; | |||||||||
| 87 | 4 | ▶ | warn $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 4 | return $rv; | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | =head1 TODO | ||||||||||
| 92 | |||||||||||
| 93 | Eventually, with better documentation and possible some cleanup, | ||||||||||
| 94 | this could be part of C<XS::Install::FrozenShit::Typemaps>. | ||||||||||
| 95 | |||||||||||
| 96 | =cut | ||||||||||
| 97 | |||||||||||
| 98 | 1 | 1; | |||||||||
| 99 | |||||||||||
| 100 | # vim: ts=2 sw=2 et: | ||||||||||