Entities::Plan - A collection of features (possibly scoped and limited) customers can subscribe to.
used internally, see L<Entities>
A plan is merely a collection of features. Customer get access to these features by subscribing to a plan. In a paid webapp, for example, you might have plans such as 'Free', 'Small', 'Medium' and 'Large', with feature count increasing from plan to plan. Plans can also inherit from other plans to make things a little easier.
NOTE: you are not meant to create plan objects directly, but only through the
new_plan() method in Entities.
Creates a new instance of this module. Only 'name' is required.
Returns the ID of the plan, if set.
Returns a true value if the plan object has an ID attribute.
Sets the ID of the plan object to the provided value. Only to be used internally.
Returns the name of the plan.
Returns the description text of this plan.
Changes the description of the object to the provided value.
In scalar context, returns an array-ref of all feature names this plan directly has. In list context returns an array. If an array-ref of feature names is provided, it replaces the current list.
Returns a true value if the plan has been assigned any features.
In scalar context, returns an array-ref of plan names this plan inherits from. In list context returns an array. If an array-ref of plan names is provided, it will replace the current list.
Returns a true value if the plan object inherits from any other plan.
Returns a DateTime object in the time the plan object has been created.
Returns a DateTime object in the last time the object has been modified. If a DateTime object is provided, it is set as the new modified value.
Returns the Entities::Backend instance that stores this object.
Adds the feature named
$feature_name to the plan. Croaks if the feature does not exist, warns if the plan already has that feature. Returns the plan object itself.
Removes the feature named
$feature_name from the plan. This only removes the feature if it was directly provided to the plan, and not through inheritance, so it's possible the plan will still have that feature after removal if it inherits it from a plan that provides it.
Warns if the plan doesn't have that feature, doesn't croak if the feature does not exist at all. Returns the plan object itself.
Returns a true value if the plan was directly provided with the feature named
Setup an inheritance from the plan named
$plan_name. This plan will then inherit all features from that plan. Croaks if the provided plan does not exist, warns if the plan object already inherits from it. Returns the plan object itself.
This badly named method removes the inheritance between the current plan object and the plan named
$plan_name. Warns if the plan doesn't inherit from the provided plan. Doesn't croak if
$plan_name can't be found.
Returns the plan object itself.
Returns the plan object of the plan named
The following list documents any method modifications performed through the magic of Moose.
features() methods are called with no arguments and in list context - will automatically dereference the array-ref into arrays.
Automatically saves the object to the backend after any method that changed it was executed. Also updates the 'modified' attribute with the current time before saving. Note, however, that the
features() methods are not here, since they are only meant to be used for writing internally.
<ido at ido50 dot net>
Please report any bugs or feature requests to
bug-entities at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Entities. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
Copyright 2010-2013 Ido Perlmuter.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.