Luke Palmer <[EMAIL PROTECTED]> writes:

> On Tue, 30 Apr 2002, Miko O'Sullivan wrote:
>
>> > Damian, now having terrible visions of someone suggesting C<elswhen> ;-)
>> 
>> Then may I also give you nightmares on: elsdo, elsdont, elsgrep, elstry ...
>
> Ooh! Why don't we have a dont command!  With several variants:
>       dont FILE
>       dont BLOCK
>
> dont { print "Boo" }

Hmm... what sort of semantics do you suggest? Just noop the following
block?

    sub don't (&) { return }

I really should get 'round to releasing the semi mythical
Acme's::Abbreviations module. Here's a taster. I really hope that it
won't be possible to perpetrate this sort of thing in Perl 6:

package Acme's::Abbreviations;

@ISA = 'Bloody Silly Thing To Do';
our $VERSION = '0.01';

sub can't {
        my $target = shift;
        if (UNIVERSAL::isa($target, 'UNIVERSAL')) {
                return ! $target->can(@_);
        } else {
                return ! UNIVERSAL::can($target, @_);
        }
}

*doesn't = \&can't;

sub isn't {
        my $target = shift;
        if (UNIVERSAL::isa($target, 'UNIVERSAL')) {
                return ! $target->isa(@_);
        } else {
                return ! UNIVERSAL::isa($target, @_);
        }
}

sub won't {
        my $target = shift;
    my $method = shift;
    eval { $target->can't($method) &&
           $target->can't('AUTOLOAD') };
}

sub mightn't {
    my $target = shift;
    my $method = shift;
        eval { $target->can't($method) &&
                   $target->can('AUTOLOAD') };
}

sub mustn't {
    my $target = shift;
    my $method = shift;
    
    no strict 'refs';
    my $old_glob = \ $ {"${target}::"}{$method};
    delete $ {"${target}::"}{$method};
    *{"$target\::$method"} = *{$old_glob}{$_} for (qw/ SCALAR HASH ARRAY IO /);
    1;
}


# Preloaded methods go here.

1;

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to