| 1 | package Psh::Strategy::Perl; | ||
| 2 | |||
| 3 | =item * C<perl> | ||
| 4 | |||
| 5 | If the input line starts with p! all remaining input will be | ||
| 6 | sent unchanged to the perl interpreter | ||
| 7 | |||
| 8 | =cut | ||
| 9 | |||
| 10 | |||
| 11 | require Psh::Strategy; | ||
| 12 | |||
| 13 | @Psh::Strategy::Perl::ISA=('Psh::Strategy'); | ||
| 14 | |||
| 15 | sub consumes { | ||
| 16 | return Psh::Strategy::CONSUME_LINE; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub runs_before { | ||
| 20 | return qw(built_in brace); | ||
| 21 | } | ||
| 22 | |||
| 23 | sub applies { | ||
| 24 | return 'perl evaluation' if substr(${$_[1]},0,2) eq 'p!'; | ||
| 25 | } | ||
| 26 | |||
| 27 | sub execute { | ||
| 28 | ${$_[1]}= substr(${$_[1]},2); | ||
| 29 | Psh::Strategy::Eval::execute(@_); | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |