| 1 | package Zing::Class; | ||
| 2 | |||
| 3 | 56 | ▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 56 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 56 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 56 | ▶ | use registry; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 56 | ▶ | use routines; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 56 | ▶ | use Data::Object::Class; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 56 | our $VERSION = '0.26'; # VERSION | |
| 14 | |||
| 15 | # METHODS | ||
| 16 | |||
| 17 | 0 | ▶ | method throw(@args) { |
|
Subroutine
throw: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 18 | 0 | require Zing::Error; | |
| 19 | 0 | die Zing::Error->new(@args, context => $self)->trace(1); | |
| 20 | 56 | } | |
| 21 | |||
| 22 | 0 | ▶ | method try($method, @args) { |
|
Subroutine
try: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 23 | 0 | require Data::Object::Try; | |
| 24 | 0 | my $try = Data::Object::Try->new(invocant => $self, arguments => [@args]); | |
| 25 | 0 | return $try->call($try->callback($self->can($method))); | |
| 26 | 56 | } | |
| 27 | |||
| 28 | 56 | 1; | |
| 29 | |||
| 30 | =encoding utf8 | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | Zing::Class - Base Class | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | =head1 ABSTRACT | ||
| 39 | |||
| 40 | Abstract Base Class | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | =head1 SYNOPSIS | ||
| 45 | |||
| 46 | use Zing::Class; | ||
| 47 | |||
| 48 | my $class = Zing::Class->new; | ||
| 49 | |||
| 50 | # $class->throw; | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | =head1 DESCRIPTION | ||
| 55 | |||
| 56 | This package provides an abstract base class for L<Zing> classes. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | =head1 LIBRARIES | ||
| 61 | |||
| 62 | This package uses type constraints from: | ||
| 63 | |||
| 64 | L<Zing::Types> | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | =head1 METHODS | ||
| 69 | |||
| 70 | This package implements the following methods: | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | =head2 throw | ||
| 75 | |||
| 76 | throw(Any @args) : Error | ||
| 77 | |||
| 78 | The throw method throws a L<Zing::Error> exception. | ||
| 79 | |||
| 80 | =over 4 | ||
| 81 | |||
| 82 | =item throw example #1 | ||
| 83 | |||
| 84 | # given: synopsis | ||
| 85 | |||
| 86 | $class->throw(message => 'Oops'); | ||
| 87 | |||
| 88 | =back | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | =head2 try | ||
| 93 | |||
| 94 | try(Str $method, Any @args) : InstanceOf["Data::Object::Try"] | ||
| 95 | |||
| 96 | The try method returns a tryable object based on the method and arguments | ||
| 97 | provided. | ||
| 98 | |||
| 99 | =over 4 | ||
| 100 | |||
| 101 | =item try example #1 | ||
| 102 | |||
| 103 | # given: synopsis | ||
| 104 | |||
| 105 | $class->try('throw', message => 'Oops'); | ||
| 106 | |||
| 107 | =back | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | =head1 AUTHOR | ||
| 112 | |||
| 113 | Al Newkirk, C<awncorp@cpan.org> | ||
| 114 | |||
| 115 | =head1 LICENSE | ||
| 116 | |||
| 117 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||
| 118 | |||
| 119 | This is free software; you can redistribute it and/or modify it under the terms | ||
| 120 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||
| 121 | file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>. | ||
| 122 | |||
| 123 | =head1 PROJECT | ||
| 124 | |||
| 125 | L<Wiki|https://github.com/iamalnewkirk/zing/wiki> | ||
| 126 | |||
| 127 | L<Project|https://github.com/iamalnewkirk/zing> | ||
| 128 | |||
| 129 | L<Initiatives|https://github.com/iamalnewkirk/zing/projects> | ||
| 130 | |||
| 131 | L<Milestones|https://github.com/iamalnewkirk/zing/milestones> | ||
| 132 | |||
| 133 | L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md> | ||
| 134 | |||
| 135 | L<Issues|https://github.com/iamalnewkirk/zing/issues> | ||
| 136 | |||
| 137 | =cut | ||