in reply to Re: Re: Re: Re: where do you put your subs
in thread where do you put your subs

my $paco = $foo->bar;
Is this a scalar or a call to a class method with no paramaters? Let's sift through the code to find out, oh joy!

Let's sift indeed:

my $paco =
Ah, we're creating a lexically scoped scalar called $paco
$foo
It has something to do with another scalar, called $foo
->
The arrow indicates we're either going to dereference, or have method call.
bar
No [] or {}, so it's a method call. Neato, we're using objects!
But we can't see whether $foo is a scalar holding a blessed reference (better known as object) or a scalar holding a package name. That's only because it's called $foo, because a good name would tell us.

And do you really put package names in scalars and then use those to call class methods? It's ugly, just like using soft references.

44696420796F7520732F2F2F65206F
7220756E7061636B3F202F6D736720
6D6521203A29202D2D204A75657264