NAME
Stancer::Core::Types::Helper - Internal types helpers
VERSION
version 1.0.3
FUNCTIONS
coerce_boolean() : CODE
Helper function for Bool
type attribute.
coerce_date() : CODE
Helper function for DateTime
type attribute.
coerce_datetime() : CODE
Helper function for DateTime
type attribute.
coerce_instance() : CODE
Helper function for instances type attribute.
create_instance_type($prefix)
Helper function to create an "InstanceOf" type.
error_message($message)
error_message($message, @args)
Helper function to be used in a type definition:
{
...
message => error_message('%s is not an integer'),
...
}
It will produce:
'"something" is not an integer'
# or with an undefined value
'undef is not an integer'
If @args is provided, it will passed to sprintf
internal function.
{
...
name => 'Char',
message => error_message('Must be exactly %2$d characters, tried with %1$s.'),
...
}
Will produce for a Char[20]
attribute:
'Must be exactly 20 characters, tried with "something".'
register_types( $types, $package )
Install the given types within the package.
This will use MooX::Types::MooseLike::register_types()
.
USAGE
Logging
We use the Log::Any framework for logging events. You may tell where it should log using any available Log::Any::Adapter module.
For example, to log everything to a file you just have to add a line to your script, like this: #! /usr/bin/env perl use Log::Any::Adapter (File => '/var/log/payment.log'); use Stancer::Core::Types::Helper;
You must import Log::Any::Adapter
before our libraries, to initialize the logger instance before use.
You can choose your log level on import directly: use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info');
Read the Log::Any documentation to know what other options you have.
SECURITY
Never, never, NEVER register a card or a bank account number in your database.
Always uses HTTPS in card/SEPA in communication.
Our API will never give you a complete card/SEPA number, only the last four digits. If you need to keep track, use these last four digit.
BUGS
Please report any bugs or feature requests on the bugtracker website https://gitlab.com/wearestancer/library/lib-perl/-/issues or by email to bug-stancer@rt.cpan.org.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Joel Da Silva <jdasilva@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2018-2024 by Stancer / Iliad78.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)