APM: OO Perl Question

David Bluestein II dbii at mudpuddle.com
Thu Jun 27 08:49:36 CDT 2002


Okay, I've been coding too much this week and I've got an OO Perl question
as I'm trying to expand my horizons (now that I kind of understand $self
:).

In my object, I want a list, @Object::LIST, which does not change during
runtime (it contains a list of fields in a database). In my main program, I
create an OBJECT:

    my $id = $q->param('id');

# create object
    my $object = new Object( ID => $id );
# create reference to the list of fields
    my $listref = \@Object::LIST;

I want to make this simpler though, and not involve the @Object::variable
syntax.

Questions are:
1) How do I define an @LIST in my Object.pm, and how do I construct the
syntax to access it in my main program, such that I can change the above
code to:

    my $id = $q->param('id');

# create object
    my $object = new Object( ID => $id );
# Set the variable @list equal to the @LIST in the $object. Syntax is wrong
here (I tried it)
    my @list = $object->@LIST;


Thanks-

David



----------
David H. Bluestein II                         President & Lead Developer
dbii at mudpuddle.com                         ii, inc.

http://www.interaction.net
-        Specializing in Designing Interactive Websites        -
-              and Searchable Internet Databases                   -








More information about the Austin mailing list