RE: Prima::tutorial Prima::Utils::find_image example not working on XP and ActivePerl

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Thu, 10 Apr 2008 21:52:40 -0700
To: <prima_at_BSD-Dk.dk>

Dmitry Karasik wrote:
> find_image() is needed when the explicit path to the file is not
> known, if the file in question comes with your module distribution
> and is installed somewhere deeply in perl tree. If you already have
> the path, call load($f) directly.
> find_image() won't work with full path; note that in the example
> the path is also not fully qualified.

Thank you for replying. :-)

Looking at the Prima-1.23 folder, I now see examples\Hand.gif. Cutting
and pasting from the tutorial without modification (other than shebang
line, -w, and strict) and attempting to run the script produces the same
error message and fallback menu item (see console session below).

Using load() directly works! :-) (see console session below).

David

E:\data\unzipped\Prima-1.23-MSWin32-588\Prima-1.23>type "C:\Documents
and Settings\dpchrist\My Documents\prima\hello6.pl"
#! /usr/bin/perl -w
use strict;
use Prima qw(Application MsgBox);
use Prima::Utils qw(find_image);
my $i = Prima::Image-> load( find_image( 'examples/Hand.gif'));
$i ||= 'No image found or can be loaded';
my $window = Prima::MainWindow-> new(
    text => 'Hello world!',
    menuItems => [
        [ '~File' => [
        [ $i, sub {} ],
        ]],
    ],
);
run Prima;

E:\data\unzipped\Prima-1.23-MSWin32-588\Prima-1.23>perl "C:\Documents
and Settings\dpchrist\My Documents\prima\hello6.pl"
Use of uninitialized value in subroutine entry at C:\Documents and
Settings\dpchrist\My Documents\prima\hello6.pl line 5.

C:\Documents and Settings\dpchrist\My Documents\prima>type hello6b.pl
#! /usr/bin/perl -w
use strict;
use Prima qw(Application MsgBox);
use Prima::Utils qw(find_image);
my $f = 'C:\Perl\html\images\activeperl_logo.gif';
warn "cannot read file '$f'" unless -r $f;
my $i = Prima::Image->load($f);
$i ||= 'No image found or can be loaded';
my $window = Prima::MainWindow-> new(
    text => 'Hello world!',
    menuItems => [
        [ '~File' => [
            [ $i, sub {} ],
        ]],
    ],
);
run Prima;

C:\Documents and Settings\dpchrist\My Documents\prima>perl hello6b.pl
Received on Fri 11 Apr 2008 - 06:52:41 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET