Crane

 view release on metacpan or  search on metacpan

lib/Crane/Base.pm  view on Meta::CPAN

# -*- coding: utf-8 -*-


package Crane::Base;


use strict;
use warnings;
use utf8;
use feature qw( :5.14 );
use open qw( :std :utf8 );
use base qw( Exporter );

use Carp;
use English qw( -no_match_vars );
use IO::Handle;
use Readonly;
use Try::Tiny;


our @EXPORT = (
    @Carp::EXPORT,
    @English::EXPORT,
    @Try::Tiny::EXPORT,
);


sub import {
    
    my ( $class, @isa ) = @_;
    
    my $caller = caller;
    
    strict->import();
    warnings->import();
    utf8->import();
    feature->import(qw( :5.14 ));
    
    if ( scalar @isa ) {
        foreach my $isa ( @isa ) {
            if ( eval "require $isa" ) {
                no strict 'refs';
                push @{ "${caller}::ISA" }, $isa;
            }
        }
    }
    
    $class->export_to_level(1, $caller);
    
    return;
    
}


1;


=head1 NAME

Crane::Base - Minimal base class for Crane projects


=head1 SYNOPSIS

  use Crane::Base;


=head1 DESCRIPTION

Import this package is equivalent to:

  use strict;
  use warnings;
  use utf8;
  use feature qw( :5.14 );
  use open qw( :std :utf8 );
  
  use Carp;
  use English qw( -no_match_vars );
  use IO::Handle;
  use Readonly;
  use Try::Tiny;


=head1 EXAMPLES


=head2 Script usage

  use Crane::Base;
  
  say 'Hello!' or confess($OS_ERROR);




( run in 0.506 second using v1.01-cache-2.11-cpan-71847e10f99 )