R. Joseph Newton wrote:
>
> Thanks.  Let me make sure I have this clear, then.  Does any call to
> a class method then have the reference to the object, or the object
> itself, as the first parameter.

Almost. Any method called through an object will have that object
(a blessed reference) as its first parameter. You can also make
'class method' calls, in which case the first parameter will simply be
the name of the module (the package name). Assuming for now
there is no inheritance goin on

    my $train = Train->new;
or
    my $train = new Train;

(the two are interchangeable except for minor syntactic difficulties)
will both call

    Train::new('Train');

whereas

    my $vehicle = $train->new;
or
    my $vehicle = new $train;

will call

    Train::new($train);

> In that case, it certainly does make sense to shift it back out
> before handling the rest.of the arguments.

Every time you're feeling lost, the following (from perldoc
perlobj) will make you feel a little more secure; mainly
through its insistence on using 'simply'!

    1.  An object is simply a reference that happens to know which class it
        belongs to.

    2.  A class is simply a package that happens to provide methods to deal
        with object references.

    3.  A method is simply a subroutine that expects an object reference (or
        a package name, for class methods) as the first argument.

HTH,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to