##
package A;
sub B{
print "A::B called with args <@_>\n";
shift;
return A::B->new(@_);
}
package A::B;
sub new{
print "A::B::new called with args: <@_>\n";
return bless {}, shift;
}
1
####
A::B called with args <>
A::B::new called with args:
A::B::new called with args:
Attempt to bless into a reference at A.pm line 14.
## ##
require A;
my $test = A::B->new(test => 1);