| File: | blib/lib/Inline/Echo.pm |
| Coverage: | 40.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | package Inline::Echo; | |||||
| 2 | ||||||
| 3 | $VERSION = '0.01'; | |||||
| 4 | ||||||
| 5 | require Inline; | |||||
| 6 | require Inline::Interp; | |||||
| 7 | ||||||
| 8 | @ISA = qw(Inline Inline::Interp); | |||||
| 9 | ||||||
| 10 | 1 1 1 | 5 2 6 | use strict; | |||
| 11 | 1 1 1 | 5 2 9 | use Carp; | |||
| 12 | ||||||
| 13 | sub register { | |||||
| 14 | return { | |||||
| 15 | 0 | language => 'Echo', | ||||
| 16 | aliases => ['Echo', 'echo'], | |||||
| 17 | type => 'interpreted', | |||||
| 18 | suffix => 'echo', | |||||
| 19 | }; | |||||
| 20 | } | |||||
| 21 | ||||||
| 22 | sub do_load { | |||||
| 23 | 0 | my ($funcs, $code) = @_; | ||||
| 24 | ||||||
| 25 | 0 | while($code =~ m/function(\s+)([a-z0-9_]+)(\s*){(.*?)}/isg){ | ||||
| 26 | 0 | Inline::Interp::add_func($funcs, $2, $4); | ||||
| 27 | } | |||||
| 28 | } | |||||
| 29 | ||||||
| 30 | sub load { | |||||
| 31 | 0 | Inline::Interp::load(@_); | ||||
| 32 | } | |||||
| 33 | ||||||
| 34 | sub do_run { | |||||
| 35 | 0 | my ($code, $io) = @_; | ||||
| 36 | ||||||
| 37 | 0 0 | Inline::Interp::output_char($io, $_) for split //, $code; | ||||
| 38 | } | |||||
| 39 | ||||||
| 40 | 1; | |||||
| 41 | ||||||