Mon Sep 26 16:56:15 2011: Request 71256 was acted upon.
Transaction: Ticket created by [email protected]
Queue: Wx
Subject: objects from tied scalars
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: [email protected]
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71256 >
In recent debian i386 wx 2.8.10.1 and wxperl 0.9901, it seems a Wx::Size
coming out of a tied scalar is not recognised. foo.pl below gives
variable is not of type Wx::Size at foo.pl line 23.
on attempting
$frame->SetSize ($magic);
Where I hoped it would run the FETCH() from the tied $magic and get
Wx::wxDefaultSize.
Often this sort of thing is from the XS not running magic (SvGETMAGIC or
whichever one of those macros is right) before looking into the sv flags
like SvOK, SvROK, etc.
A contrivance like foo.pl can come from "lazy scalars" deferring a value
until needed, or this came up in one spot of perl-gtk lately on objects
held in a Tie::IxHash (or was it a Tie::RefHash?) which end up magic to
support the special features of that tie.
use strict;
use Wx;
my $app = Wx::SimpleApp->new;
{
package MyTiedSize;
sub TIESCALAR {
my $class = shift;
return bless {@_}, $class;
}
sub FETCH {
print "MyTiedSize FETCH runs\n";
return Wx::wxDefaultSize();
}
}
my $magic;
tie $magic, 'MyTiedSize';
# print $magic,"\n";
my $frame = Wx::Frame->new (undef, -1, "Hello");
$frame->SetSize ($magic);
$frame->Show;
$app->MainLoop;