Changeset 6922edd for perlwrap.pm


Ignore:
Timestamp:
Oct 26, 2006, 11:14:41 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4c46dfd
Parents:
bc220b2
Message:
Adding the ability to install real commands from perl.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlwrap.pm

    r216c734 r6922edd  
    3030    $called =~ s/.*:://;
    3131    return &owl::command("$called ".join(" ",@_));
     32}
     33
     34=head2 new_command NAME FUNC [{ARGS}]
     35
     36Add a new owl command. When owl executes the command NAME, FUNC will
     37be called with the arguments passed to the command, with NAME as the
     38first argument.
     39
     40ARGS should be a hashref containing any or all of C<summary>,
     41C<usage>, or C<description> keys.
     42
     43=cut
     44
     45sub new_command {
     46    my $name = shift;
     47    my $func = shift;
     48    my $args = shift || {};
     49    my %args = (
     50        summary     => undef,
     51        usage       => undef,
     52        description => undef,
     53        %{$args}
     54    );
     55
     56    owl::new_command_internal($name, $func, $args{summary}, $args{usage}, $args{description});
    3257}
    3358
Note: See TracChangeset for help on using the changeset viewer.