Re: [RFC] Glib::filename_(to|from)_unicode => Glib->filename_(to|from)_unicode?
- From: "Ross McFarland" <rwmcfa1 neces com>
- To: gtk-perl-list gnome org
- Subject: Re: [RFC] Glib::filename_(to|from)_unicode => Glib->filename_(to|from)_unicode?
- Date: Thu, 8 Jan 2004 08:55:51 -0500 (EST)
an example of the issue(s) with these types methods and inheritance, for those
of you who haven't run across it before:
sub something_class_static
{
my $filename =
}
package FooParent;
sub something_class_static
{
my $filename = shift;
print "The file is named $filename\n";
}
package FooChild;
our @ISA = 'FooParent';
package main;
# obviously works fine, the output is:
# The file is named filename
FooParent::something_class_static ('filename');
# won't work, b/c it's not in this package, but would be the required way to
# call this with the correct paramter
#FooChild::something_class_static ('filename');
# will work, b/c it inherit's, but since class is passed implicitly the output
# will be:
# The file is named FooChild
FooChild->something_class_static ('filename');
once again the filename stuff obviously isn't the best example, but some good
examples (of places where class static functions have to be accessable though
inheritance) do exist within gtk2-perl. a trivial example would be if i wanted
to create a new type of button that had an extra method or two:
package MyButton;
our @ISA = 'Gtk2::Button';
sub get_label_lc
{
my $self = shift;
lc ($self->get_label);
}
sub get_label_uc
{
my $self = shift;
uc ($self->get_label);
}
there is a sligh difference in what is going on here, but we can't rule out
the possiblity that someone will want to make their own child of Glib::Idle,
or whatever. that's not for the binders to decide, and to support this we must
use the -> syntax.
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]