which fails to find your new method in package main because main is being interpreted as a glob, not as a class name. The following snippet fixes that for some values of fix (as long as you don't later want to use IO::Handle of course).perl -e 'sub new {die@_} main->new(); open main, "foo"'
Of course if in package IO::Handle you were to open a filehandle named CGI, then the workaround stops working...
package IO::Handle; sub new { *{shift(@_)}{NAME}->new(@_); }
In reply to Unconfuse filehandles and classes by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |