angie ahl wrote:

> Hi everyone
>
> I'm failing to find something in the manuals (or at least the bit I'm
> missing ;)
>
> I have an package called "Event"
>
> in it I have a subroutine called EventList
>
> sub EventList {
>     my ($class, %arg) = @_;
>     # load of code here
>     return ([EMAIL PROTECTED], \$startdate, \$enddate);
> }
> ...but I don't seem to be able to access it. I've tried all sorts:

Call it by its name.  You have not defined a new() function.  You have
defined EventList.  Thaqt is not a good name.  If you are not going to call
your constructor new, then it should be Event().

With what you have, though, you should call it:

my $event = Event->EventList(pot1 => val1, etc);

This is really out there, though.  You can take this and possibly squeeeze
it into something workable, but you should really start by reading the
documentaion:

perldoc perlref
perldoc perlreftut
perldoc perlobj
perldoc perlmod
 probbly in that order.

an array and random variables are generally not going to be a good way to
store an objects information.  The just are not very cohesive.  The standard
in Perl is to return a hash as the container for all instance data.  Until
you have sufficient mastery of the language to know why you are diverging
from the standard, you should not do so.

I would advise aginst doing any kind of object-oriented work until you feel
very comfortable with references.

Joseph


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

Reply via email to