Code-TidyAll

 view release on metacpan or  search on metacpan

lib/Code/TidyAll.pm  view on Meta::CPAN

    }
}

sub _purge_backups {
    my ($self) = @_;
    $self->msg('purging old backups') if $self->verbose;
    find(
        {
            follow => 0,
            wanted => sub {
                unlink $_ if -f && /\.bak$/ && time > ( stat($_) )[9] + $self->_backup_ttl_secs;
            },
            no_chdir => 1
        },
        $self->_backup_dir,
    );
}

sub new_from_conf_file {
    my ( $class, $conf_file, %params ) = @_;

lib/Code/TidyAll/CacheModel.pm  view on Meta::CPAN


sub _build_cache_key {
    my ($self) = @_;
    return 'sig/' . $self->path;
}

sub _build_cache_value {
    my ($self) = @_;

    # this stat isn't ideal, but it'll do
    my $last_mod = ( stat( $self->full_path ) )[9];
    return $self->_sig( [ $self->base_sig, $last_mod, $self->file_contents ] );
}

sub _build_is_cached {
    my ($self) = @_;

    return unless $self->_has_cache_engine;
    my $cached_value = $self->cache_engine->get( $self->cache_key );
    return defined $cached_value && $cached_value eq $self->cache_value;
}

php/PHP_CodeSniffer/src/Util/Common.php  view on Meta::CPAN


        // Finally we will use fstat.  The solution borrowed from
        // https://stackoverflow.com/questions/11327367/detect-if-a-php-script-is-being-run-interactively-or-not
        // This doesn't work on Mingw/Cygwin/... using Mintty but they
        // have `tty` installed.
        $type = [
            'S_IFMT'  => 0170000,
            'S_IFIFO' => 0010000,
        ];

        $stat  = fstat(STDIN);
        $mode  = ($stat['mode'] & $type['S_IFMT']);
        $isTTY = ($mode !== $type['S_IFIFO']);

        return $isTTY;

    }//end isStdinATTY()


    /**
     * Prepares token content for output to screen.



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