#!/usr/bin/perl -w
use strict;
use Getopt::Long;

my $file="new.php";
my $version="1.0.0";
my $author='Vulcho Nedelchev (weby@bastun.net)';
my $date=scalar localtime;
my @include=();
my $help=0;

GetOptions ( 	"file=s"    => \$file,
		"include=s" => \@include,
		"h|help"    => \$help);

&usage if $help;

die "Sorry! The file $file already exists. Try another filename\n" if -e $file;
die unless new_php($file);

sub new_php {
	open  PHP,"> $file" or die "$0 return error: $!\n";
	print PHP "<?php\n";
	print PHP "# Author: $author\n";
	print PHP "# Date: $date\n";
	print PHP "# Version: $version\n\n";
	for(@include) {
		print PHP "include(\"$_\");\n";
	}
	print PHP "\n";
	print PHP "?>\n";
	close(PHP);
}

sub usage {
	print <<USG;
	
  usage:
    $0 --file=new.php --include=one.php --include=two.php
	
USG
	exit;
}