Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for the feedback, unfortunately fixing the extended class name does not solve the problem :(

Well, not surprising, fixing thinkos rarely fixes "bugs" :)

Well, it might be considered a bug that Moo isn't as helpful as Moose, Moose actually checks the class is blessed into the right, Moo doesn't

Quick workaround is

sub MenuBar::Item::BUILD { my $self = shift; bless $self, __PACKAGE__ ; $self->Append( $self->item_quit ); return $self; }

Now why doesn't Wx::Menu obey the common rules of subclassing/inheritance, well not all things in wxPerl are mean to be subclasses, and indeed menu/menubar are indeed odd candidates for that ... some of this is explained in Re: wxperl-users scalar reference objects?

As you can see a Wx::Menu isn't a hashref, its a scalar ref

#!/usr/bin/perl -- use Wx qw[ :allclasses ]; { package MMenu; use base qw/ Wx::Menu /; 1; } { package MFrame; use base qw/ Wx::Frame /; 1; } package main; print join "\n", MMenu->new, MFrame->new, ;;;;; __END__ Wx::Menu=SCALAR(0x3f9afc) MFrame=HASH(0x99b30c)

FWIW, not everything needs to be subclasses, ex wxperl_usage


In reply to Re^3: Different behavior for Moo and Moose with Wx? by Anonymous Monk
in thread Different behavior for Moo and Moose with Wx? by stefbv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-10-24 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?