view release on metacpan or search on metacpan
eg/acrux_log.pl view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use utf8;
use Acrux::Log;
use IO::Handle;
my $log = Acrux::Log->new(
handle => IO::Handle->new_from_fd(fileno(STDOUT), "w"),
level => 'trace',
#short => 1,
color => 1,
#format => sub {
eg/acrux_test.pl view on Meta::CPAN
# Run
my $exitval = $app->run($command, @arguments) ? 0 : 1;
warn color("bright_red" => $app->error) . "\n" and exit $exitval if $exitval;
1;
package MyTestPlugin;
use warnings;
use strict;
use utf8;
our $VERSION = '0.01';
use parent 'Acme::Crux::Plugin';
use Acrux::Util qw/color/;
sub register {
my ($self, $app, $args) = @_;
print sprintf(color(bright_magenta => "Registered %s plugin"), $self->name), "\n";
lib/Acme/Crux.pm view on Meta::CPAN
package Acme::Crux;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Crux - The CTK::App of the next generation
=head1 SYNOPSIS
use Acme::Crux;
lib/Acme/Crux/Plugin.pm view on Meta::CPAN
package Acme::Crux::Plugin;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Crux::Plugin - The Acme::Crux plugin base class
=head1 SYNOPSIS
package Acme::Crux::Plugin::MyPlugin;
lib/Acme/Crux/Plugin/Config.pm view on Meta::CPAN
package Acme::Crux::Plugin::Config;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Crux::Plugin::Config - The Acme::Crux plugin for configuration your application
=head1 SYNOPSIS
# In startup
lib/Acme/Crux/Plugin/Log.pm view on Meta::CPAN
package Acme::Crux::Plugin::Log;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Crux::Plugin::Log - The Acme::Crux plugin for logging in your application
=head1 SYNOPSIS
# In startup
lib/Acrux.pm view on Meta::CPAN
package Acrux;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux - Southern crucis constellation for your applications
=head1 SYNOPSIS
use Acrux;
lib/Acrux/Config.pm view on Meta::CPAN
package Acrux::Config;
use strict;
use utf8;
=encoding utf8
=head1 NAME
Acrux::Config - Config::General Configuration of Acrux
=head1 SYNOPSIS
use Acrux::Config;
my $config = Acrux::Config->new(
lib/Acrux/Config.pm view on Meta::CPAN
use Cwd qw/getcwd/;
use File::Spec qw//;
use File::Basename qw/basename/;
use Acrux::Pointer;
use Acrux::RefUtil qw/as_array is_array_ref is_hash_ref is_value/;
use Acrux::Util qw/clone/;
use constant DEFAULT_CG_OPTS => {
'-ApacheCompatible' => 1, # Makes possible to tweak all options in a way that Apache configs can be parsed
'-LowerCaseNames' => 1, # All options found in the config will be converted to lowercase
'-UTF8' => 1, # All files will be opened in utf8 mode
'-AutoTrue' => 1, # All options in your config file, whose values are set to true or false values, will be normalised to 1 or 0 respectively
};
sub new {
my $class = shift;
my $args = @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {};
my $self = bless {
default => $args->{defaults} || $args->{default} || {},
file => $args->{file} // '',
root => $args->{root} // '', # base path to default files/directories
lib/Acrux/Const.pm view on Meta::CPAN
package Acrux::Const;
use strict;
use utf8;
use feature ':5.16';
=encoding utf8
=head1 NAME
Acrux::Const - The Acrux constants
=head1 SYNOPSIS
use Acrux::Const;
=head1 DESCRIPTION
lib/Acrux/Digest.pm view on Meta::CPAN
package Acrux::Digest;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux::Digest - Acrux Digest base class
=head1 SYNOPSIS
use parent qw/Acrux::Digest/;
lib/Acrux/Digest/FNV32a.pm view on Meta::CPAN
package Acrux::Digest::FNV32a;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux::Digest::FNV32a - FNV32a Digest calculation for short strings
=head1 SYNOPSIS
use Acrux::Digest::FNV32a;
lib/Acrux/Digest/M11R.pm view on Meta::CPAN
package Acrux::Digest::M11R;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux::Digest::M11R - interface for modulus 11 (recursive) check digit calculation
=head1 SYNOPSIS
use Acrux::Digest::M11R;
lib/Acrux/FilePid.pm view on Meta::CPAN
package Acrux::FilePid;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux::FilePid - The Pid File simple interface
=head1 SYNOPSIS
use Acrux::FilePid;
lib/Acrux/Log.pm view on Meta::CPAN
package Acrux::Log;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acrux::Log - Acrux logger
=head1 SYNOPSIS
use Acrux::Log;
lib/Acrux/Pointer.pm view on Meta::CPAN
package Acrux::Pointer;
use strict;
use utf8;
=encoding utf8
=head1 NAME
Acrux::Pointer - The Acrux pointer
=head1 SYNOPSIS
use Acrux::Pointer;
my $pointer = Acrux::Pointer->new(data => {foo => [123, 'bar']});
lib/Acrux/RefUtil.pm view on Meta::CPAN
package Acrux::RefUtil;
use strict;
use utf8;
=encoding utf8
=head1 NAME
Acrux::RefUtil - Pure Perl Utility functions for checking references and data
=head1 SYNOPSIS
use Acrux::RefUtil qw/ :all /;
=head1 DESCRIPTION
lib/Acrux/Util.pm view on Meta::CPAN
package Acrux::Util;
use strict;
use utf8;
=encoding utf8
=head1 NAME
Acrux::Util - The Acrux utilities
=head1 SYNOPSIS
use Acrux::Util;
=head1 DESCRIPTION
lib/Acrux/Util.pm view on Meta::CPAN
For example:
$rand = randchars( 8, [qw/a b c d e f/]); # -> cdeccfdf
=head2 slurp
my $data = slurp($file, %args);
my $data = slurp($file, { %args });
slurp($file, { buffer => \my $data });
my $data = slurp($file, { binmode => ":raw:utf8" });
Reads file $filename into a scalar
my $data = slurp($file, { binmode => ":unix" });
Reads file in fast, unbuffered, raw mode
my $data = slurp($file, { binmode => ":unix:encoding(UTF-8)" });
Reads file with UTF-8 encoding
lib/Acrux/Util.pm view on Meta::CPAN
=back
See also L</spew> to writing data to file
=head2 spew
spew($file, $data, %args);
spew($file, $data, { %args });
spew($file, \$data, { %args });
spew($file, \@data, { %args });
spew($file, $data, { binmode => ":raw:utf8" });
Writes data to a file atomically. The only argument is C<binmode>, which is passed to
C<binmode()> on the handle used for writing.
Can optionally take these named arguments:
=over 4
=item append
#
# Serż Minus (Sergey Lepenkov), <abalama@cpan.org>
#
# Copyright (C) 1998-2024 D&D Corporation. All Rights Reserved
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#########################################################################
use strict;
use utf8;
use Test::More;
use_ok qw/Acrux::Log/;
# Error message with debug loglevel
{
my $log = Acrux::Log->new();
is $log->level, 'debug', "Debug LogLevel";
ok $log->error("My test error message"), 'Error message to syslog';
}
t/10-app-min.t view on Meta::CPAN
#
# Serż Minus (Sergey Lepenkov), <abalama@cpan.org>
#
# Copyright (C) 1998-2024 D&D Corporation. All Rights Reserved
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#########################################################################
use strict;
use utf8;
use Test::More;
use_ok qw/Acme::Crux/;
# Direct
{
my $app = new_ok( 'Acme::Crux' => [(
project => 'MyApp',
preload => [], # Disable plugins
)] );