Acrux
view release on metacpan or search on metacpan
lib/Acrux/Util.pm view on Meta::CPAN
See also L<CTK::Util/dformat>
=head2 dtf
See L</fdt>
=head2 dumper
my $perl = dumper({some => 'data'});
Dump a Perl data structure with L<Data::Dumper>
=head2 eqtime
eqtime("from/file", "to/file") or die "Oops";
Sets modified time of destination to that of source
=head2 fbytes
print fbytes( 123456 );
lib/Acrux/Util.pm view on Meta::CPAN
See C<LICENSE> file and L<https://dev.perl.org/licenses/>
=cut
use Carp qw/ carp croak /;
use IO::File qw//;
use Term::ANSIColor qw/ colored /;
use POSIX qw/ :fcntl_h ceil floor strftime /;
use Fcntl qw/ O_WRONLY O_CREAT O_APPEND O_EXCL SEEK_END /;
use Time::Local;
use Data::Dumper qw//;
use Storable qw/dclone/;
use Acrux::Const qw/ IS_TTY DATE_FORMAT DATETIME_FORMAT /;
use base qw/Exporter/;
our @EXPORT = (qw/
deprecated
dumper
clone
/);
lib/Acrux/Util.pm view on Meta::CPAN
amigaos Amiga
mpeix MPEiX
);
# Common
sub deprecated {
local $Carp::CarpLevel = 1;
$ENV{ACRUX_FATAL_DEPRECATIONS} ? croak @_ : carp @_;
}
sub dumper { Data::Dumper->new([@_])->Indent(1)->Sortkeys(1)->Terse(1)->Useqq(1)->Dump }
sub clone { dclone(shift) }
sub load_class {
my $class = shift // '';
return "Invalid class name: $class" unless $class =~ /^\w(?:[\w:]*\w)?$/;
return undef if $class->can('new') || eval "require $class; 1"; # Ok
return "Class $class not found" if $@ =~ /^Can't\s+locate/i; # Error
return $@; # Error
}
# Bytes and numbers
( run in 0.368 second using v1.01-cache-2.11-cpan-4d50c553e7e )