[Thamesvalley-pm] using third party perl scripts
gmatt at nerc.ac.uk
Wed Oct 17 04:37:02 PDT 2007
Ismail, Rafiq (IT) wrote:
>>> do EXPR
>> its not clear from the docs whether you can capture output
>> from "do" (as I do above with the pipe).
> Short answer no. However you can capture the output from STDOUT:
thanks for the various advice. I must admit I was concerned with using
"do". I was thinking about using it for config file slurping but was
wondering what would happen if some malicious/ignorant user had write
access to the config file... presumably they could execute any perl code
they wanted as the userid that the main script is running as?
As for taking the code out of the 3rd party perl script - I am loathe to
do this as the script is in active development and I would have to
deconstruct new versions as they were published creating lots of work
for something that is supposed to save me lots of work!
So far, using pipes looks the best option.
ps this particular project is the first time I'm using perl to produce
html so I will probably have questions about that soon too!
> Use FileHandle;
> my $stdoutCapture;
> open FAKE_OUT, ">", \$stdoutCapture;
> select (FAKE_OUT);
> do "script";
> close FAKE_OUT;
> select (STDOUT)
> ## Examine $stdoutCapture
> NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
> Thamesvalley-pm mailing list
> Thamesvalley-pm at pm.org
Greg Matthews 01491 692445
Head of UNIX/Linux, iTSS Wallingford
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.
More information about the Thamesvalley-pm