/usr/share/perl5/UI/Dialog/Backend.pod is in libui-dialog-perl 1.08-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | =head1 NAME
UI::Dialog::Backend
=head1 SYNOPSIS
use UI::Dialog::Backend;
BEGIN {
use vars qw( @ISA );
@ISA = qw( UI::Dialog::Backend );
}
=head1 ABSTRACT
UI::Dialog::Backend is simply a collection of primarily internal methods.
=head1 DESCRIPTION
While this module is inherited by all UI::Dialog backend modules, this module
itself is not meant for direct usage. The "STATE METHODS" and "UTILITY METHODS"
documentation is applicable to all backends thus rendering the POD for this class
more important to the end-programmer than the usage of the class itself.
=head1 EXPORT
=over 2
None
=back
=head1 INHERITS
=over 2
None
=back
=head1 BACKEND EXTENSIONS
=head2 nautilus
=over 4
=item EXAMPLE
=over 6
my @paths = $d->nautilus->paths();
=back
=item DESCRIPTION
=over 6
This method gives access to the UI::Dialog::Backend::Nautilus class. This will
automagically try to load the UI::Dialog::Backend::Nautilus module or it will
silently fail.
=back
=back
=head2 xosd
=over 4
=item EXAMPLE
=over 6
$d->xosd->line( "a line of text on your screen" );
=back
=item DESCRIPTION
=over 6
This method gives access to the UI::Dialog::Backend::XOSD class. This will
automagically try to load the UI::Dialog::Backend::XOSD module or it will
silently fail.
=back
=back
=head1 STATE METHODS
=head2 attr( )
=over 4
=item EXAMPLE
=over 6
my $value = $self->attr('listheight');
my $new_value = $d->attr('listheight',5);
=back
=item DESCRIPTION
=over 6
Either sets and returns the value of the desired attribute, or just returns
the value of the desired attribute.
=back
=item RETURNS
=over 6
a single SCALAR.
=back
=back
=head2 state( )
=over 4
=item EXAMPLE
=over 6
if ($d->state() eq "OK") {
# the last user response was "OK"
} else {
# something other than an "OK" response
}
=back
=item DESCRIPTION
=over 6
Returns the state of the last dialog widget command. The value can be one of
"OK", "CANCEL" or "ESC". The return data is based on the exit codes (return
value) of the last widget displayed. Some backends also support other exit
values than the standard few and these are represented as "EXTRA" (3), "HELP"
(2), and "ERROR" (255).
=back
=item RETURNS
=over 6
a single SCALAR.
=back
=back
=head2 ra( )
=over 4
=item EXAMPLE
=over 6
my @array = $d->ra();
=back
=item DESCRIPTION
=over 6
Returns the last widget's data as an array.
=back
=item RETURNS
=over 6
an ARRAY.
=back
=back
=head2 rs( )
=over 4
=item EXAMPLE
=over 6
my $string = $d->rs();
=back
=item DESCRIPTION
=over 6
Returns the last widget's data as a (possibly multiline) string.
=back
=item RETURNS
=over 6
a SCALAR.
=back
=back
=head2 rv( )
=over 4
=item EXAMPLE
=over 6
my $string = $d->rv();
=back
=item DESCRIPTION
=over 6
Returns the last widget's exit status, aka: return value. This is the value
used when determining the state() of a widget.
=back
=item RETURNS
=over 6
a SCALAR.
=back
=back
=head1 CALLBACK FUNCTIONS
=head2 PRE
=over 4
=item EXAMPLE
=over 6
sub CB_PRE {
my $widget_args = shift();
print "Caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { PRE => \&CB_PRE } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
before any widget performs any operations.
=back
=back
=head2 POST
=over 4
=item EXAMPLE
=over 6
sub CB_POST {
my $widget_args = shift();
my $state = shift();
print "Caller: ".$args->{'caller'}.", State: ".$state."\n";
}
my $d = new UI::Dialog ( callbacks => { POST => \&CB_POST } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and the one word
state indicator (as reported by state()) and is called after all widget
operations have been performed (including other callback functions).
=back
=back
=head2 OK
=over 4
=item EXAMPLE
=over 6
sub CB_OK_FUNC {
my $widget_args = shift();
print "Widget caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { OK => \&CB_OK_FUNC } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
when any widget finishes with a state() of "OK" but before the POST callback.
=back
=back
=head2 CANCEL
=over 4
=item EXAMPLE
=over 6
sub CB_CANCEL {
my $widget_args = shift();
print "Caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { CANCEL => \&CB_CANCEL } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
when any widget finishes with a state() of "CANCEL" but before the POST
callback. Be forewarned that with respect to the yesno() type widgets, a
user response of "NO" is interpreted as "CANCEL" and will execute this function.
=back
=back
=head2 ESC
=over 4
=item EXAMPLE
=over 6
sub CB_ESC {
my $widget_args = shift();
print "Caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { ESC => \&CB_ESC } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
when any widget finishes with a state() of "ESC" but before the POST callback.
=back
=back
=head2 HELP
=over 4
=item EXAMPLE
=over 6
sub CB_HELP {
my $widget_args = shift();
print "Caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { HELP => \&CB_HELP } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
when any widget finishes with a state() of "HELP" but before the POST callback.
The user response of "HELP" is not supported by all backends.
=back
=back
=head2 EXTRA
=over 4
=item EXAMPLE
=over 6
sub CB_EXTRA {
my $widget_args = shift();
print "Caller: ".$args->{'caller'}."\n";
}
my $d = new UI::Dialog ( callbacks => { EXTRA => \&CB_EXTRA } );
=back
=item DESCRIPTION
=over 6
This function recieves a hasref of the current argument values and is called
when any widget finishes with a state() of "EXTRA" but before the POST callback.
The user response of "EXTRA" is not supported by all backends.
=back
=back
=head1 UTILITY METHODS
=head2 beep( )
=over 4
=item EXAMPLE
=over 6
$d->beep();
=back
=item DESCRIPTION
=over 6
If the beep(1) application can be found, use it to make a beep sound.
Otherwise print "\a" to STDERR which normally is good enough to make
some noise.
=back
=item RETURNS
=over 6
TRUE (1) regardless of result.
=back
=back
=head2 clear( )
=over 4
=item EXAMPLE
=over 6
$d->clear();
=back
=item DESCRIPTION
=over 6
Clear the terminal screen via STDOUT and the `clear` command. This method is
technically useless for any GUI based dialog variants.
=back
=item RETURNS
=over 6
TRUE (1) regardless of result.
=back
=back
=head2 word_wrap( )
=over 4
=item EXAMPLE
=over 6
my @wrapped_text = $d->word_wrap($cols,$indent,$sub_indent,@text);
=back
=item DESCRIPTION
=over 6
Using the Text::Wrap::wrap function, wrap the words in a string (or array of
strings). This is primarily used within the _organize_text() method but may
be of use to the end-programmer.
=back
=item RETURNS
=over 6
A word-wrapped version of the given text data.
=back
=back
=head2 gen_tempfile_name( )
=over 4
=item EXAMPLE
=over 6
my $tempfile = $d->gen_tempfile_name();
=back
=item DESCRIPTION
=over 6
This method returns a temporary file name generated using one of the following
(in order): the File::Temp perl module if detected, the program "mktemp" or
an extremely simplistic built-in name generator.
=back
=item RETURNS
=over 6
A temporary file name.
=back
=back
=head2 gen_random_string( )
=over 4
=item EXAMPLE
=over 6
my $random_string = $d->gen_random_string(5);
=back
=item DESCRIPTION
=over 6
This will return a string of random (printable) characters of an arbitrary
user-definable length (defaults to 5);
=back
=item RETURNS
=over 6
A string of random ASCII characters.
=back
=back
=head1 WIDGET WRAPPER METHODS
These methods are common methods to most backends as they do not have native
support for the functionality, yet the functionality is achievable by utilizing
existing compatible methods.
=head2 fselect( )
=over 4
=item EXAMPLE
=over 6
my $path = $self->fselect( path => $start_path );
=back
=item DESCRIPTION
=over 6
Using the menu() and msgbox() widgets we can simulate a file browser interface.
Note: to select a directory, go into it and then pick the '.' entry.
=back
=item RETURNS
=over 6
a SCALAR for positive results and FALSE (0) for everything else.
=back
=back
=head2 dselect( )
=over 4
=item EXAMPLE
=over 6
my $path = $self->dselect( path => $start_path );
=back
=item DESCRIPTION
=over 6
Using the fselect() widget we can simulate a directory browser interface.
Note: to select a directory, go into it and then pick the '.' entry.
=back
=item RETURNS
=over 6
a SCALAR for positive results and FALSE (0) for everything else.
=back
=back
=head1 BACKEND METHODS
These methods are only necessary for someone wishing to create more
UI::Dialog::Backend:: Modules. These are never needed to be directly
used but are none the less documented here for reference purposes.
=head2 command_state( )
=over 4
=item EXAMPLE
=over 6
if ($self->command_state("/some/shell/command")) {
#: command succeeded
} else {
#: command failed
}
=back
=item DESCRIPTION
=over 6
This will execute the given command and send STDOUT and STDERR to /dev/null
then analyse the exit code and return accordingly.
=back
=item RETURNS
=over 6
TRUE (1) for positive results and FALSE (0) for anything else.
=back
=back
=head2 command_string( )
=over 4
=item EXAMPLE
=over 6
my ($rv,$scalar) = $self->command_string("/some/shell/command");
if ($rv >= 1) {
#: command failed
} else {
#: command succeeded
print "The command results: ".$scalar."\n";
}
=back
=item DESCRIPTION
=over 6
This will execute the given command, catch STDOUT and STDERR, then return
the SCALAR data.
=back
=item RETURNS
=over 6
a SCALAR for positive results and FALSE (0) for anything else.
=back
=back
=head2 command_array( )
=over 4
=item EXAMPLE
=over 6
my ($rv,@array) = $self->command_array("/some/shell/command");
if ($rv >= 1) {
#: command failed
} else {
#: command succeeded
foreach my $line_of_output (@array) {
print "The command results: ".$line_of_output."\n";
}
}
=back
=item DESCRIPTION
=over 6
This will execute the given command, catch STDOUT and STDERR, then return
the data, split by newlines, as an ARRAY.
=back
=item RETURNS
=over 6
an ARRAY for positive results and FALSE (0) for anything else.
=back
=back
=head2 _pre( )
=over 4
=item EXAMPLE
=over 6
my $args = $self->_pre(@_);
=back
=item DESCRIPTION
=over 6
This will use _merge_attrs(), perform any pre-widget-exec things and
then return the current argument list as a hashref. This is used in
every widget before anything is actually done in the widget and is
responsible for running the optional callback function labelled "PRE".
=back
=item RETURNS
=over 6
a HASHREF.
=back
=back
=head2 _post( )
=over 4
=item EXAMPLE
=over 6
$self->_post( $args );
=back
=item DESCRIPTION
=over 6
This method is used in every widget after all operations (for the immediate
widget call) are complete but before the widget actually returns anything. This
method is responsible for running the optional callback funcions labelled "OK",
"ESC", "CANCEL" and "POST" with "POST" being executed absolutely last.
=back
=item RETURNS
=over 6
Nothing.
=back
=back
=head2 _merge_attrs( )
=over 4
=item EXAMPLE
=over 6
my $args = $self->_merge_attrs(@_);
=back
=item DESCRIPTION
=over 6
This will apply the arguments passed in with the defaults stored in
$self->{'_opts'} (which was instantiated upon object construction).
The return result is the "current" options as defined by the defaults
with the argument options overriding them.
=back
=item RETURNS
=over 6
a HASHREF.
=back
=back
=head2 _find_bin( )
=over 4
=item EXAMPLE
=over 6
my $ZenityBinaryPath = $self->_find_bin('zenity');
=back
=item DESCRIPTION
=over 6
This will look in the default path directories for the program of the given
name. The default PATH list is: /bin, /usr/bin, /usr/local/bin, /opt/bin.
=back
=item RETURNS
=over 6
a SCALAR.
=back
=back
=head2 _esc_text( )
=over 4
=item EXAMPLE
=over 6
my $escaped_text = $self->_esc_text( $raw_text );
=back
=item DESCRIPTION
=over 6
This will escape the following with a prefixing '\' character:
Character -> Escaped
" \"
` \`
( \(
) \)
[ \[
] \]
{ \}
} \}
$ \$
< \<
> \>
=back
=item RETURNS
=over 6
an SCALAR for positive results and FALSE (0) for anything else.
=back
=back
=head2 _strip_text( )
=over 4
=item EXAMPLE
=over 6
my $clean_text = $self->_strip_text( $text_with_markup );
=back
=item DESCRIPTION
=over 6
This will strip various markup sequences from within the given argument data.
=back
=item RETURNS
=over 6
an SCALAR for positive results and FALSE (0) for anything else.
=back
=back
=head2 _organize_text( )
=over 4
=item EXAMPLE
=over 6
my $final_text1 = $self->_organize_text( $text_with_markup );
my $final_text2 = $self->_organize_text( \@text_with_markup );
=back
=item DESCRIPTION
=over 6
This will strip various markup sequences from within the given argument data.
=back
=item RETURNS
=over 6
a SCALAR for positive results and FALSE (0) for anything else.
=back
=back
=head2 _is_bsd( )
=over 4
=item EXAMPLE
=over 6
if ($self->_is_bsd()) {
# do something with BSD specific characteristics
} else {
# do something with general perl characteristics
}
=back
=item DESCRIPTION
=over 6
This simply checks (case-insensitively) the perlvar $^0 for the string "bsd".
=back
=item RETURNS
=over 6
TRUE (1) for positive results and FALSE (0) for anything else.
=back
=back
=head2 _list_dir( )
=over 4
=item EXAMPLE
=over 6
my $menu_list = $self->_list_dir( '/some/path/to/a/directory',
[ 'optional', 'prefix', 'items' ] );
=back
=item DESCRIPTION
=over 6
Gather a list of the contents of a directory and forumlate a list suitable for
use with most (if not all) file/path selection dialog variant widgets. An
optional array reference will have all elements prefixing the directory list.
=back
=item RETURNS
=over 6
an ARRAYREF for positive results and FALSE (0) for anything else.
=back
=back
=head2 _debug( )
=over 4
=item EXAMPLE
=over 6
$self->_debug( $debuging_message_string, $debuging_level );
=back
=item DESCRIPTION
=over 6
This method will print to STDERR the debugging message provided if and only
if the debuging level is greater than or equal to the $debuging_level. The
debugging level argument is optional and defaults to a level of 1.
=back
=item RETURNS
=over 6
TRUE (1) for positive results and FALSE (0) for anything else.
=back
=back
=head2 _error( )
=over 4
=item EXAMPLE
=over 6
$self->_error( $error_message_string );
=back
=item DESCRIPTION
=over 6
This method will print to STDERR the error message provided regardless of
debugging level.
=back
=item RETURNS
=over 6
TRUE (1) for positive results and FALSE (0) for anything else.
=back
=back
=head1 SEE ALSO
=over 2
=item PERLDOC
UI::Dialog
UI::Dialog::Console
UI::Dialog::GNOME
UI::Dialog::KDE
UI::Dialog::Backend::ASCII
UI::Dialog::Backend::CDialog
UI::Dialog::Backend::GDialog
UI::Dialog::Backend::KDialog
UI::Dialog::Backend::Nautilus
UI::Dialog::Backend::Whiptail
UI::Dialog::Backend::XDialog
UI::Dialog::Backend::XOSD
UI::Dialog::Backend::Zenity
=back
=over 2
=item MAN FILES
dialog(1), whiptail(1), zenity(1), gdialog(1), Xdialog(1),
kdialog(1), nautilus(1) and osd_cat(1).
=back
=head1 BUGS
Please email the author with any bug reports. Include the name of the
module in the subject line.
=head1 AUTHOR
Kevin C. Krinke, E<lt>kckrinke@opendoorsoftware.comE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2003 Kevin C. Krinke <kckrinke@opendoorsoftware.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=cut
|