Changeset 167044b for perlwrap.pm


Ignore:
Timestamp:
Aug 20, 2008, 2:16:43 AM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
aef51f8
Parents:
5987370
Message:
Support string hook entries.
perlwrap.pm: Support calling and adding string hook entries in BarnOwl::Hook
IRC.pm: Switch our hooks to use string entries
Jabber.pm: Switch our hooks to use string entries
ModuleLoader.pm: No longer clear all hooks on reload

This should have the net effect that we can safely reload single
modules.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlwrap.pm

    r0f9eca7 r167044b  
    603603    my $self = shift;
    604604    my @args = @_;
    605     return map {$_->(@args)} @$self;
     605    return map {$self->_run($_,@args)} @$self;
     606}
     607
     608sub _run {
     609    my $self = shift;
     610    my $fn = shift;
     611    my @args = @_;
     612    no strict 'refs';
     613    return $fn->(@args);
    606614}
    607615
     
    615623    my $self = shift;
    616624    my $func = shift;
    617     die("Not a coderef!") unless ref($func) eq 'CODE';
     625    die("Not a coderef!") unless ref($func) eq 'CODE' || !ref($func);
     626    return if grep {$_ eq $func} @$self;
    618627    push @$self, $func;
    619628}
Note: See TracChangeset for help on using the changeset viewer.