Acme-Drunk
view release on metacpan or search on metacpan
body_weight
Your body weight is also important. Not all people are created
equal, and the amount of alcohol one body can saturate is much
different than another body.
alcohol_weight
The weight of alcohol you've had in ounces. This can be hard to
calculate, and two helpful functions are exported for your use. Here
is a common example, Guiness Gold Lager.
my $alcohol_weight = floz_to_etoh( 16, proof_to_percent( 8.48 ) );
Acme::Drunk can't do these sorts of calculations for you. You might
be a raging alcoholic, drinking 45 beers a night, or so many
different drinks that Acme::Drunk can no-longer keep track.
If there is interest, Acme::Drunk may have an accompanying
Acme::Drunk::Drinks package containing constants such as
"GUINESS_DRAUGHT_CAN", "JACK_DANIELS", or "NyQUIL". Please contact
the author. Here would be an example.
alcohol_weight => ( GUINESS_DRAUGHT_CAN*7 + JACK_DANIELS*3 ),
If you can't come up with the alcohol_weight you've had, don't
worry, you might not yet be drunk.
"proof_to_percent()"
Accepts one argument, the proof number. Does a simple calculation to
convert it to percent. Returns the percentage.
"floz_to_etoh()"
Accepts two arguments, the number of ounces a drink was, and the
percentage of that drink that was alcohol. Returns the fluid ounces of
alcohol contained in the drink.
"ml_to_etoh()"
For our less US-centric friends, this function is exactly like
"floz_to_etoh()", except its first argument is the number of milileters
in a drink.
How it Works
Widmark's Formula for Blood Alcohol Content
lib/Acme/Drunk.pm view on Meta::CPAN
package Acme::Drunk;
use strict;
require Exporter;
use base qw[Exporter];
use vars qw[$VERSION @EXPORT %EXPORT_TAGS];
$VERSION = '0.03';
@EXPORT = qw[MALE FEMALE drunk floz_to_etoh proof_to_percent];
%EXPORT_TAGS = ( ':all' => \@EXPORT );
sub ML_IN_FLOZ () { 0.0338140226 }
sub MALE () { 0 }
sub FEMALE () { 1 }
# Widmark r factor (reduced body mass).
# Men: 0.50-0.90 avg 0.68.
# Women: 0.45-0.63 avg 0.55.
lib/Acme/Drunk.pm view on Meta::CPAN
$body_weight * ( $gender == MALE ? MALE_WIDMARK_R : FEMALE_WIDMARK_R );
}
# Water Tissue Alcohol Concentration
sub wtac {
my ($body_weight, $alcohol_weight, $gender) = @_;
bac( bha($body_weight, $gender), $alcohol_weight );
}
# Proof goes to 200.
sub proof_to_percent {
my ($proof) = @_;
$proof / 2;
}
# For N fluid ounces of alcohol, find pure alcohol content.
sub floz_to_etoh {
my ($ounces, $percent) = @_;
$ounces * $percent;
}
# For N ml of alcohol, find pure alcohol content.
sub ml_to_etoh {
floz_to_etoh( $_[0] * ML_IN_FLOZ, $_[1] );
}
# Convert fluid_ounces of EtOH to weight in pounds.
sub etoh_to_lbs {
my ($ounces) = @_;
lib/Acme/Drunk.pm view on Meta::CPAN
Your body weight is also important. Not all people are created equal,
and the amount of alcohol one body can saturate is much different than
another body.
=item alcohol_weight
The weight of alcohol you've had in ounces. This can be hard to
calculate, and two helpful functions are exported for your use. Here is
a common example, Guiness Gold Lager.
my $alcohol_weight = floz_to_etoh( 16, proof_to_percent( 8.48 ) );
Acme::Drunk can't do these sorts of calculations for you. You might
be a raging alcoholic, drinking 45 beers a night, or so many different
drinks that Acme::Drunk can no-longer keep track.
If there is interest, Acme::Drunk may have an accompanying
Acme::Drunk::Drinks package containing constants such as
C<GUINESS_DRAUGHT_CAN>, C<JACK_DANIELS>, or C<NyQUIL>. Please contact
the author. Here would be an example.
alcohol_weight => ( GUINESS_DRAUGHT_CAN*7 + JACK_DANIELS*3 ),
If you can't come up with the alcohol_weight you've had, don't worry,
you might not yet be drunk.
=back
=head2 C<proof_to_percent()>
Accepts one argument, the proof number. Does a simple calculation to
convert it to percent. Returns the percentage.
=head2 C<floz_to_etoh()>
Accepts two arguments, the number of ounces a drink was, and the
percentage of that drink that was alcohol. Returns the fluid ounces of
alcohol contained in the drink.
=head2 C<ml_to_etoh()>
For our less US-centric friends, this function is exactly like
C<floz_to_etoh()>, except its first argument is the number of ml
in a drink.
=head2 How it Works
( run in 0.334 second using v1.01-cache-2.11-cpan-709fd43a63f )