#!/usr/bin/env perl

# Convenient interface to running Perl on Daikon-annotated perl
# programs that don't yet have types.

# This is currently the same as "dtrace-perl", except that it looks in
# different directories for annotated .pm files.

# $Id$

use strict;
use 5.006;
use warnings;
BEGIN {
    require English;
    if ($^V ge 5.8.0) {
        English->import("-no_match_vars"); # avoid speed penalty
    } else {
        English->import();
    }
}

use File::Basename;
my $dirname = dirname(__FILE__);

my @locs = ('daikon-untyped', 'lib/daikon-untyped',
            'blib/lib/daikon-untyped', '../blib/lib/daikon-untyped');

my $perl = $EXECUTABLE_NAME;
my $perl_lib = "-I$dirname/front-end/perl/lib";

my @args = ($perl_lib, @ARGV);

for my $loc (@locs) {
    if (-e $loc) {
        unshift @args, "-I$loc";
        last;
    }
}

unshift @args, $perl;

print STDERR join(" ", @args), "\n";

my $result = system(@args);

exit $result;
