On Tue, Nov 24, 2009 at 7:51 AM, Steve Tolkin <[email protected]> wrote: > Is it possible to use dot notation in Perl 5, possibly by installing a > module etc.? > > If so, please send a link to a moderately small working example.
See Ovid's Acme::Dot module. Note, however, that this module only allows you to use the dot operator on methods of classes that use this module. It simply overload's the dot operator for your class -- it is not a source filter. So your code would still contain the arrow operator for objects of other classes that don't use Acme::Dot. > Can the parentheses be omitted when there are no arguments? > > e.g. if ($s.er) # where er() is a method I haven't tested it with Acme::Dot and the POD and tests don't contain this example, but you can with the standard arrow operator. > Can it be mixed this with regular function notation? > > e.g. w($s.er) Perl is very flexible to mixing OO and functional programming paradigms. However, if you're attempting to perform indirect object notation (e.g., w $s instead of $s->w or $s.w), I'd recommend against it. See chromatic's article at: http://modernperlbooks.com/mt/2009/08/the-problems-with-indirect-object-notation.html > Can the dot notation be used of the LHS of an assignment to actually store a > value? > > e.g. $s.er = "foo"; See "Lvalue subroutines" in perlsub. Not that I recommend any of this for production code! Nick _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

