home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 June
/
PCWorld_2007-06_cd.bin
/
multimedia
/
ppsee
/
PPSeeSetup.exe
/
lib
/
bsh-commands-2.0b4.jar
/
bsh
/
commands
/
source.bsh
< prev
next >
Wrap
Text File
|
2005-05-23
|
705b
|
24 lines
/**
Read filename into the interpreter and evaluate it in the current
namespace. Like the Bourne Shell "." command.
This command acts exactly like the eval() command but reads from a file
or URL source.
@see eval() for more information.
@throws bsh.EvalError or bsh.TargetError on errors in the sourced script.
*/
bsh.help.source = "usage: source( filename | URL )";
Object source( String filename ) {
// source with filename preserves file name in error messages
return this.interpreter.source( filename, this.caller.namespace );
}
Object source( URL url ) {
return this.interpreter.eval(
new InputStreamReader(url.openStream()), this.caller.namespace,
"URL: "+url.toString()
);
}