| 1 | |||
| 2 | ########################################################################### | ||
| 3 | # Copyright (c) Nate Wiger http://nateware.com. All Rights Reserved. | ||
| 4 | # Please visit http://formbuilder.org for tutorials, support, and examples. | ||
| 5 | ########################################################################### | ||
| 6 | |||
| 7 | package CGI::FormBuilder::Test; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | CGI::FormBuilder::Test - Test harness for FormBuilder | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | use CGI::FormBuilder::Test; | ||
| 16 | |||
| 17 | my $test = 1; | ||
| 18 | for (@tests) { | ||
| 19 | my $outfile = outfile($test++); | ||
| 20 | |||
| 21 | } | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | use strict; | ||
| 26 | use warnings; | ||
| 27 | no warnings 'uninitialized'; | ||
| 28 | |||
| 29 | use CGI::FormBuilder::Util; | ||
| 30 | |||
| 31 | |||
| 32 | our $VERSION = '3.10'; | ||
| 33 | our $DEBUG = 0; | ||
| 34 | |||
| 35 | use Exporter; | ||
| 36 | use base 'Exporter'; | ||
| 37 | our @EXPORT = qw(outfile); | ||
| 38 | |||
| 39 | use File::Basename 'fileparse'; | ||
| 40 | use File::Spec::Functions; | ||
| 41 | |||
| 42 | sub outfile ($) { | ||
| 43 | my($file, $dir) = fileparse($0); | ||
| 44 | $file =~ s/-.*//; # just save "1a-", "3d-", etc | ||
| 45 | my $out = catfile($dir, sprintf("$file-test%2.2d.html", $_[0])); | ||
| 46 | open(O, $out) || warn "Can't open $out: $!\n"; | ||
| 47 | return join '', <O>; | ||
| 48 | } | ||
| 49 | |||
| 50 | 1; | ||
| 51 | |||
| 52 | =head1 DESCRIPTION | ||
| 53 | |||
| 54 | =head1 REVISION | ||
| 55 | |||
| 56 | $Id: Test.pm 100 2007-03-02 18:13:13Z nwiger $ | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Copyright (c) L<Nate Wiger|http://nateware.com>. All Rights Reserved. | ||
| 61 | |||
| 62 | This module is free software; you may copy this under the terms of | ||
| 63 | the GNU General Public License, or the Artistic License, copies of | ||
| 64 | which should have accompanied your Perl kit. | ||
| 65 | |||
| 66 | =cut |