Devel::PerlySense::BookmarkConfig - A collection of


Devel-PerlySense documentation Contained in the Devel-PerlySense distribution.

Index


Code Index:

NAME

Top

Devel::PerlySense::BookmarkConfig - A collection of Bookmark::Definition and their configuration.

DESCRIPTION

Top

This is the Bookmark config chunk, and the parsed Bookmark::Definition objects that results in.

PROPERTIES

Top

oPerlySense

Devel::PerlySense object.

Default: set during new()

raDefinition

Array ref with Bookmark::Definition objects from the oPerlySense config.

METHODS

Top

new(oPerlySense)

Create new BookmarkConfig object. Associate it with $oPerlySense.

aMatch(file)

Parse the text in $file and return list of Bookmark::MatchResult objects that have matches.

Die on errors, like if $file doesn't exist.

AUTHOR

Top

Johan Lindström, <johanl[ÄT]DarSerMan.com>

BUGS

Top

Please report any bugs or feature requests to bug-devel-perlysense@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


Devel-PerlySense documentation Contained in the Devel-PerlySense distribution.




use strict;
use warnings;

package Devel::PerlySense::BookmarkConfig;
our $VERSION = '0.01';



use Spiffy -Base;
use Carp;
use Data::Dumper;
use File::Basename;
use File::Path;
use Path::Class;

use Devel::PerlySense;
use Devel::PerlySense::Util;
use Devel::PerlySense::Util::Log;

use Devel::PerlySense::Bookmark::Definition;
use Devel::PerlySense::Bookmark::MatchResult;





field "oPerlySense" => undef;





sub raDefinition {
    return [
        map { Devel::PerlySense::Bookmark::Definition->newFromConfig( %$_ ) }
        @{$self->oPerlySense->rhConfig->{bookmark}}
    ];
}





sub new {
    my ($oPerlySense) = Devel::PerlySense::Util::aNamedArg(["oPerlySense"], @_);

    $self = bless {}, $self;    #Create the object. It looks weird because of Spiffy
    $self->oPerlySense($oPerlySense);

    return($self);
}





sub aMatchResult {
    my ($file) = Devel::PerlySense::Util::aNamedArg(["file"], @_);

    defined( my $source = slurp($file) ) or die("Could not read source file ($file)\n");

    $self->oPerlySense->setFindProject(file => $file) or debug("Could not identify any PerlySense Project for Bookmark matching, but that's not fatal\n");

    my @aMatchResult = map {
        Devel::PerlySense::Bookmark::MatchResult->newFromMatch(
            oDefinition => $_,
            file => $file,
            source => $source
        );
    } @{$self->raDefinition};

    return(@aMatchResult);
}





1;





__END__