James Counts > Test-Approvals-v0.0.4 > Test::Approvals::Reporters::Win32Reporter

Download:
Test-Approvals-v0.0.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: v0.0.4   Source   Latest Release: Test-Approvals-v0.0.5

NAME ^

Test::Approvals::Reporters::Win32Reporter - Generic base for creating reporters that work on Windows.

VERSION ^

This documentation refers to Test::Approvals::Reporters::Win32Reporter version v0.0.4

SYNOPSIS ^

    package Test::Approvals::Reporters::MyCoolReporter;

    use strict;
    use warnings FATAL => 'all';

    {
        use version; our $VERSION = qv('v0.0.4');
        use Moose;

        with 'Test::Approvals::Reporters::Win32Reporter';
        with 'Test::Approvals::Reporters::Reporter';
        with 'Test::Approvals::Reporters::EnvironmentAwareReporter';

        sub exe {
            return locate_exe( 'CoolCo', 'CooDiff.exe' );
        }

        sub argv {
            return default_argv();
        }
    }
    __PACKAGE__->meta->make_immutable;
    1;

DESCRIPTION ^

This module provides a common base for reporters on Windows. By extending this class, you get a search strategy for locating your reporter, and you don't have to worry about the details of launching a detatched child process.

SUBROUTINES/METHODS ^

default_argv

    my $argv = $reporter->default_argv();

Retrieve the shell arguments commonly used by diff utilities.

launch

    my $received = 'test.received.txt';
    my $approved = 'test.approved.txt';
    $reporter->launch($received, $approved);

Create a detached Windows process for the diff utility, passing the new process the arguments required to compare the approved file with the received file.

locate_exe

    # Path within "Program Files"
    my $relative_path = 'DiffUtilMaker/SuperDiff';

    # Diff utility executable name
    my $exe = 'SuperDiffUtil.exe';

    my $exe_path = locate_exe($relative_path, $exe);

Search for $exe on the path, and in common locations. If not found, hope that it's underneath the Windows "Program Files" directory.

report

    my $received = 'test.received.txt';
    my $approved = 'test.approved.txt';
    $reporter->report($received, $approved);

Normalize the paths to received and approved files, then try to launch the diff utility.

DIAGNOSTICS ^

None at this time.

CONFIGURATION AND ENVIRONMENT ^

None.

DEPENDENCIES ^

Capture::Tiny File::Touch FindBin::Real Moose::Role version Win32::Process

INCOMPATIBILITIES ^

None known.

BUGS AND LIMITATIONS ^

Windows-only. Linux/OSX/other support will be added when time and access to those platforms permit.

AUTHOR ^

Jim Counts - @jamesrcounts

LICENSE AND COPYRIGHT ^

Copyright (C) 2013 Jim Counts

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    L<http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

syntax highlighting: