The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::CheckSite::Util - provide utilities for WWW::CheckSite

SYNOPSIS

    use WWW::CheckSite::Util;

    my $cache = new_cashe;

    my $data;
    if ( $data = $cache->has( $key ) ) { # $data is a *copy*
        # change $data
        $cache->set( $key => $data );
    } else {
        # set $data
        $cache->set( $key => $data );
    }

    my $stack = new_stack( @sfields );

new_cache

Return a new WWW::CheckSite::Util::Cache object.

new_stack

Return a new WWW::CheckSite::Util::Stack object.

WWW::CheckSite::Util::Cache

Implements a simple cache as a hash. Storage and reteival on the keyvalue.

set( $key => $data )

Add (or update) the cache for this key. Returns $data.

unset( $key )

Remove the item for this key from the cache.

has( $key )

Return the data if the exists otherwise return undef.

WWW::CheckSite::Util::Stack

Implements a simple "Last in First out" stack. (They're called arrays in Perl :-)

push( $data )

Push $data onto the stack.

pop

Return the last data pushed onto the stack.

peek

Return the last item on the stack without popping it.

size

Return the size of the stack.

COPYRIGHT