[488] | 1 | package VineLinux::VSS::Type; |
---|
| 2 | |
---|
| 3 | use HTML::Template; |
---|
| 4 | use FileHandle; |
---|
| 5 | |
---|
| 6 | my $output_dir = "."; |
---|
| 7 | |
---|
| 8 | sub new { |
---|
| 9 | my $class = shift; |
---|
| 10 | bless {}, $class; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | sub generate { |
---|
| 14 | my $class = shift; |
---|
| 15 | |
---|
| 16 | die "not implement \n"; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | sub _generate_file { |
---|
| 20 | my $class = shift; |
---|
| 21 | my $filename = shift; |
---|
| 22 | my $content = shift; |
---|
| 23 | |
---|
| 24 | my $fh = new FileHandle "> $output_dir/$filename"; |
---|
| 25 | if (defined $fh) { |
---|
| 26 | $fh->print($content); |
---|
| 27 | $fh->close; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | return 1; |
---|
| 31 | } |
---|
| 32 | |
---|
[493] | 33 | sub _current_time { |
---|
| 34 | my $class = shift; |
---|
| 35 | my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); |
---|
| 36 | |
---|
| 37 | my $e_mon = sprintf("%s", |
---|
| 38 | ("Jan", "Feb", "Mar", "Apr", "May", "Jun", |
---|
| 39 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$mon]); |
---|
| 40 | my $e_week = sprintf("%s", |
---|
[663] | 41 | ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")[$wday]); |
---|
[493] | 42 | |
---|
| 43 | return sprintf("%s %s %02d %04d", $e_week, $e_mon, $mday, $year + 1900); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | sub _set_params { |
---|
| 47 | my $class = shift; |
---|
| 48 | my $vss = shift; |
---|
| 49 | |
---|
| 50 | my %params = ( |
---|
| 51 | package_name => $vss->package_name, |
---|
| 52 | packager_fullname => $vss->packager_fullname, |
---|
| 53 | packager_name => $vss->packager_name, |
---|
| 54 | packager_email => $vss->packager_email, |
---|
| 55 | generate_date => $class->_current_time |
---|
| 56 | ); |
---|
| 57 | |
---|
| 58 | return \%params; |
---|
| 59 | } |
---|
| 60 | |
---|
[488] | 61 | 1; |
---|
[493] | 62 | |
---|