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.48
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
49 The source code repository for Specio can be found at
50 <https://github.com/houseabsolute/Specio>.
51
53 Dave Rolsky <autarch@urth.org>
54
56 This software is Copyright (c) 2012 - 2022 by Dave Rolsky.
57
58 This is free software, licensed under:
59
60 The Artistic License 2.0 (GPL Compatible)
61
62 The full text of the license can be found in the LICENSE file included
63 with this distribution.
64
65
66
67perl v5.38.0 2023-07-21 Specio::DeclaredAt(3)