Changeset cce9369 for perl


Ignore:
Timestamp:
Sep 30, 2011, 8:14:50 AM (13 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
e21b921
Parents:
b54b06a
git-author:
Jason Gross <jgross@mit.edu> (07/12/11 19:20:46)
git-committer:
Jason Gross <jgross@mit.edu> (09/30/11 08:14:50)
Message:
Allowed custom validsettings for other non-boolean perl variables.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl.pm

    rb54b06a rcce9369  
    413413=item valid_settings
    414414
    415 A listref of valid setttings for the enum variable.
    416 The settings must not contain any commas.
     415A listref of valid setttings for the enum variable, or a string describing
     416the valid settings for any other type of variable.  The settings for an enum
     417variable may not contain any commas.  You should not specify valid settings
     418for boolean variables.
    417419
    418420=back
     
    421423
    422424sub new_variable_int {
    423     unshift @_, \&BarnOwl::Internal::new_variable_int, 0;
    424     goto \&_new_variable;
     425    _new_variable(\&BarnOwl::Internal::new_variable_int, 0, "<int>", @_);
    425426}
    426427
    427428sub new_variable_bool {
    428     unshift @_, \&BarnOwl::Internal::new_variable_bool, 0;
    429     goto \&_new_variable;
     429    _new_variable(\&BarnOwl::Internal::new_variable_bool, 0, "on,off", @_);
    430430}
    431431
    432432sub new_variable_string {
    433     unshift @_, \&BarnOwl::Internal::new_variable_string, "";
    434     goto \&_new_variable;
     433    _new_variable(\&BarnOwl::Internal::new_variable_string, "", "<string>", @_);
    435434}
    436435
     
    457456    my $func = shift;
    458457    my $default_default = shift;
     458    my $default_valid_settings = shift;
    459459    my $name = shift;
    460460    my $args = shift || {};
    461461    my %args = (
    462         summary     => "",
    463         description => "",
    464         default     => $default_default,
     462        summary        => "",
     463        description    => "",
     464        default        => $default_default,
     465        valid_settings => $default_valid_settings,
    465466        %{$args});
    466     $func->($name, $args{default}, $args{summary}, $args{description});
     467    $func->($name, $args{default}, $args{summary}, $args{description}, $args{valid_settings});
    467468}
    468469
Note: See TracChangeset for help on using the changeset viewer.