[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Param method?


On 7/4/05 at 2:06 PM, suppressed (Mark Fuller) wrote:

> From: "Michael Peters" <suppressed>
> > Not just that, but it also provides an easy way to pass variables
> > between methods as well as communicating between plugins and other
> > base classes.
> 
> I'm not an OO guru. If I'm off base please forgive me. But, what's
> the difference between
> 
> $self->param('var_name', 'var_value')
> 
> and
> 
> $self->var_name = 'var_value'

Use something like DataDumper to print out the object and you'll see. 
  use Data::Dumper;
  print Dumper($self);

You're making an assumption about the underlying data structure, and may
be surprised at the result :-)


> 
> > That is making the assumption that C::A will always be implemented
> > as a hash.
> 
> No. It's my $self, right? ...
> But, why should C::A force me to use its method?

I think that's pretty typical OO encapsulation and also the point here.


Andrew

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.