I'm trying to figure out Perl's object-oriented features. I'm a long-time Python programmer, so I'm well-versed in its notion of OO programming, but Perl's method definition stuff seems a bit "loose". All of my Perl programming is in a Mason context, so that's where I'll pull an example. Let's see, here's a simple enough example. These two methods are from HTML::Mason::ApacheHandler.
sub new { my ($class,%options) = @_; my $interp = $options{interp} or die "HTML::Mason::Request::ApacheHandler::new: must specify interp\n"; delete $options{interp}; my $self = $class->SUPER::new(interp=>$interp); while (my ($key,$value) = each(%options)) { if (exists($reqfields{$key})) { $self->{$key} = $value; } else { die "HTML::Mason::Request::ApacheHandler::new: invalid option '$key'\n"; } } return $self; } # Override flush_buffer to also call $r->rflush sub flush_buffer { my ($self, $content) = @_; $self->SUPER::flush_buffer($content); $self->apache_req->rflush; } I understand the assignment to $self and $class. What I don't understand is how new and flush_buffer are associated with a specific class. For example, is there anything that keeps me from calling flush_buffer with an instance of a class other than ApacheHandler or calling new with some other class? Should the class author be doing some type checking? Thanks, -- Skip Montanaro ([EMAIL PROTECTED] - http://www.mojam.com/) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]