| 1 | package Catmandu::Sane; | ||
| 2 | |||
| 3 | 145 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 145 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 145 | our $VERSION = '1.0201_02'; | |
| 7 | |||
| 8 | 145 | ▶ | use feature (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 145 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 145 | ▶ | use IO::File (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 145 | ▶ | use IO::Handle (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 145 | ▶ | use Try::Tiny::ByClass; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 145 | ▶ | use Catmandu::Error; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | sub import { | ||
| 16 | 1743 | ▶ | my $pkg = caller; |
|
Subroutine
import: called CC=1 SCAR=0.0
| |||
| 17 | 1743 | strict->import; | |
| 18 | 1743 | warnings->import; | |
| 19 | 1743 | feature->import(qw(:5.10)); | |
| 20 | 1743 | utf8->import; | |
| 21 | 1743 | Try::Tiny::ByClass->export_to_level(1, $pkg); | |
| 22 | } | ||
| 23 | |||
| 24 | 145 | 1; | |
| 25 | |||
| 26 | __END__ | ||
| 27 | |||
| 28 | =pod | ||
| 29 | |||
| 30 | =head1 NAME | ||
| 31 | |||
| 32 | Catmandu::Sane - Package boilerplate | ||
| 33 | |||
| 34 | =head1 SYNOPSIS | ||
| 35 | |||
| 36 | use Catmandu::Sane; | ||
| 37 | |||
| 38 | # Provides all the 5.10 features. | ||
| 39 | say("what"); | ||
| 40 | given($foo) { | ||
| 41 | when(1) { say "1" } | ||
| 42 | when([2,3]) { say "2 or 3" } | ||
| 43 | when(/abc/) { say "has abc" } | ||
| 44 | default { none of the above } | ||
| 45 | } | ||
| 46 | sub next_id{ | ||
| 47 | state $id; | ||
| 48 | ++$id; | ||
| 49 | } | ||
| 50 | |||
| 51 | # Provides try/catch[/finally] try/catch_case[/finally] | ||
| 52 | try { | ||
| 53 | } catch {}; | ||
| 54 | |||
| 55 | # Provides | ||
| 56 | Catmandu::Error->throw("error"); | ||
| 57 | Catmandu::BadVal->throw("eek val"); | ||
| 58 | Catmandu::BadArg->throw("eek arg"); | ||
| 59 | Catmandu::NotImplemented->throw("can't do that!"); | ||
| 60 | |||
| 61 | =head1 DESCRIPTION | ||
| 62 | |||
| 63 | Package boilerplate equivalent to: | ||
| 64 | |||
| 65 | use strict; | ||
| 66 | use warnings; | ||
| 67 | use feature qw(:5.10); | ||
| 68 | use utf8; | ||
| 69 | use IO::File (); | ||
| 70 | use IO::Handle (); | ||
| 71 | use Try::Tiny::ByClass; | ||
| 72 | use Catmandu::Error; | ||
| 73 | |||
| 74 | =cut | ||