Subject: | imagepath and topimagepath accept only filenames |
The imagepath and topimagepath parameters to a Tk::Wizard object are
documented to accept a path to an image file, or:
"A reference to a Base64-encoded image to pass in the -data field of the
Tk::Photo object."
Attempting to use the latter yields:
"Can't find file at -imagepath: SCALAR(0x343e138)"
The following patch adds a simple check to avoid the "-e" check
producing that error message.
===================================================================
===================================================================
--- Wizard.pm (revision 2.149)
+++ Wizard.pm (working copy)
@@ -564,10 +564,18 @@
-fontfamily => [ 'PASSIVE', undef, undef,
$self->_font_family ],
);
- if ( exists $args->{-imagepath} and not -e $args->{-imagepath} ) {
+ if (
+ exists $args->{-imagepath} and
+ not ref($args->{-imagepath}) eq 'SCALAR' and
+ not -e $args->{-imagepath}
+ ) {
Carp::confess "Can't find file at -imagepath: " .
$args->{-imagepath};
}
- if ( exists $args->{-topimagepath} and not -e
$args->{-topimagepath} ) {
+ if (
+ exists $args->{-topimagepath} and
+ not ref($args->{-topimagepath}) eq 'SCALAR' and
+ not -e $args->{-topimagepath}
+ ) {
Carp::confess "Can't find file at -topimagepath: " .
$args->{-topimagepath};
}
$self->{-imagepath} = $args->{-imagepath};
===================================================================