1Specio::DeclaredAt(3) User Contributed Perl DocumentationSpecio::DeclaredAt(3)
2
3
4
6 Specio::DeclaredAt - A class to represent where a type or coercion was
7 declared
8
10 version 0.47
11
13 my $declared = Specio::DeclaredAt->new_from_caller(1);
14
15 print $declared->description;
16
18 This class provides a thin wrapper around some of the return values
19 from Perl's "caller" built-in. It's used internally to identify where
20 types and coercions are being declared, which is useful when generating
21 error messages.
22
24 This class provides the following methods.
25
26 Specio::DeclaredAt->new_from_caller($depth)
27 Given a call stack depth, this method returns a new
28 "Specio::DeclaredAt" object.
29
30 $declared_at->package, $declared_at->filename, $declared_at->line
31 Returns the call stack information recorded when the object was
32 created. These values are always populated.
33
34 $declared_at->subroutine
35 Returns the subroutine from the call stack. This may be an "udnef"
36
37 $declared_at->has_subroutine
38 Returns true if there is a subroutine name associated with this object.
39
40 $declared_at->description
41 Puts all the information together into a single string like "declared
42 in package Foo::Bar (.../Foo/Bar.pm) at line 42 in sub named blah".
43
45 Bugs may be submitted at
46 <https://github.com/houseabsolute/Specio/issues>.
47
48 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
49
51 The source code repository for Specio can be found at
52 <https://github.com/houseabsolute/Specio>.
53
55 Dave Rolsky <autarch@urth.org>
56
58 This software is Copyright (c) 2012 - 2021 by Dave Rolsky.
59
60 This is free software, licensed under:
61
62 The Artistic License 2.0 (GPL Compatible)
63
64 The full text of the license can be found in the LICENSE file included
65 with this distribution.
66
67
68
69perl v5.32.1 2021-01-31 Specio::DeclaredAt(3)