App-Context

 view release on metacpan or  search on metacpan

bin/app-apache  view on Meta::CPAN


my $APACHECONF  = $App::options{apache_appserver_conf};
if (!$APACHECONF) {
    my ($APACHEBASECONF, $baseconf_mtime, $conf_mtime, @stat);
    my ($APACHEBASELOG);

    $APACHEBASECONF = "$PREFIX/apache/conf/httpd.conf";
    $APACHEBASECONF = "$APACHEROOT/conf/httpd.conf" if (! -f $APACHEBASECONF);
    $baseconf_mtime = 0;
    if (-f $APACHEBASECONF) {
        @stat = stat($APACHEBASECONF);
        $baseconf_mtime = $stat[9];
    }

    $APACHECONF = "$CONFDIR/httpd.conf";
    $conf_mtime = 0;
    if (-f $APACHECONF) {
        @stat = stat($APACHECONF);
        $conf_mtime = $stat[9];
    }

    if ($baseconf_mtime && (!$conf_mtime || ($conf_mtime < $baseconf_mtime))) {
        my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($conf_mtime);
        my $mdatetime = sprintf("%04d%02d%02d-%02d%02d%02d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
        system("mv $APACHECONF $APACHECONF.$mdatetime") if (-f $APACHECONF);
        $APACHEBASELOG = "$APACHEROOT/logs";
        local(*CONF, *BASECONF);
        open(main::BASECONF, "< $APACHEBASECONF") || die "Unable to open $APACHEBASECONF for reading: $!\n";

lib/App/datetime.pod  view on Meta::CPAN

It represents the number of non-leap seconds since 
January 1, 1970 UTC (the "Epoch" at GMT).  The following internal
Perl function gets the current time.

 $current_time = time;
 $current_time = time();

Other Perl functions that return this "datetime" integer are

 ($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
  $atime, $mtime, $ctime, $blksize, $blocks) = stat($filename);
 ($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
  $atime, $mtime, $ctime, $blksize, $blocks) = lstat($filename);

where $atime, $mtime, and $ctime are the same kind of integers,
representing the access time, modification time, and change time
of a file.

These $time values may be converted to human-readable
form using the following internal perl functions.
(See the "perlfunc" man page for more information.)

 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time);

lib/App/perlstyle.pod  view on Meta::CPAN

clear what is going on, or when it is required (such as with
map() and grep()).

    for (@list) {
        print;              # OK; everyone knows this one
        print uc;           # wrong; few people know this
        print uc $_;        # better
    }

Note that the special variable C<_> I<should> be used when possible.
It is a placeholder that can be passed to stat() and the file test
operators, that saves perl a trip to re-stat the file.  In the
example below, using C<$file> over for each file test, instead of
C<_> for subsequent uses, is a performance hit.  You should be
careful that the last-tested file is what you think it is, though.

    if (-d $file) {         # $file is a directory
        # ...
    } elsif (-l _) {        # $file is a symlink
        # ...
    }



( run in 1.282 second using v1.01-cache-2.11-cpan-49f99fa48dc )