Saturday, September 24, 2011

Add Try::Tiny to Mouse or Moose

Here is a little snippet that shows how to extend Mouse (lightweight version of Moose) with Try::Tiny for better exception handling.

Here would be your application class:

package MyApp::Mouse;

use Mouse ();
use Mouse::Exporter;
use Try::Tiny;

	as_is => [qw[try catch finally]],
	also  => 'Mouse'


Then you simply use MyApp::Mouse in place of the Mouse module for your classes:

package Foo;

use MyApp:::Mouse;

sub t {
	my ($self,$d) = @_;
	my $v = try {
		die "testing" if $d;
	} catch {

	return $v;


A simple test?

package Foo;

~$ perl -Mfeature=:5.12 -MFoo -e say Foo->new->t;

Of course this recipe works with Moose, simply replace the Mouse namespace with the Moose namespace and your in business.


  1. So, like.. are you with "Sara Mangus" because she looks like a dude and you're secretly gay?

  2. WynnBET : Situs Slot Online | Casino Online Gambling
    WynnBET - Situs Slot Online WynnBet - Situs poormansguidetocasinogambling Slot Online WynnBet - Situs Slot Online 나비효과 WynnBet - Situs Slot apr casino Online septcasino WynnBet - Situs Slot Online WynnBet - Situs Slot Online

  3. Casino Niagara features over 1,300 slot and video poker machines, together with more than 350 progressive slots, on two action-packed ranges. With most slots featuring a Return to Player of 92-96%, any video games with a Return to Player above 96% is an efficient choice. In terms of win-size, progressive slots are the slot machines that pay the best – however they are additionally those with the lowest successful odds. Finding a great casino bonus is crucial to play slots on-line – particularly need to|if you want to} get a small benefit. The commonest bonus sorts embody free spins, extra money that matches your deposit, and 1xbet special provides for recurring gamers. The volatility of a slot machine recreation measures the risk involved in taking part in} a specific slot for real money.

  4. There are both vertical and horizontal choices out there, they usually often allow swiveling of the cutting head. The heart of a CNC machine is a high–value logic control panel, which includes a control loop unit and a knowledge processing unit . Once the machine has been fully set up, the operator can run the CNC program. While technical drawing is not all the time required for manufacturing numerous elements with CNC, but we highly suggest it to CNC machining incorporate as it would include certain information that isn't present within the STEP format. For higher outcomes, you need to|you should|you have to} export your designs immediately from the native CAD software program into the STEP file format. The mainstay manufacturing boosts an extensive spectrum of CNC machining capabilities, including milling, turning, forming, and punching.