Hi Ovid,

Thanks for the very constructive comments and critic.


style configurable ... as "StudlyCaps" instead of "separated_with_underscores"

With styles too, there is more than one way to do it. My sense of style is my own and I find CamelCase saves space (the underscores) -space used to be an issue when 80x24 was the way it was (maybe I'm old fashioned.) And the API isn't an iconic one that justifies short cryptic method names. Then again, I certainly don't want to impose my style. Also, I must admit I haven't read perlstyle (yet.)

I still have to figure out how to do the style precisely. Right now I think it'll be set through a PerlBean::Style object (as opposed to setting specific properties in the PerlBean and PerlBean::Attribute objects.) And yes, the default style will very likely be perlstyle as I see no reason in challenging it. That'll mean an interface change as I think a code generation tool should be written in the default style it offers itself.

My first attempts at style reconfigurability is in the PerlBean::Attribute method setMethodBase () which allows to overrule the standard camel_case to CamelCase mapping (e.g. into _camel_case which would yield to a method name set_camel_case). But I like PerlBean::Style better.


... Test::More ...

I'll have a look at that too.


... 80 columns ...

I know. It happens to me all the time. I dislike splitting strings into multiple lines. I also like to keep my conditions and loop headers on one line which clean TAB indentation. I guess I have to change to 4 space indent.


Refactoring ... Factory.pm ...

I assume you understand that the requires/imports are there to minimize the used resources by requiring and importing only the truly needed files. If I narrow down the problem to the instantiations of PerlBean::Attribute objects I don't see how to do refactoring. But don't hesitate to point me out.


I'm also wondering ... bless ($self, (ref($class) || $class));

Like you more or less pointed out yourself, it's for calling the constructor through an object instance. IMHO if you call the constructor you expect a newly constructed object and not a clone. I'd implement a clone method to clone.



Again thanks for your points and challenges. In any case they contribute to the awareness of the API, keep me alert and are a sign of good vibes.


Right now I am implementing PerlBean::Method that allows to define and document methods/interfaces. When ready this results in more consistent documentation for method inheritance/implementation/overloading.

After that I might write a PerlBean::Collection tutorial and then PerlBean::Style.

I hope my wife and kids too agree with this plan.

Cheers,
Vincenzo Zocca
Vincenzo@Zocca.no.spam.com
remove no.spam to contact me

In reply to Re: Perl code generation with PerlBean by zoccav
in thread Perl code generation with PerlBean by zoccav

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!
  • 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, details, 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, summary, 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.