Giter Site home page Giter Site logo

p5-class-usul's Introduction

Travis CI Badge CPAN Badge Kwalitee Badge

Name

Class::Usul - A base class providing config, locking, logging, and l10n

Version

Describes Class::Usul version v0.84.$Rev: 7 $

Synopsis

use Class::Usul;
use Class::Usul::Constants qw( FALSE );
use Class::Usul::Functions qw( find_apphome get_cfgfiles );

my $attr = { config => {} }; my $conf = $attr->{config};

$conf->{appclass    } or  die "Application class not specified";
$attr->{config_class} //= $conf->{appclass}.'::Config';
$conf->{home        }   = find_apphome $conf->{appclass};
$conf->{cfgfiles    }   = get_cfgfiles $conf->{appclass}, $conf->{home};

return Class::Usul->new( $attr );

Description

These modules provide a set of base classes for Perl modules and applications. It provides configuration file loading Class::Usul::Config, locking to single thread processes IPC::SRLock, logging Class::Usul::Log and localisation Class::Usul::L10N

The class Class::Usul::Programs is a base class for command line interfaces

Interprocess communication is handled by Class::Usul::IPC

Class::Usul::File makes the functionality of File::DataClass available

Class::Usul::Cmd is distributed separately and can be used without this distribution. It was refactored into it's own distribution so that dependencies of Class::Usul can be avoided if the command line framework is all that is required

Configuration and Environment

Defines the following public attributes;

  • config

    The config attribute should be a hash reference that may define key / value pairs that provide filesystem paths for the temporary directory etc.

  • config_class

    Defaults to Class::Usul::Config and is of type LoadableClass. An instance of this class is loaded and instantiated using the hash reference in the config attribute. It provides accessor methods with symbol inflation and smart defaults. Add configuration attributes by subclassing this class

  • debug

    A boolean which defaults to false. Usually an instance of this class is passed into the constructors of other classes which set their own debug state to this value

  • l10n

    A lazily evaluated instance of the l10n_class. This object reference is a Localiser which handles the localize method

  • l10n_class

    A lazy loadable class which defaults to Class::Usul::L10N

  • lock

    A lazily evaluated instance of the lock_class. This object reference is a Locker

  • lock_class

    A lazy loadable class which defaults to IPC::SRLock

  • log

    A lazily evaluated instance of the log_class. This object reference is a Logger

  • log_class

    A lazy loadable class which defaults to Class::Usul::Log

Subroutines/Methods

Defines the following public methods;

  • dumper

      $self->dumper( $some_var );
    

    Use Data::Printer to dump arguments for development purposes

Diagnostics

Setting the debug attribute to true causes messages to be logged at the debug level

Dependencies

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Usul. Patches are welcome

Author

Peter Flanigan, <[email protected]>

Acknowledgements

Larry Wall - For the Perl programming language

License and Copyright

Copyright (c) 2018 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.