Games::Nintendo::Mario - a class for jumping Italian plumbers


version 0.209


  use Games::Nintendo::Mario;

  my $hero = Games::Nintendo::Mario->new(name => 'Luigi');

  $hero->damage; # cue the Mario Death Music


This module provides a base class for representing the Mario Brothers from Nintendo's long-running Mario franchise of games. Each Mario object keeps track of the plumber's current state and can be damaged or given powerups to change his state.


This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.)

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.



  my $hero = Games::Nintendo::Mario->new(name => 'Luigi');

The constructor for Mario objects takes two named parameters, name and state. name must be either "Mario" or "Luigi" and state must be "normal"

If left undefined, name and state will default to "Mario" and "normal" respectively.


  $hero->powerup('hammer'); # this won't work

As the base Games::Nintendo::Mario class represents Mario from the original Mario Bros., there is no valid way to call this method. Subclasses representing Mario in other games may allow various powerup names to be passed.



This method causes the object to react as if Mario has been attacked or damaged. In the base Games::Nintendo::Mario class, this will always result in his death.


  print $hero->state;

This method accesses the name of Mario's current state.


  print $hero->name;

This method returns the name of the plumber's current form. (In the base class, this is always the same as the name passed to the constructor.)


  if (grep /World/, $hero->games) { ... }

This returns a list of the games in which Mario behaved according to the model provided by this class.


Wario, SMW.


Ricardo SIGNES <>


This software is copyright (c) 2003 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.