App-RecordStream

 view release on metacpan or  search on metacpan

lib/App/RecordStream/OptionalRequire.pm  view on Meta::CPAN

use strict;
use warnings;

# Set to this 0 if you don't want the warnings printed
our $PRINT_WARNING = 1;

my @missing_modules;

sub import {
  my $class = shift;
  my $calling_package = (caller())[0];
  return optional_use_with_caller($calling_package, @_);
}

# For testing and calling outside of other things... CHECK will not work in this case...
sub optional_use {
  my $calling_package = (caller())[0];
  return optional_use_with_caller($calling_package, @_);
}

sub optional_use_with_caller {
  my $calling_package = shift;

  my $loaded;

  $loaded = use_module($calling_package, @_);
  my $module_name = $_[0];

lib/App/RecordStream/Test/OperationHelper.pm  view on Meta::CPAN

  #ok(0, "DIE");
  my @output_records;
  if ( $output ) {
    while ( my $record = $output->get_record() ) {
      push @output_records, $record;
    }
  }

  # Find the call level of the originating test file for better diagnostic
  # reporting if we fail tests below
  my ($level_to_testfile, $file) = (0, (caller(0))[1]);
  while (defined $file and $file !~ /\.t$/) {
    $level_to_testfile++;
    $file = (caller($level_to_testfile))[1];
  }

  local $Test::Builder::Level = $Test::Builder::Level + $level_to_testfile + 1;

  my $is_ok = 1;
  for my $record (@$results) {
    $is_ok = 0 if ( ! ok(UNIVERSAL::isa($record, 'App::RecordStream::Record'), "Record is a App::RecordStream::Record") );
  }

  $is_ok = 0 if ( ! is_deeply($results, \@output_records, "Records match: $name") );



( run in 0.360 second using v1.01-cache-2.11-cpan-cc502c75498 )