1Path::IsDev::Object(3)User Contributed Perl DocumentationPath::IsDev::Object(3)
2
3
4
6 Path::IsDev::Object - Object Oriented guts for IsDev export
7
9 version 1.001003
10
12 use Path::IsDev::Object;
13
14 my $dev = Path::IsDev::Object->new();
15 my $dev = Path::IsDev::Object->new( set => 'MySet' );
16
17 if ( $dev->matches($path) ){
18 print "$path is dev";
19 }
20
22 Exporting functions is handy for end users, but quickly becomes a huge
23 headache when you're trying to chain them.
24
25 e.g: If you're writing an exporter yourself, and you want to wrap
26 responses from an exported symbol, while passing through user
27 configuration => Huge headache.
28
29 So the exporter based interface is there for people who don't need
30 anything fancy, while the Object based interface is there for people
31 with more complex requirements.
32
34 "matches"
35 Determine if a given path satisfies the "set"
36
37 if( $o->matches($path) ){
38 print "We have a match!";
39 }
40
42 "set"
43 The name of the "HeuristicSet::" to use.
44
45 Default is "Basic", or the value of $ENV{PATH_ISDEV_DEFAULT_SET}
46
47 "set_prefix"
48 The "HeuristicSet" prefix to use to expand "set" to a module name.
49
50 Default is "Path::IsDev::HeuristicSet"
51
52 "set_module"
53 The fully qualified module name.
54
55 Composed by joining "set" and "set_prefix"
56
57 "loaded_set_module"
58 An accessor which returns a module name after loading it.
59
61 "_instance_id"
62 An opportunistic sequence number for help with debug messages.
63
64 Note: This is not guaranteed to be unique per instance, only guaranteed
65 to be constant within the life of the object.
66
67 Based on "refaddr", and giving out new ids when new "refaddr"'s are
68 seen.
69
70 "_debug"
71 The debugger callback.
72
73 export PATH_ISDEV_DEBUG=1
74
75 to get debug info.
76
77 "_with_debug"
78 Wrap calls to Path::IsDev::debug to have a prefix with an object
79 identifier.
80
81 $ob->_with_debug(sub{
82 # Path::Tiny::debug now localised.
83
84 });
85
86 "BUILD"
87 "BUILD" is an implementation detail of "Class::Tiny".
88
89 This module hooks "BUILD" to give a self report of the object to
90 *STDERR after "->new" when under $DEBUG
91
92 "_matches"
93 my $result = $o->matches( $path );
94
95 $result here will be a constructed "Path::IsDev::Result".
96
97 Note this method may be handy for debugging, but you should still call
98 "matches" for all real code.
99
101 Kent Fredric <kentnl@cpan.org>
102
104 This software is copyright (c) 2017 by Kent Fredric
105 <kentfredric@gmail.com>.
106
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109
110
111
112perl v5.32.0 2020-07-28 Path::IsDev::Object(3)