Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: [RFC] Module code and POD for CPAN

by Bod (Parson)
on Apr 14, 2021 at 12:38 UTC ( [id://11131268]=note: print w/replies, xml ) Need Help??


in reply to Re: [RFC] Module code and POD for CPAN
in thread [RFC] Module code and POD for CPAN

Thanks - quick reply to explain two three points. I'll look at the rest in more detail a little later

1. Your class is doing checkout handling and trolley handling (Single responsibility pattern / Cohesion). Consider having a separate Trolley object for trolley handling.

I did think of this. However, the Trolley only exists as a repository of the 'stuff' that is needed by the Stripe checkout. It isn't (intended to be) useful by itself.

3. Consider using Moo or something similar to make the OOP more ergonomic.

I expect much of the use of this module to be for small businesses using shared hosting. For this reason, I want to keep the dependencies as only core modules.

4. Exceptions are usually preferable to silent returns because they are harder to ignore (see Try::Tiny)

As above, Try::Tiny isn't core. Also, having $stripe->success is consistent with the Javascript methods provided by Stripe in stripe.js

I'm not suggesting I made the optimal choices for these, just explaining why I chose to do things the way I did.

Replies are listed 'Best First'.
Re^3: [RFC] Module code and POD for CPAN
by Arunbear (Prior) on Apr 14, 2021 at 16:23 UTC
    Class::Tiny is similar in purpose to Moo, and like Try::Tiny it has no non-core dependencies, which means installing those (on shared hosting) is no more difficult than installing this particular project.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131268]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found