- Timestamp:
- Feb 19, 2013, 8:29:38 PM (12 years ago)
- Branches:
- master, release-1.10
- Children:
- 4584d1f
- Parents:
- 69f74c2
- git-author:
- David Benjamin <davidben@mit.edu> (06/09/12 23:16:53)
- git-committer:
- David Benjamin <davidben@mit.edu> (02/19/13 20:29:38)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl.pm
r69f74c2 r3b9ca71 426 426 427 427 sub new_variable_int { 428 unshift @_, 0, "<int>", sub { "$_[0]" }, # to string429 sub { $_[0] =~ /^-?[0-9]+$/ }, # validate430 sub { 0 + $_[0] }; # from string428 unshift @_, 0, "<int>", 0, sub { "$_[0]" }, # to string 429 sub { $_[0] =~ /^-?[0-9]+$/ }, # validate 430 sub { 0 + $_[0] }; # from string 431 431 goto \&_new_variable; 432 432 } 433 433 434 434 sub new_variable_bool { 435 unshift @_, 0, "on,off", sub { $_[0] ? "on" : "off" }, # to string436 sub { $_[0] eq "on" || $_[0] eq "off" }, # validate437 sub { $_[0] eq "on" }; # from string435 unshift @_, 0, "on,off", 1, sub { $_[0] ? "on" : "off" }, # to string 436 sub { $_[0] eq "on" || $_[0] eq "off" }, # validate 437 sub { $_[0] eq "on" }; # from string 438 438 goto \&_new_variable; 439 439 } 440 440 441 441 sub new_variable_string { 442 unshift @_, "", "<string>", sub { $_[0] }, # to string443 sub { 1 }, # validate444 sub { $_[0] }; # from string442 unshift @_, "", "<string>", 0, sub { $_[0] }, # to string 443 sub { 1 }, # validate 444 sub { $_[0] }; # from string 445 445 goto \&_new_variable; 446 446 } … … 449 449 my $default_default = shift; 450 450 my $validsettings = shift; 451 my $takes_on_off = shift; 451 452 my $tostring_fn = shift; 452 453 my $validate_fn = shift; … … 473 474 474 475 BarnOwl::Internal::new_variable($name, $args{summary}, $args{description}, $validsettings, 475 $ get_tostring_fn, $set_fromstring_fn, undef);476 $takes_on_off, $get_tostring_fn, $set_fromstring_fn, undef); 476 477 } 477 478
Note: See TracChangeset
for help on using the changeset viewer.