[Chicago-talk] Fwd: Informal Meeting Tomorrow

Joel Berger joel.a.berger at gmail.com
Fri Dec 9 08:11:58 PST 2011


Hi Shlomi,

Thanks for the lead. I didn't end up using Language::Farnsworth but rather
a combination of Math::Units and Physics::Unit, which both do something
like multiplying units.

The big task for me though was simply to accept a string with a unit and
via coercion end up with a number in the appropriate unit. It certainly
isn't in a final form, and no docs yet, but my repo at
https://github.com/jberger/MooseX-Types-NumUnit has my current work on the
matter.

My pride and joy is that:

package MyTest;

use Moose;
use MooseX::Types::NumUnit qw/num_of_unit/;

#$MooseX::Types::NumUnit::Verbose = 1;

has 'speed' => ( isa => num_of_unit('ft / hour'), is => 'rw', required => 1
);

no Moose;
__PACKAGE__->meta->make_immutable;

my $test = MyTest->new( speed => '2 m / s' );

print $test->speed, "\n";
__END__

prints: 23622.0472440945

Cheers,

Joel Berger


On Thu, Dec 8, 2011 at 10:28 AM, Shlomi Fish <shlomif at shlomifish.org> wrote:

> Hi,
>
> On Thu, 8 Dec 2011 09:19:05 -0600
> Joel Berger <joel.a.berger at gmail.com> wrote:
>
> > Ok so while there is still only a small response, those who have
> responded
> > are still excited to meet, so:
> >
> > We Are Still On!
> >
> > Anyone, of course, will be welcome to come join us. We will be at
> Dugan's,
> > just north of Adams on Halsted. As I metion in the meetup description,
> > during happy hour (which I believe is 5-7) they have some free food,
> other
> > than that there is no food at Dugans, so plan accordingly. I expect I
> will
> > be there a little early so as to partake. The official start time for the
> > meetup is 7:00.
> >
> > Some topics which may be discussed:
> >
> > - Physical units as Moose types (for unit conversion via coersion)
>
> You may wish to look into Language::Farnsworth :
>
> http://search.cpan.org/dist/Language-Farnsworth/
>
> It has support for unit conversion and unit mathematics, including that of
> aggregate units. So you can divide 100 miles by 2 hours and get the result
> in
> metres/second, or much more funky stuff. We've been enjoying the
> "farnsworth"
> bot on some Perl channels on Freenode.
>
> Regards,
>
>        Shlomi Fish
>
>
>
> > - The Zoidberg Perl Shell
> > - David has a lead on a jit for Perl5!
> >
> > So plenty of fun for all; hope to see you there!
> >
> > Joel Berger
> > joel.a.berger at gmail.com
>
> --
> -----------------------------------------------------------------
> Shlomi Fish       http://www.shlomifish.org/
> Stop Using MSIE - http://www.shlomifish.org/no-ie/
>
> “THERE IS NO JUSTICE. THERE’S ONLY ME.“
>    — Death in Terry Pratchett's Mort
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20111209/eea5aeed/attachment.html>


More information about the Chicago-talk mailing list