Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > $class::SUPER as well as $instance::SUPER?

Reply
Thread Tools

$class::SUPER as well as $instance::SUPER?

 
 
Matthew Braid
Guest
Posts: n/a
 
      08-06-2004
Hi all,

Just a quick question - I just found out that this:

package Bar;

sub woo { print "WOO!\n" }

package Foo;
use base qw/Bar/;

sub woo {
my $class = shift;
$class::SUPER->woo(); # EEK!
print "WOO2!\n";
}

package main;
Foo->woo();
1;
__END__

does not work - the line marked with # EEK! causes perl to die with the message
'Can't call method "woo" on an undefined value at ....'.

I take it that you can't find a _class_'s super class via the ::SUPER construct
(it obviously works for an instance of the class).

Is there something else I can do to accomplish this?

MB
 
Reply With Quote
 
 
 
 
Sherm Pendley
Guest
Posts: n/a
 
      08-06-2004
Matthew Braid wrote:

> Just a quick question - I just found out that this:

....
> $class::SUPER->woo(); # EEK!

....
> does not work


It works if you write it correctly.

$class->SUPER::woo();

sherm--


--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
 
 
 
Matthew Braid
Guest
Posts: n/a
 
      08-09-2004
Sherm Pendley wrote:

> Matthew Braid wrote:
>
>> Just a quick question - I just found out that this:

>
> ...
>
>> $class::SUPER->woo(); # EEK!

>
> ...
>
>> does not work

>
>
> It works if you write it correctly.
>
> $class->SUPER::woo();
>
> sherm--
>
>


D'oh! That's what I get for writing code on a friday afternoon. Sheesh.

Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem - Computer cannot access internet (well not exactly.....)!. Len Wireless Networking 2 10-10-2005 01:59 PM
Friend s need my help(well your help) Frank Wireless Networking 2 07-29-2005 09:01 PM
Hi Whats considered to be a well priced and well reviewed plasma tv 42 inch and above ? Hmmmmmmm DVD Video 8 09-28-2004 09:32 AM
Thunderbird and Firefox dno't work well togetehr loaery ouopwe4wiuyt Firefox 3 08-04-2004 02:57 AM
Can .NET & IExplorer well work together? zbuilder ASP .Net 3 09-16-2003 12:55 PM



Advertisments