in reply to Ref to Method?

In theory, you could bless your code reference $new into the package Foo, in order to associate a type with it:

package Foo; sub new { my $arg = shift; my $class = ref($arg) || $arg; # finally some use for this cargo- +cult thing :) print "creating object of type $class\n"; return bless {}, $class; } package main; use strict; use warnings; my $new = bless \&Foo::new, "Foo"; # code object # and then one of: my $obj; $obj = $new->(ref($new)); # passes "Foo" $obj = $new->($new); # passes code object of type Foo $obj = $new->new(); # passes code object of type Foo $obj = $new->$new(); # passes code object of type Foo

But don't do it, it's too confusing...  Also, you couldn't store/pass around any other args this way, as with the closure.