I'm curious what my brethren (and sisthren) feel of the motto Make Perl yours, without taking it away from others.

I came up with it after seattlejohn thanked me for my code. He said "seriously, your code does some really slick stuff to make it easier for the caller, which i really like..." This statement prompted me to think of what I'd done. I'd allowed the module to be used very simply:

use Tie::Scalar::Watch; my $x = 10; watch { $x > 5 } $x;
instead of the clunky:
use Tie::Scalar::Watch; my $x = 10; tie $x, 'Tie::Scalar::Watch', $x, sub { $_[0] > 5 };
I'd used Perl to my advantage to create a pseudo-syntax (thanks to the "&" prototype). The code is easy to read and makes sense with little explanation. The fact that you can use the variable you're watching in the assertion-function itself is nifty.

So my motto means "make things easy for yourself, while keeping them easy for other people too." Don't use convoluted syntax because you can (that doesn't mean "don't use idioms") or because it shows you're elite. Use syntax that you are proud of, and that other people can appreciate. It is to that end that I created a module (to be released soon) called Tie::Array::Unique -- it ensures the elements of an array are unique, so you don't need to keep track with a hash (it does it for you).

Tie-modules are a very good example of this motto. They keep the icky internals away from the implementation, and produce a syntax that is quite normal (since it's just overloading the standard operations on data structures).

So that's my motto. Any feelings? Any personal mottos out there for the sharing?

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;


In reply to I feel a motto coming on... by japhy

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.