[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] Method returning non-scalar
From:       Ashley Winters <jahqueel () yahoo ! com>
Date:       2004-11-22 20:32:44
Message-ID: 20041122203244.49386.qmail () web50910 ! mail ! yahoo ! com
[Download RAW message or body]

--- Ole Christensen <Ole.Christensen@web.de> wrote:
> Is this the way it is meant to be?

Umm... it's certainly not a _good_ thing. PerlQt does some voodoo with
method calls which seems to be flattening your array. Sorry about that.
I'd rather it get fixed than documented, but I'm in no position to do
either... :(

Ashley Winters
 

> -->8-- snip --
> use strict;
> use warnings;
> 
> package Test;
> use Qt;
> use Qt::isa qw (Qt::Object);
> 
> sub a
> {
>    my @a = ( "Hi", "there" );
>    return @a;
> }
> 
> 1;
> 
> package main;
> use Test;
> 
> my $x = Test ();
> my @a = $x -> a ();
> 
> printf "size=%d\n", scalar (@a);
> printf "contents=<%s>\n", $a [0];
> -->8-- snip --
> 
> The output of the above script is:
> 
> size=1
> contents=<2>
> 
> Seems as if the return statement of sub a is forced into scalar
> context 
> somehow. If this is the intended behavior of PerlQt, it should be 
> documented somewhere (in bold capitals ;-) - I could not find
> anything 
> on this. Returning a hash does not work as expected neither. I am
> using 
> version 3.008 with perl v5.8.2.
> 
> Cheers, Ole.
> _______________________________________________
> Kde-perl mailing list
> Kde-perl@kde.org
> https://mail.kde.org/mailman/listinfo/kde-perl
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Kde-perl mailing list
Kde-perl@kde.org
https://mail.kde.org/mailman/listinfo/kde-perl
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic