« auto/share/dist/Nes/cgi-bin/obj/Nes/form/secure_login_param.pl
↑ Summary
auto/share/dist/Nes/cgi-bin/obj/go_language.pl »
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # ----------------------------------------------------------------------------- | ||
| 4 | # | ||
| 5 | # Nes by Skriptke | ||
| 6 | # Copyright 2009 - 2010 Enrique F. Castañón Barbero | ||
| 7 | # Licensed under the GNU GPL. | ||
| 8 | # | ||
| 9 | # CPAN: | ||
| 10 | # http://search.cpan.org/dist/Nes/ | ||
| 11 | # | ||
| 12 | # Sample: | ||
| 13 | # http://nes.sourceforge.net/ | ||
| 14 | # | ||
| 15 | # Repository: | ||
| 16 | # http://github.com/Skriptke/nes | ||
| 17 | # | ||
| 18 | # Version 1.03 | ||
| 19 | # | ||
| 20 | # date_time.pl | ||
| 21 | # | ||
| 22 | # ----------------------------------------------------------------------------- | ||
| 23 | |||
| 24 | use Nes; | ||
| 25 | use strict; | ||
| 26 | use POSIX qw(strftime); | ||
| 27 | |||
| 28 | my $nes = Nes::Singleton->new('./date_time.html'); | ||
| 29 | my $q = $nes->{'query'}->{'q'}; | ||
| 30 | my $local_gmt = $q->{'local_gmt'} || $q->{'date_time_param_1'} || shift @ARGV || 'local'; | ||
| 31 | my $format = $q->{'format'} || $q->{'date_time_param_2'} || "@ARGV" || '%a %e %b %Y %H:%M:%S'; | ||
| 32 | |||
| 33 | my $tags = {}; | ||
| 34 | $tags->{'date_time'} = POSIX::strftime( "$format", localtime ); # default | ||
| 35 | $tags->{'date_time'} = POSIX::strftime( "$format", gmtime ) if $local_gmt =~ /gmt/i; | ||
| 36 | |||
| 37 | # determine CGI Environment | ||
| 38 | if ( $ENV{'REMOTE_ADDR'} || $ENV{'REMOTE_HOST'} || $ENV{'SCRIPT_NAME'} ) { | ||
| 39 | # CGI | ||
| 40 | $nes->out(%$tags); | ||
| 41 | } else { | ||
| 42 | # command line | ||
| 43 | print $tags->{'date_time'},"\n"; | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | # don't forget to return a true value from the file | ||
| 48 | 1; | ||
| 49 |