On 2/17/06, Dave Rolsky <[EMAIL PROTECTED]> wrote:
On Fri, 17 Feb 2006, Rodney Rindels wrote:

> <%args>
>           $test=>1
> </%args>
> <%init>
>      my $mymodule = MyModule->new(Test=>$test);
> </%init>
> The value of test is <% $mymodule->{Test} %>

Eek, don't go using your objects like they're hashes! That's a very bad
idea, since one of the main purposes of objects is encapsulation. Instead
do this:

  The value of test is <% $mymodule->test() %>

Now you can change the implementation of test() in MyModule.pm without
breaking calling code.


-dave


Thanks dave,
 I actually do that for my projects, was throwing an example out, should have caught myself on that one...
 My Bad.

Rod


Reply via email to