Crypt-HSXKPasswd
view release on metacpan or search on metacpan
lib/Crypt/HSXKPasswd/Helper.pm view on Meta::CPAN
package Crypt::HSXKPasswd::Helper;
# import required modules
use strict;
use warnings;
use English qw( -no_match_vars );
use Carp; # for nicer 'exceptions' for users of the module
use Fatal qw( :void open close binmode ); # make builtins throw exceptions
use Scalar::Util qw( blessed ); # for checking if a reference is blessed
use List::MoreUtils qw( uniq ); # for array deduplication
use Readonly; # for truly constant constants
use Types::Standard qw( ClassName ); # needed for _force_class
# set things up for using UTF-8
use 5.016; # min Perl for good UTF-8 support, implies feature 'unicode_strings'
use Encode qw(encode decode);
use utf8;
binmode STDOUT, ':encoding(UTF-8)';
## no critic (ProhibitAutomaticExportation);
use base qw( Exporter );
our @EXPORT = qw( _do_debug _debug _warn _error _force_class _force_instance );
## use critic
# import (or not) optional modules
our $_CAN_STACK_TRACE = eval{
require Devel::StackTrace; # for better error reporting when debugging
};
#==============================================================================#
# A helper class implemented shared functionality
#==============================================================================#
#
# All classes in the Crypt::HSXKPasswd package should inherit from this one as
# it provides basic functionality like error reporting.
#
#==============================================================================#
#
# === CONSTANTS & Package Vars ================================================#
#
# version info
use version; our $VERSION = qv('1.0');
# utility variables
Readonly my $_CLASS => __PACKAGE__;
Readonly my $BASE_PACKAGE => 'Crypt::HSXKPasswd';
# Debug and logging configuration
our $_LOG_STREAM = *STDERR; # default to logging to STDERR
our $_LOG_ERRORS = 0; # default to not logging errors
our $_DEBUG = 0; # default to not having debugging enabled
# Declare Package-level variable needed to control Carp
our @CARP_NOT;
#
# === 'Private' Functions to be Exported ======================================#
#
#####-SUB-######################################################################
# Type : SUBROUTINE (PRIVATE) - EXPORTED
# Purpose : Return 1 if we are in debug mode, and 0 otherwise.
# Returns : 1 or 0
# Arguments : NONE
# Throws : NOTHING
# Notes :
# See Also :
sub _do_debug{ ## no critic (ProhibitUnusedPrivateSubroutines)
return $_DEBUG ? 1 : 0;
}
#####-SUB-######################################################################
# Type : SUBROUTINE (PRIVATE) - EXPORTED
( run in 0.546 second using v1.01-cache-2.11-cpan-39bf76dae61 )