Changeset a695a68 for perlwrap.pm


Ignore:
Timestamp:
May 18, 2007, 4:54:51 PM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
cd57601
Parents:
ec53338
git-author:
Nelson Elhage <nelhage@mit.edu> (05/18/07 16:54:42)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/18/07 16:54:51)
Message:
Adding the ability to define new variables from perl.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlwrap.pm

    rf6b319c ra695a68  
    7878    no warnings 'uninitialized';
    7979    BarnOwl::new_command_internal($name, $func, $args{summary}, $args{usage}, $args{description});
     80}
     81
     82sub new_variable_int {
     83    unshift @_, \&BarnOwl::new_variable_int_internal, 0;
     84    goto \&_new_variable;
     85}
     86
     87sub new_variable_bool {
     88    unshift @_, \&BarnOwl::new_variable_bool_internal, 0;
     89    goto \&_new_variable;
     90}
     91
     92sub new_variable_string {
     93    unshift @_, \&BarnOwl::new_variable_string_internal, "";
     94    goto \&_new_variable;
     95}
     96
     97sub _new_variable {
     98    my $func = shift;
     99    my $default_default = shift;
     100    my $name = shift;
     101    my $args = shift || {};
     102    my %args = (
     103        summary     => "",
     104        description => "",
     105        default     => $default_default,
     106        %{$args});
     107    $func->($name, $args{default}, $args{summary}, $args{description});
    80108}
    81109
Note: See TracChangeset for help on using the changeset viewer.