Types::RENEEB - Several predefined Type::Tiny types
version 0.10
package TypesTest;
use strict;
use warnings;
use Moo;
use Types::RENEEB qw(
DistName DistVersion
OPMVersion OPMVersionWildcard
);
has distname => ( is => 'ro', isa => DistName );
has distversion => ( is => 'ro', isa => DistVersion );
has opm_version => ( is => 'ro', isa => OPMVersion );
sub check_opm_version {
OPMVersion->('2.0.0');
}
sub check_opm_version {
OPMVersion->('2.0.x');
}
1;
Types::RENEEB
is a collection of types I need very often
These Types::
modules are shipped in this distribution:
Types::RENEEB
inherits the types of the mentioned modules.
DistName-DistVersion
package MyClass;
use Moo;
use Types::Dist qw(DistName);
has dist => ( is => 'ro', isa => DistName );
1;
And then use your class:
my $object = MyClass->new( dist => 'Types-RENEEB-0.09' );
my $object = MyClass->new( dist => '0.09' ); # fails
my $object = MyClass->new( dist => 'Types-RENEEB' ); # fails
A name of a distribution
my $object = MyClass->new( dist => 'Types-RENEEB' ); # ok
A version of a distribution
my $object = MyClass->new( dist => '0.09' ); # ok
An instance of Module::CPANfile
package MyClass;
use Moo;
use Types::Dist qw(CPANfile);
has prereqs => ( is => 'ro', isa => CPANfile, coerce => 1 );
1;
And then use your class:
my $object = MyClass->new( prereqs => '/path/to/cpanfile' );
my @features = $object->prereqs->features; # call features method from Module::CPANfile
An OPM version looks like 2.4.5 or 6.0.1.
An OPM version with wildcard as used in Addons. To define a version of the OPM framework that is needed to install the addon, the developer can use 'x' as a wildcard.
E.g. Addons for OPM 6.x can be installed on any OPM 6 installation, whilst addons that define 2.4.x as the framework version can only installed on any OPM 2.4 installation, but not on OPM 2.3 installation.
An object of OPM::Parser.
It checks if the file exists and can be parsed without an error.
-
From String to OPM::Parser
When a string is given, it is coerced into an OPM::Parser object.
The distribution is contained in a Git repository, so simply clone the repository
$ git clone git://github.com/reneeb/Types-RENEEB.git
and change into the newly-created directory.
$ cd Types-RENEEB
The project uses Dist::Zilla
to
build the distribution, hence this will need to be installed before
continuing:
$ cpanm Dist::Zilla
To install the required prequisite packages, run the following set of commands:
$ dzil authordeps --missing | cpanm
$ dzil listdeps --author --missing | cpanm
The distribution can be tested like so:
$ dzil test
To run the full set of tests (including author and release-process tests),
add the --author
and --release
options:
$ dzil test --author --release
Renee Baecker reneeb@cpan.org
This software is Copyright (c) 2019 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)