Acme-Mobile-Therbligs
view release on metacpan or search on metacpan
lib/Acme/Mobile/Therbligs.pm view on Meta::CPAN
=head1 NAME
Acme::Mobile::Therbligs - count keystrokes to write mobile text messages
=head1 SYNOPSIS
use Acme::Mobile::Therbligs;
$thurbs = count_therbligs("See u l8r");
# $thurbs == 23
=head1 DESCRIPTION
This module counts the number of I<therbligs> used to write mobile
text messages. A therblig is unit used to measure the number of
actions (in this case keypresses or pauses) for people who like to
optimize industrial processes.
So you can use this module to determine useless facts such as that it
takes as many keypresses to write "later" or "great" as it does "l8r"
and "gr8".
The current version is case insensitive and assumes (by default) a
particular brand of Nokia phone. (I have no idea which model it is; it
was cheap, and it works, which is all I care about.)
A description of methods is below.
=over
=cut
package Acme::Mobile::Therbligs;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.05';
use Exporter;
our @ISA = qw( Exporter );
our @EXPORT = qw( count_therbligs );
our %EXPORT_TAGS = (
'all' => [ @EXPORT ],
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
use constant DEFAULT_SAME_KEY => 1;
use Carp;
use YAML qw( Load Dump );
=item new
$obj = Acme::Mobile::Therbligs->new();
This is used for the object-oriented interface. It is only useful if
you want to specify your own keypad or modify the rules:
open $fh, 'mykeypad.yml';
$obj = Acme::Mobile::Therbligs->new($fh, \%rules );
The rule file is in L<YAML> format that specifies the characters for
each key pressed (in the order that they occur for each key press).
The optional rules allow one to change the behavior of the counting
function:
$obj = Acme::Mobile::Therbligs->new($fh,
{
SAME_KEY => 1,
NO_SENTENCE_CAPS => 0,
( run in 1.759 second using v1.01-cache-2.11-cpan-5735350b133 )