Not the solution I was looking for:-) You need to go lookup the unsubscribe options at activestate.com, can't remember what they are offhand, but nobody on this list has the actual power to take you off the list,
Regards Marty ----- Original Message ----- From: "J. Utermehle" <[EMAIL PROTECTED]> To: "Martin Moss" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, January 10, 2003 7:09 PM Subject: Re: [Perl-unix-users] listing subroutines defined locally in a class > take me off the list > > On Fri, 10 Jan 2003, Martin Moss wrote: > > > Date: Fri, 10 Jan 2003 18:56:13 -0000 > > From: Martin Moss <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: [Perl-unix-users] listing subroutines defined locally in a class > > > > All, > > > > I want to be able to take a class and in it's 'new' subroutine do a check to ensure that each class has been given configuration information for each subroutine it has defined locally within that class. The problem I have is that I don't know how to differentiate between methods created in a base class, methods created by included modules (through the use of the use) and so on. I simply only want those that exist locally to the class. > > > > I came across the following code :- > > > > sub methods > > { > > my $self = shift; > > my $class = ref($self) || $self; > > my @list; > > no strict 'refs'; > > > > print STDERR Dumper(keys %{"${class}::"}); > > # Based on methods_via() in perldb5.pl > > foreach my $name (grep {defined &{${"${class}::"}{$_}}} keys %{"${class}::"}) { > > push @list, $name; > > } > > > > return \@list; > > } > > > > But this doesn't quite work out, without having a long list of 'ignore' keywords. And then it wouldn't be very future proof. Does anybody have any ideas? > > > > Regards > > > > Marty > > > > ################################ > > Example of How I see this working, parent and base classes:- > > > > package ParentClass; > > > > use base qw(BaseClass); > > use vars qw(%methods); > > > > %methods=( > > '_load' => $configdata, > > 'list' => $configdata, > > 'anothersub' => $configdata, > > ); > > > > > > > > package BaseClass; > > > > sub new > > { > > blahusualblah > > $self->_check_methods(); > > } > > > > sub methods > > { > > #returns a list of methods for this class, which doesn't include special ones like BEGIN, croak, AUTOLOAD etc... > > } > > > > sub _check_methods > > { > > my $self=shift; > > my $class=ref($self)||$self; > > > > my @methods=@{$self->methods()}; > > > > foreach my $method (@methods) > > { > > unless (exists($self->methods->{$method})) > > { > > die "No configuration supplied for $method for $class"; > > } > > } > > } > > > > > > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs