| … | |
… | |
| 29 | dbEncode |
29 | dbEncode |
| 30 | decodeAnswers |
30 | decodeAnswers |
| 31 | encodeAnswers |
31 | encodeAnswers |
| 32 | ref2string |
32 | ref2string |
| 33 | dequoteHere |
33 | dequoteHere |
|
|
34 | wrapText |
| 34 | ); |
35 | ); |
| 35 | |
36 | |
| 36 | sub runtime_use($) { |
37 | sub runtime_use($) { |
| 37 | return unless @_; |
38 | return unless @_; |
| 38 | eval "package Main; require $_[0]; import $_[0]"; |
39 | eval "package Main; require $_[0]; import $_[0]"; |
| … | |
… | |
| 201 | return "ARRAY" if eval { $_ = @$ref; 1 }; |
202 | return "ARRAY" if eval { $_ = @$ref; 1 }; |
| 202 | return "SCALAR" if eval { $_ = $$ref; 1 }; |
203 | return "SCALAR" if eval { $_ = $$ref; 1 }; |
| 203 | return 0; |
204 | return 0; |
| 204 | } |
205 | } |
| 205 | |
206 | |
| 206 | sub dequoteHere($) { |
|
|
| 207 | # from "1.11. Indenting Here Documents" in the Perl Cookbook |
|
|
| 208 | # by Tom Christiansen & Nathan Torkington |
|
|
| 209 | local $_ = shift; |
|
|
| 210 | my ($white, $leader); # common whitespace and common leading string |
|
|
| 211 | if (/^\s*(?:([^\w\s]+)(\s*).*\n)(?:\s*\1\2?.*\n)+$/) { |
|
|
| 212 | ($white, $leader) = ($2, quotemeta($1)); |
|
|
| 213 | } else { |
|
|
| 214 | ($white, $leader) = (/^(\s+)/, ''); |
|
|
| 215 | } |
|
|
| 216 | s/^\s*?$leader(?:$white)?//gm; |
|
|
| 217 | return $_; |
|
|
| 218 | } |
|
|
| 219 | |
|
|
| 220 | 1; |
207 | 1; |