Activator

 view release on metacpan or  search on metacpan

lib/Activator/Dictionary.pm  view on Meta::CPAN

Then create dictionary definition files for realms in the dictionary
path as such:

 <dict_files path>/<lang>/<realm>.dict

=head2 Dictionary File Format

To create a dictionary file, create a file named C<E<lt>realmE<gt>.dict>
containing key/value pairs separated by whitespace. Keys can have any
non-whitespace character in them. The amount of whitespace between key
and value can be any length and can be tab or space characters (more
specifically, any character that matches C</\s/>). Keys and values must
be on the same line.

For example:

  error.bummer        A bummer of an error occured
  foo-html            <p>this is the foo paragraph</p>
  welcome_msg         Welcome to Activatory::Dictionary!!
  answer              42

lib/Activator/Pager.pm  view on Meta::CPAN

package Activator::Pager;
use strict;

=head1 NAME

Activator::Pager - Object to assist in implementing pagination interfaces

=head1 SYNOPSIS

      use Activator::Pager;
      my $pager = new Activator::Pager( $offset, $length, $count, $total );


=head1 METHODS

=head2 new

Constructor to set internal variables.

Arguments:
  $offset       - offset of the first item in this set ( 0 indexed )

lib/Activator/Pager.pm  view on Meta::CPAN

        $self->{total} = 0;
        return $self;
    }

    ## from and to
    $self->{from} = $total > 0 ? $offset+1 : 0;
    $self->{to}   = $offset+$set_size < $total ? $offset+$set_size : $total;

    ## last page number
    #
    # Last page is total/length when evenly divisible. We mod them, if
    # there is remainder, add 1 for the last page. EG: 101/10 == 10
    # pages + 1 on the last page
    #
    # this new hotness courtesy Frank Wallingford
    # TODO: write pager tests, use this formula
    #$self->{last_page} = int(($total + ( $page_size - 1 ) ) / $page_size );

    # old and crufty
    $self->{last_page} = int($total/$page_size) + ( ($total % $page_size > 0) ? 1 : 0 );

    ## last offset
    #
    # Similar to above, we need to subtract 1 length when evenly
    # divisible so that we don't offset off the end of the available
    # results. If there is a remainder, subtract nothing.
    #WARN( qq{  ($self->{last_page} * $page_size) - ( ($total % $page_size > 0) ? 0 : $page_size)  });

    # this new hotness courtesy Frank Wallingford
    # TODO: write pager tests, use this formula
    #$self->{last_offset} = int( ( $total - 1 ) / $page_size ) + 1;

    # old and crufty
    $self->{last_offset} = int($total/$page_size) * $page_size - ( ($total % $page_size > 0) ? 0 : $page_size ); ;



( run in 0.337 second using v1.01-cache-2.11-cpan-65fba6d93b7 )