Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created March 4, 2013 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/5084382 to your computer and use it in GitHub Desktop.
Save tadzik/5084382 to your computer and use it in GitHub Desktop.
class Quest::EventFactory;
has @!events = <Nothing TreasureChest>;
method get-event {
my $class = "Quest::Event::{@!events.pick}";
note "Loading $class";
require $class;
note ::($class).perl;
my $ret = ::($class).new;
note "returning {$ret.perl}";
$ret;
}
... later ...
Loading Quest::Event::TreasureChest
Failure.new(exception => X::NoSuchSymbol.new(symbol => "Quest::Event::TreasureChest"))
Not enough positional parameters passed; got 1 but expected 2
in method new at src/gen/CORE.setting:10494
in method get-event at lib/Quest/EventFactory.pm:10
in method step at lib/Quest/Game.pm:20
in block at bin/quest:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment