Created
July 18, 2011 20:40
-
-
Save thoughtpolice/1090593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a perl script like this: | |
$ cat foo.pl | |
... snip ... | |
# these functions are exposed to users | |
sub func1 { | |
say "func1 arg: " . $_; | |
... | |
} | |
sub func2 { | |
say "func2 arg: " . $_; | |
... | |
} | |
sub func3 { | |
say "func3 arg: " . $_; | |
... | |
} | |
... | |
This is a script users will invoke, simply by doing something | |
$ ./foo.pl | |
in the current working directory, the user will have a file like this, which is also a perl script, but looks a bit more like a domain specific language. it uses functions from foo.pl: | |
$ cat userscript.pl | |
func1 'test1'; | |
func2 'test2'; | |
func3 'test3'; | |
$ | |
So if you were to execute my script, with userscript.pl in the current directory, you may see something like this: | |
$ ./foo.pl | |
Loading userscript.pl... | |
func1 arg: test1 | |
func2 arg: test2 | |
func3 arg: test3 | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment