Chris <[EMAIL PROTECTED]> asked: > I'm not exactly sure what its called but for example, when > using mod_perl, I see the following: > > $r->prev->uri > > How do you create something like this?
$r is an object of some class. prev is a method of that class. It returns an object on which the method uri is called. Or consider this example: #!/usr/bin/perl -w use strict; package Fruit; sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } sub __getset { my( $self, $quality, $value ) = @_; if( defined $value ){ $self->{$quality} = $value; return $self; } else { return $self->{$quality}; } } sub name { my $self = shift; return $self->__getset( 'name', shift ); } sub color { my $self = shift; return $self->__getset( 'color', shift ); } package main; # let's make our Fruit a shiny red apple my $fruit = Fruit->new->name('Apple')->color('red'); print "The ". $fruit->name . " is " . $fruit->color . ".\n"; __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>