arkturuz has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone! Consider this small example:
#!/usr/bin/perl -w use strict; use Cairo; use SWF ':ALL'; use SWF::Constants ':Button'; my $surface = Cairo::ImageSurface->create('argb32', 10, 10); my $context = Cairo::Context->create($surface);
It throws an error:
Cannot convert scalar 0x8130af4 to an object of type Cairo::Surface at + cairo_vs_swf.pl line 10.
But if we remove the line use SWF::Constants ':Button'; everything is OK.

Now, the situation is this: I use both modules in my program, and those constants are necessary in my code. I suppose I could get rid of Cairo, because I have just one subroutine depending on it.
But trying to resolve the error I browsed through the source code of both modules, but as I am not at all fluent in XS (both libraries are written in C) I cannot win over this beast. So if anyone can clarify the matter, I would appreciate it.
Cairo version is 1.01 and ming is 0.3.0.

It's getting late (9PM) so I won't answer for a few hours, and I'm already working 11 hours on this program.

Replies are listed 'Best First'.
Re: Cairo vs ming SWF
by Anonymous Monk on Jan 25, 2007 at 04:50 UTC
    Now, the situation is this: I use both modules in my program, and those constants are necessary in my code
    Try
    use SWF::Constants(); ... SWF::Constants::SWFBUTTON_MOUSEUP()
    in place of SWFBUTTON_MOUSEUP.
      That solved the error. Thanks!