perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Thames <st...@softlife.com>
Subject Nested Interpolation
Date Fri, 31 Mar 2006 13:41:32 GMT
Consider this:

	my %names = (Bob => 'Robert Brower');
	my $caption = 'Name: $names{Bob)';
	print  eval "qq|$caption|";

If you can't see it, there is a syntax error in $caption: closing
paren ) instead of brace }.  The eval will produce no $@ and will
return the empty string.

As screwy as this looks, I have a very good reason for using this
capability.  I have written a powerful code generation tool that
relies heavily on this.  

Does anyone have any idea how to capture the syntax error in a case
like this?


Mime
View raw message