$attrs{'error'} = 'cancel-url and success-url cannot be de +rived from the environment and need to be provided' unless ($attrs{'c +ancel-url'} and $attrs{'success-url'}); $attrs{'error'} = 'Public API key provided is not a valid key' if +$attrs{'api-public'} and $attrs{'api-public'} !~ /^pk_/; $attrs{'error'} = 'Secret API key provided is not a valid key' unl +ess $attrs{'api-secret'} =~ /^sk_/; $attrs{'error'} = 'Secret API key provided as Public key' if $attr +s{'api-public'} and $attrs{'api-public'} =~ /^sk_/; $attrs{'error'} = 'Public API key provided as Secret key' if $attr +s{'api-secret'} =~ /^pk_/; $attrs{'error'} = 'Secret API key is too short' unless length $att +rs{'api-secret'} > 100; $attrs{'error'} = 'Secret API key is missing' unless $attrs{'api-s +ecret'}; return bless \%attrs, $class;

If you must use this style for signaling an error then perhaps you should document that gettting an object back (as opposed to undef) is not a guarantee that object construction succeeded but it should check for the success() my $obj = Bod::Stripe->new(...); die $obj->error() unless $obj->success(); (I have run through the POD diagonally and I think I did not see any mention).

bw, bliako


In reply to Re: [RFC] Module code and POD for CPAN by bliako
in thread [RFC] Module code and POD for CPAN by Bod

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.