14 sub kilobytes { $_[0] * 1024 }
15 sub megabytes { $_[0] * 1024->kilobytes }
16 sub gigabytes { $_[0] * 1024->megabytes }
17 sub terabytes { $_[0] * 1024->gigabytes }
20 no warnings 'once'; # << squelch the stupid "used only once, maybe typo" warnings
22 *kilobyte = \&kilobytes;
23 *megabyte = \&megabytes;
24 *gigabyte = \&gigabytes;
25 *terabyte = \&terabytes;
29 Moose::Autobox->mixin_additional_role(SCALAR => 'Units::Bytes');
33 print "5 kilobytes are " . 5->kilobytes . " bytes";
34 print "2 megabytes are " . 2->megabytes . " bytes";
35 print "1 gigabyte is " . 1->gigabyte . " bytes";
36 print "2 terabyes are " . 2->terabytes . " bytes";