ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Should try work on use?
by Brent Dax other posts by this author
Sep 21 2001 8:50PM messages near this date
Re: Custom iterators | RE: Math functions? (Particularly transcendental ones)
In Configure.pl, one of the things I do is include Data::Dumper if it's
there, and skip the part that needs it otherwise.  Unfortunately,
because of the compile-time nature of use, I can't do it.  Thus, I have
to use the following hack:

	my($DDOK)=eval {
		require Data::Dumper;
		import Data::Dumper;
		1;
	}

Ugly, no?  What I propose to fix it is that, if I do something like
this:

	$DDOK=1;
	try {
		use Data::Dumper;
	}
	catch {
		$DDOK=0;
	}

and Data::Dumper doesn't load, the use statement be transmogrified:

	$DDOK=1;
	try {
		throw "Can't find Data/Dumper.pm in \@INC (\@INC contains: @INC)";
	}
	catch {
		$DDOK=0;
	}

However, the transmogrification only occurs if a use is in a try block;
otherwise we get the same die-at-compile-time behavior.

In other words, I want exceptions thrown at compile-time to be catchable
at run-time by surrounding try blocks.  Are there any barriers to this
working?  If so, what are they?

--Brent Dax
brentdax@[...].org

They *will* pay for what they've done.



Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved