The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Arthas::Defaults - Defaults for coding - Do not use if you're not Arthas

SYNOPSIS

    use Arthas::Defaults;

DESCRIPTION

It's like saying:

    use v5.14;
    use utf8;
    use warnings;
    no warnings 'uninitialized';
    use Carp qw/carp croak confess cluck/;
    use Try::Tiny;

Might change without notice, at any time. DO NOT USE!

use v5.14

This is actually use feature ':5.14'. It imports some perl 5.10 -> 5.14 semantics, such as strict, given-when syntax, Unicode strings, ... See feature documentation and source code for more information.

use utf8

This is NOT related to handling UTF-8 strings or input/output (see use feature 'unicode_strings' imported with use v5.14 for something more related to that).

use utf8 is imported in order to allow UTF-8 characters inside the source code: while using UTF-8 in the source is not standard procedure, it happens to me every now and then. Also, enabling this feature does no harm if you're using a recent version of perl, so why not enable it?

use warnings FATAL = 'all'>

Warnings are useful, who wouldn't want them?

However, if they are not treated as fatal errors, they are often ignored, making them pointless. So, be fatal!

no warnings 'uninitialized'

Well, most warnings are useful. The ones regarding uninitialized (undef) variables are a bit of a pain. Writing a code such as this:

    my $str;
    
    if ( $str eq 'maya' ) {
        say 'Maya!';
    }

would emit a warning, thus forcing you to write:

    my $str;
    
    if ( defined $str && $str eq 'maya' ) {
        say 'Maya!';
    }

which is boring enough to justify suppressing these warnings.

use Carp qw/carp croak confess cluck/

These functions are very useful to show error details better than that of die() and warn().

use Try::Tiny

Try::Tiny provides minimal try/catch/finally statements, which make for interesting sugar and a few nice features over eval.

AUTHOR

Michele Beltrame, arthas@cpan.org

LICENSE

This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.