NAME

Types::RENEEB - Several predefined Type::Tiny types

VERSION

version 0.09

SYNOPSIS

package TypesTest;

use strict;
use warnings;

use Moo;
use Types::RENEEB qw(
    DistName DistVersion
    OTRSVersion OTRSVersionWildcard
);

has distname     => ( is => 'ro', isa => DistName );
has distversion  => ( is => 'ro', isa => DistVersion );
has otrs_version => ( is => 'ro', isa => OTRSVersion );

sub check_otrs_version {
    OTRSVersion->('2.0.0');
}

sub check_otrs_version {
    OTRSVersion->('2.0.x');
}

1;

DESCRIPTION

Types::RENEEB is a collection of types I need very often

MODULES

These Types:: modules are shipped in this distribution:

Types::RENEEB inherits the types of the mentioned modules.

Types::Dist

DistFQ

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

DistName

A name of a distribution

my $object   = MyClass->new( dist => 'Types-RENEEB' ); # ok

DistVersion

A version of a distribution

my $object   = MyClass->new( dist => '0.09' ); # ok

CPANfile

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

Types::OTRS

OTRSVersion

An OTRS version looks like 2.4.5 or 6.0.1.

OTRSVersionWildcard

An OTRS version with wildcard as used in Addons. To define a version of the OTRS framework that is needed to install the addon, the developer can use 'x' as a wildcard.

E.g. Addons for OTRS 6.x can be installed on any OTRS 6 installation, whilst addons that define 2.4.x as the framework version can only installed on any OTRS 2.4 installation, but not on OTRS 2.3 installation.

OPMFile

An object of OTRS::OPM::Parser.

It checks if the file exists and can be parsed without an error.

COERCIONS

OPMFile

  • From String to OTRS::OPM::Parser

    When a string is given, it is coerced into an OTRS::OPM::Parser object.

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)