1Path::IsDev::Result(3)User Contributed Perl DocumentationPath::IsDev::Result(3)
2
3
4

NAME

6       Path::IsDev::Result - Result container
7

VERSION

9       version 1.001003
10

SYNOPSIS

12           use Path::IsDev::Result;
13
14           my $result = Path::IsDev::Result->new( path => '/some/path/that/exists' ):
15
16           if ( $heuristcset->matches( $result ) ) {
17               print Dumper($result);
18           }
19

DESCRIPTION

21       This is a reasonably new internal component for Path::IsDev.
22
23       Its purpose is to communicate state between internal things, and give
24       some sort of introspectable context for why things happened in various
25       places without resorting to spamming debug everywhere.
26
27       Now instead of turning on debug, as long as you can get a result, you
28       can inspect and dump that result at the point you need it.
29

METHODS

31   "BUILD"
32   "add_reason"
33       Call this method from a heuristic to record checking of the heuristic
34       and the relevant meta-data.
35
36           $result->add_reason( $heuristic, $matchvalue, $reason_summary, \%contextinfo );
37
38       For example:
39
40           sub Foo::matches  {
41               my ( $self , $result_object ) = @_;
42               if ( $result_object->path->child('bar')->exists ) {
43                   $result_object->add_reason( $self, 1, "child 'bar' exists" , {
44                       child => 'bar',
45                       'exists?' => 1,
46                       child_path => $result_object->path->child('bar')
47                   });
48                   $result_object->result(1);
49                   return 1;
50               }
51               return;
52           }
53
54       Note that here, $matchvalue should be the result of the relevant
55       matching logic, not the global impact.
56
57       For instance, "excludes" compositions should still add reasons of
58       "$matchvalue == 1", but they should not set
59       "$result_object->result(1)". ( In fact, setting "result" is the job of
60       the individual heuristic, not the matches that are folded into it )
61

ATTRIBUTES

63   "path"
64   "result"
65   "reasons"

AUTHOR

67       Kent Fredric <kentnl@cpan.org>
68
70       This software is copyright (c) 2017 by Kent Fredric
71       <kentfredric@gmail.com>.
72
73       This is free software; you can redistribute it and/or modify it under
74       the same terms as the Perl 5 programming language system itself.
75
76
77
78perl v5.36.0                      2023-01-20            Path::IsDev::Result(3)
Impressum