You can't eval a filename, it just defines a new code block and isolates code
errors. You can do something like:
open PROGGIE, $script or die $!;
{
local($/); #locally undef $/ within {}'s
eval <PROGGIE>;
}
warn $@ if $@;
close PROGGIE;
But that doesn't execute a seperate process from which you can read it's STDOUT.
Try something more like this:
$output=`perl $script`; #note: backticks, not quotes
--or--
open PROGGIE, "perl $script |" or die $!;
foreach (<PROGGIE>) {
print "proggie: $_";
}
close PROGGIE;
Mike Kangas wrote:
> Hey all,
>
> I have a perl script that reads in other perl scripts. After it
> reads the script the original runs the new script through eval().
> Essentially what I want to happen is this. $results = eval $script; to
> capture all the STDOUT as if it were a system call. But this does not
> work. I am going to try and tie the STDOUT filehandle and create a
> string out of everything the would normally get put to STDOUT. I belive
> this will work once I get it going but would like to know if anyone have
> any better solutions.
>
> The only restriction I am putting on myself is that this redirect does
> not require the use of a flat file.
>
> Tanx.
>
> -----------
> Mike Kangas
> [EMAIL PROTECTED]
>
> ---
> You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
> To unsubscribe, forward this message to
> [EMAIL PROTECTED]
> For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]