[Chicago-talk] ->can and AUTOLOAD

Steven Lembark lembark at wrkhors.com
Thu Dec 4 11:08:00 CST 2003



-- Jay Strauss <me at heyjay.com>

> Here is how I did it:
>
> sub AUTOLOAD {
>
>     no strict "refs";

You are probably better off pushing this into the code
at the lowest possible level:

	my $install = sub { ... };

	{
		no strict 'refs';

		${$package . '::' . $name} = $install;
	}

	goto $install
	

This saves you from making wierd mistakes in the AUTOLOAD
that strict normally catches for you.

--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list