Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Not generating an accessor: how do you do it now?

I don't generate them by default. You have to ask explicitly for accessors by using Class::InsideOut::Accessor.

I suppose that if you write your own accessor method it will overwrite the generated one, but then you have to make sure it happens in that order, and you have to take pains to zap the ones you don't want.

You would also get nasty errors under strict/warnings due to redefining the sub.

With the current source filter mechanism the "right" way of doing it would be to turn the filter off when you don't want to have any accessors, e.g.:

package Foo; use base qw(Class::InsideOut); use Class::InsideOut::Accessor; # build accessors for Fields use %foo : Field; # foo method built automatically no Class::InsideOut::Accessor; # stop building accessors use %bar : Field; # no accessor sub built sub bar { whatever... };
I think the 5.x attribute mechanism should be extended to get the source name and ref, not just (sometimes) a glob.

This may be possible. I'm not certain whether the difference in visibility of lexicals between 5.6.1 and 5.8 is a bug or not... need to spend some time looking at the code ;-)

<update>See Lexical pad / attribute confusion for more detail on what I find confusing.</update>

As is now, attributes are pretty pointless on lexicals because it doesn't provide a way to associate the attribute with the thing it's attached to!

I think that's an over statement. The vast majority of the time you are interested in applying an attribute to a bit of perl data, and don't give a fig for the variables name. This is the only time I've used attributes where this has been an issue.

In reply to Re^5: Class::InsideOut - yet another riff on inside out objects. by adrianh
in thread Class::InsideOut - yet another riff on inside out objects. by adrianh

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    [hippo]: Too true :)

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (8)
    As of 2018-06-22 10:02 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (124 votes). Check out past polls.