Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Carp::Scooby

by jimt (Chaplain)
on May 10, 2002 at 19:44 UTC ( #165757=snippet: print w/ replies, xml ) Need Help??

Description: Well, the movie is coming up soon, right? We might as well have a little fun with it....
package Carp::Scooby;

use Carp;
use Exporter;
@ISA = qw(Carp);
@EXPORT = qw(ruhroh zoiks jinkies);

sub ruhroh {goto &croak};
sub zoiks {goto &carp};
sub jinkies {goto &confess};

1;
Comment on Carp::Scooby
Download Code
Re: Carp::Scooby
by japhy (Canon) on May 10, 2002 at 19:58 UTC
    I'd use aliases instead of goto()s.
    package Carp::Scooby; require Carp; require Exporter; @EXPORT = qw( ruhroh zoiks jinkies ); *ruhroh = \&Carp::croak; *zoiks = \&Carp::carp; *jinkies = \&Carp::confess; 1;

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: Carp::Scooby
by stephen (Priest) on May 10, 2002 at 20:07 UTC
    If you're feeling REALLY bizarre, you could indulge in a little argument-munging...
    sub ruhroh { @_ = map { my @words = split(/\s/); foreach my $word (@words) { $word =~ s/^([aeiou])/r$1/ and next; $word =~ s/^([AEIOU])/'R' . lc($1)/e and next; $word =~ s/^[a-z][^aeiou]?/r/ and next; $word =~ s/^[A-Z][^aeiou]?/R/; } join(' ', @words); } @_; push @_, ', Raggy!'; goto &croak; }
    Then, if you say
    ruhroh("And I'd have gotten away with it, too, if it weren't for you m +eddling kids");
    You'll get
    Rand Ri'd rave rotten raway rith rit, roo, rif rit reren't ror rou red +dling rids, Raggy! at test_ruhroh.pl line 5

    stephen

    Update: A little testing made me change my scheme entirely...

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://165757]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-19 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls