package VineLinux::VSS::Type;

use HTML::Template;
use FileHandle;

my $output_dir = ".";

sub new {
    my $class = shift;
    bless {}, $class;
}

sub generate {
    my $class = shift;

    die "not implement \n";
}

sub _generate_file {
    my $class = shift;
    my $filename = shift;
    my $content = shift;

    my $fh = new FileHandle "> $output_dir/$filename";
    if (defined $fh) {
	$fh->print($content);
	$fh->close;
    }
   
    return 1;
}

sub _current_time {
    my $class = shift;
    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);

    my $e_mon = sprintf("%s", 
			("Jan", "Feb", "Mar", "Apr", "May", "Jun",
			 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$mon]);
    my $e_week = sprintf("%s", 
			 ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")[$wday]);
    
    return sprintf("%s %s %02d %04d", $e_week, $e_mon, $mday, $year + 1900);
}

sub _set_params {
    my $class = shift;
    my $vss = shift;

    my %params = (
	package_name => $vss->package_name,
	packager_fullname => $vss->packager_fullname,
	packager_name => $vss->packager_name,
	packager_email => $vss->packager_email,
	generate_date => $class->_current_time
    );

    return \%params;
}

1;

