GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PATH::ISDEV::RESULT (3)

.ds Aq ’

NAME

Path::IsDev::Result - Result container

CONTENTS

VERSION

version 1.001002

SYNOPSIS



    use Path::IsDev::Result;

    my $result = Path::IsDev::Result->new( path => /some/path/that/exists ):

    if ( $heuristcset->matches( $result ) ) {
        print Dumper($result);
    }



DESCRIPTION

This is a reasonably new internal component for Path::IsDev.

Its purpose is to communicate state between internal things, and give some sort of introspectable context for why things happened in various places without resorting to spamming debug everywhere.

Now instead of turning on debug, as long as you can get a result, you can inspect and dump that result at the point you need it.

METHODS

CWBUILD

CWadd_reason

Call this method from a heuristic to record checking of the heuristic and the relevant meta-data.



    $result->add_reason( $heuristic, $matchvalue, $reason_summary, \%contextinfo );



For example:



    sub Foo::matches  {
        my ( $self , $result_object ) = @_;
        if ( $result_object->path->child(bar)->exists ) {
            $result_object->add_reason( $self, 1, "child bar exists" , {
                child => bar,
                exists? => 1,
                child_path => $result_object->path->child(bar)
            });
            $result_object->result(1);
            return 1;
        }
        return;
    }



Note that here, $matchvalue should be the result of the relevant matching logic, not the global impact.

For instance, excludes compositions should still add reasons of $matchvalue == 1, but they should not set $result_object->result(1). ( In fact, setting result is the job of the individual heuristic, not the matches that are folded into it )

ATTRIBUTES

CWpath

CWresult

CWreasons

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PATH::ISDEV::RESULT (3) 2014-08-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.