perl_command
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | perl_command [2006/07/28 04:14] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | #$EPIC: perl_command.txt, | ||
| + | ======Synopsis: | ||
| + | [[perl_command|perl]] {//perl statement// | ||
| + | |||
| + | ======Purpose: | ||
| + | If EPIC was linked with an embedded perl interpreter, | ||
| + | shall be executed by perl. If EPIC was not linked against perl, then no | ||
| + | action shall take place. | ||
| + | |||
| + | Although every //perl statement// resolves to a (perl) scalar value, that | ||
| + | (perl) scalar value is discarded when you run it this way. | ||
| + | |||
| + | If the //perl statement// has an error, the result is undefined, but usually | ||
| + | an error message is output to the window. | ||
| + | |||
| + | Remember that the insides of {}s are protected from ircII expansion, so if | ||
| + | you want to pass ircII values into your perl script, you do best to export | ||
| + | the value to perl using the [[perl function]] first. | ||
| + | should be a literal segment of perl code. | ||
| + | |||
| + | You can call back to EPIC from perl: | ||
| + | |EPIC:: | ||
| + | |EPIC:: | ||
| + | |EPIC:: | ||
| + | |EPIC:: | ||
| + | |EPIC:: | ||
| + | |||
| + | You are permitted to register perl END blocks. | ||
| + | initiates shutdown procedures. | ||
| + | |||
| + | ======Examples: | ||
| + | < | ||
| + | PERL { do script.pl } | ||
| + | Loads and runs script.pl. | ||
| + | |||
| + | PERL { use Time:: | ||
| + | Loads the standard perl module Time:: | ||
| + | |||
| + | PERL { | ||
| + | sub foo { | ||
| + | reverse(wantarray ? @_ : " | ||
| + | } | ||
| + | } | ||
| + | Defines a perl subroutine which returns the reverse of its input, whether | ||
| + | it is called in scalar or list context. | ||
| + | |||
| + | PERL { | ||
| + | push @array, "value with $perlvar" | ||
| + | } | ||
| + | Pushes a string containing a perl variable into a perl array. | ||
| + | |||
| + | PERL \{ | ||
| + | push @array, "value with $epicvar" | ||
| + | \} | ||
| + | Pushes a string containing an EPIC variable into a perl array. | ||
| + | DANGER -- be careful with [[quoting hell]]. | ||
| + | </ | ||
| + | |||
| + | ======History: | ||
| + | The [[perl command]] first appeared in EPIC5-0.3.1. | ||
perl_command.txt · Last modified: 2006/07/28 04:14 by 127.0.0.1
