Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

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

Your hacky way of getting what you want doesn't work with the Moose I'm using (0.51). Here I can get a list of slots this way:

my @atts = $h->meta->get_meta_instance->get_all_slots;

That gives the list in no particular order, however.

Looking at the object with Data::Dumper, I don't see any place that stores an ordered list of attributes. I suspect that your "working" code is working by coincidence. Try it with this package:

package Hubba; use Moose; foreach my $name ( 'a' .. 'z' ) { has $name => ( is => 'rw' ); }

I think the only way you're going to get what you want is to look into Moose's definition of has and patch it so that it tracks the information you want to have.

You've asked us not to question your motives here, so I won't, but any code that requires this information probably has a design problem of some kind. I recommend finding another solution to whatever your real problem is.


In reply to Re: declaration order of attributes in Moose by kyle
in thread declaration order of attributes in Moose by morgon

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (10)
    As of 2014-07-14 14:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (261 votes), past polls