CLI-Driver

 view release on metacpan or  search on metacpan

lib/CLI/Driver/Deprecated.pm  view on Meta::CPAN

package CLI::Driver::Deprecated;

use Modern::Perl;
use Moose;
use namespace::autoclean;
use Kavorka '-all';
use Data::Printer alias => 'pdump';
use CLI::Driver::Option;

with
  'CLI::Driver::CommonRole',
  'CLI::Driver::ArgParserRole';

###############################
###### PUBLIC ATTRIBUTES ######
###############################

has status => (
    is  => 'rw',
    isa => 'Bool',
    default => 0,
);

has replaced_by => (
    is  => 'rw',
    isa => 'Str|Undef',
);

############################
###### PUBLIC METHODS ######
############################

method is_true {
    
    if ($self->status) {
        return 1;    
    }    
    
    return 0;
}

method parse (HashRef :$href!) {

    if ( !defined $href->{status} ) {
        $self->warn("failed to find deprecated status");
        return 0;    # failed
    }
    else {
        my $status = $href->{status};
        my $bool_status = $self->str_to_bool($status);
        $self->status($bool_status);
    }

    if ( $href->{'replaced-by'} ) {
        $self->replaced_by( $href->{'replaced-by'} );
    }

    return 1;
}

method get_usage_modifier {

    if ($self->status) {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.443 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )