Changeset 7803326 for perl/lib/BarnOwl.pm
- Timestamp:
- Sep 30, 2011, 8:07:53 AM (13 years ago)
- Branches:
- master, release-1.10, release-1.9
- Children:
- 0c71c58, 5f784ec, 923c3f6, a962f5c, d953ede
- Parents:
- e89ec48
- git-author:
- Jason Gross <jgross@mit.edu> (06/23/11 23:58:21)
- git-committer:
- Jason Gross <jgross@mit.edu> (09/30/11 08:07:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl.pm
re89ec48 r7803326 150 150 151 151 A Perl subroutine that is called when the user closes the edit_win. 152 C<CALLBACK> gets called with two parameters: the text the user entered, 153 and a C<SUCCESS> boolean parameter which is false if the user canceled 154 the edit_win and true otherwise. 152 155 153 156 =back … … 159 162 =head2 start_edit_win PROMPT CALLBACK 160 163 161 Equivalent to C<start_edit> called with the appropriate parameters. 164 Roughly equivalent to C<start_edit> called with the appropriate parameters. 165 C<CALLBACK> is only called on success, for compatibility. 166 167 These are deprecated wrappers around L<BarnOwl::start_edit>, and should not 168 be uesd in new code. 162 169 163 170 =cut … … 170 177 sub start_question { 171 178 my ($prompt, $callback) = @_; 172 BarnOwl::start_edit(type => 'question', prompt => $prompt, callback => $callback); 179 BarnOwl::start_edit(type => 'question', prompt => $prompt, callback => sub { 180 my ($text, $success) = @_; 181 $callback->($text) if $success; 182 }); 173 183 } 174 184 175 185 sub start_password { 176 186 my ($prompt, $callback) = @_; 177 BarnOwl::start_edit(type => 'password', prompt => $prompt, callback => $callback); 187 BarnOwl::start_edit(type => 'password', prompt => $prompt, callback => sub { 188 my ($text, $success) = @_; 189 $callback->($text) if $success; 190 }); 178 191 } 179 192 180 193 sub start_edit_win { 181 194 my ($prompt, $callback) = @_; 182 BarnOwl::start_edit(type => 'edit_win', prompt => $prompt, callback => $callback); 195 BarnOwl::start_edit(type => 'edit_win', prompt => $prompt, callback => sub { 196 my ($text, $success) = @_; 197 $callback->($text) if $success; 198 }); 183 199 } 184 200
Note: See TracChangeset
for help on using the changeset viewer.