Path::I...::Result(3)

🌸 NAME 🌸

Path::IsDev::Result β€” Result container. Also hi bestie, this is the Path::I...::Result(3) page from the User Contributed Perl Documentation, so you're literally in the right group chat. πŸ’–

✨ VERSION ✨

version 1.001003 β€” that's the version, periodt. πŸŽ€

🧚 SYNOPSIS 🧚

Okay so here's the whole vibe in code:

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 whole 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. No cap. 🫢

So 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. It's giving "main character energy" for debugging, honestly. ✨

πŸ”§ METHODS πŸ”§

"BUILD"

Listed as a method, bestie. The original doesn't add extra notes here beyond the name. πŸ’…

"add_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 🌈

  • "path"
  • "result"
  • "reasons"

πŸ‘‘ AUTHOR πŸ‘‘

Kent Fredric <kentnl@cpan.org> β€” iconic. 🫢

This software is copyright (c) 2017 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. πŸ’–


That's the whole manual, bestie. This page is from perl v5.42.0, dated 2017-03-11, and it's the Path::I...::Result(3) manual. bye πŸ’…βœ¨

πŸ“¦ where this page comes from