Ignore:
Timestamp:
Jul 17, 2009, 11:52:30 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
96f7b07
Parents:
b4ef908
git-author:
Nelson Elhage <nelhage@mit.edu> (07/17/09 23:31:14)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/17/09 23:52:30)
Message:
Push commands into BarnOwl:: instead of AUTOLOAD'ing them
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl.pm

    r22b54a7 reb6cedc  
    167167    $m->legacy_populate_global();
    168168    return &BarnOwl::Hooks::_receive_msg($m);
    169 }
    170 
    171 =head2 AUTOLOAD
    172 
    173 BarnOwl.pm has a C<AUTOLOAD> method that translates unused names in
    174 the BarnOwl:: namespace to a call to BarnOwl::command() with that
    175 command. Underscores are also translated to C<->s, so you can do
    176 e.g. C<BarnOwl::start_command()> and it will be translated into
    177 C<start-command>.
    178 
    179 So, if you're looking for functionality that you can't find in the
    180 perl interface, check C<:show commands> or C<commands.c> in the
    181 BarnOwl source tree -- there's a good chance it exists as a BarnOwl
    182 command.
    183 
    184 =head3 BUGS
    185 
    186 There are horrible quoting issues here. The AUTOLOAD simple joins your
    187 commands with spaces and passes them unmodified to C<::command>
    188 
    189 =cut
    190 
    191 # make BarnOwl::<command>("foo") be aliases to BarnOwl::command("<command> foo");
    192 sub AUTOLOAD {
    193     our $AUTOLOAD;
    194     my $called = $AUTOLOAD;
    195     $called =~ s/.*:://;
    196     $called =~ s/_/-/g;
    197     return &BarnOwl::command("$called ".join(" ",@_));
    198169}
    199170
Note: See TracChangeset for help on using the changeset viewer.