#!/usr/bin/perl use strict; use warnings; use Test::Class; my @test_classes; BEGIN { my @test_class_files; if (@ARGV) { push @test_class_files, @ARGV; } else { my @test_class_files = glob "UnitTest/*.pm"; } foreach my $i (@test_class_files) { if ($i =~ /\//) { $i =~ s/\//::/g; $i =~ s/\.pm$//; } push @test_classes, $i; } foreach my $i (@test_classes) { eval "require $i"; die $@ if $@; } } Test::Class->runtests; #### $ ./runtest.pl UnitTest/ELRes/Room.pm OR $ ./runtest.pl UnitTest::ELRes::Room