in reply to Overloading operators: -> to .

Yes, you can. Since you don't want to have it done for you, just type in perldoc overload into a terminal and learn how to overload the "." operator. It may help you to know that the following works:
my $meth = "hello"; $foo->$meth(@args); # Calls method 'hello' on $foo with @args
As noted above, the precedence will be slightly off.

This will only apply to objects in classes which have your overload set.

If you want to attempt a more aggressive approach, you can use Filter::Simple to rewrite your code on the fly. That will get the precedence wrong, though you will have far more trouble making your code correct.

UPDATE: Zaxo is right. Using overload can make the method call happen, but making it pass arguments is another story...

Replies are listed 'Best First'.
Re: Re: Overloading operators: -> to .
by belg4mit (Prior) on Sep 26, 2003 at 03:37 UTC
    Filter::Simple by TheDamian on CPAN includes just such a filter as an example, no need to write one.

    --
    I'm not belgian but I play one on TV.

      Classic. Love it.

      I don't know if I should upvote you for knowing something like that ... or downvote you cause you KNEW something like that. :-) Okay, upvote it is.

Re: Re: Overloading operators: -> to .
by theAcolyte (Pilgrim) on Sep 26, 2003 at 03:24 UTC
    Well, great! And thanks. This isn't something I want to do because I *have* to, just something to play around with

    I get some perverse joy from figuring out some things just to figure them out :-)

    the dot notation for methods just seems more elequent to me. When it first appeared in Javascript (the 2nd language I ever learned, the first being Apple Basic in roughly 1985) I was elated.

    So, this is not very serious, but it will give me something to muck around with when I need a bit of distraction here and there. These kinds of things are fun (for me) to work on when I have other problems simmering in the subconcious. :)

    -Erik