{"issue":{"state":"open","created_at":"2011-12-12T15:31:04Z","updated_at":"2011-12-12T15:31:04Z","comments":0,"user":{"gravatar_id":"46f22327a42a27ff719fd470ad65a13b","id":90618,"url":"https://api.github.com/users/imoan","avatar_url":"https://secure.gravatar.com/avatar/46f22327a42a27ff719fd470ad65a13b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"imoan"},"body":"It seems I can't access the 'original' method from within a mocked method.\r\n\r\nAn example of what I would like:\r\n\r\n```\r\nuse Mock::Quick;\r\n\r\nmy $controller  = Mock::Quick::Class->takeover('DBIx::Class::ResultSet');\r\n$controller->override( new => sub {\r\n\tmy $class = shift;\r\n\t……\r\n\t$class->ORIGINAL::new # call the original DBIx::Class::ResultSet::new method\r\n});\r\n```\r\nIf I've read the code correctly the original method is stashed on the control object. It seems the only way to gain access to it is via a dirty closure(*1). \r\n\r\n     use Mock::Quick;\r\n\r\n     my $controller  = Mock::Quick::Class->takeover('DBIx::Class::ResultSet');\r\n     $controller->override( new => sub {} );  # Just so that the original method is stashed on object\r\n\r\n     # override method again as now 'original' method is now in scope. \r\n     # Thank goodness there's  protection for this in the code!\r\n     $controller->override( new => sub {my $class = shift; ....... $controller->{'new'}(@_) } );\r\n\r\n\r\n\r\n(*1) closures aren't dirty but that one was :)\r\n\r\n\r\n","assignee":null,"number":9,"id":2524128,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"title":"Accessing original method in override","html_url":"https://github.com/exodist/Mock-Quick/issues/9","closed_at":null,"url":"https://api.github.com/repos/exodist/Mock-Quick/issues/9","milestone":null},"action":"opened"}