in reply to Constructor fails with Undefined subroutine when called as new Foo()

Hi aguidrevitch,

I think what is going on might be what is described in Indirect Object Syntax:

Perl supports another method invocation syntax called "indirect object" notation. This syntax is called "indirect" because the method comes before the object it is being invoked on. ...

my $file = new File $path, $data;

We recommend that you avoid this syntax, for several reasons.

... When used with class methods, the problem is even worse. Because Perl allows subroutine names to be written as barewords, Perl has to guess whether the bareword after the method is a class name or subroutine name. In other words, Perl can resolve the syntax as either File->new( $path, $data ) or new( File( $path, $data ) ).

To parse this code, Perl uses a heuristic based on what package names it has seen, what subroutines exist in the current package, what barewords it has previously seen, and other input. Needless to say, heuristics can produce very surprising results!

The CPAN Testers Matrix shows that Net::FTPServer 1.122 from 2005 (prior to the latest "unauthorized" release 1.125 from 2012) has many problems on many different versions of Perl. At first glance it looks like the indirect object notation is used in quite a few places. Unfortunately, I'm at the moment not entirely sure that there's an easy fix, but perhaps another monk has a good idea.

Regards,
-- Hauke D