So, I got this module:
package Slic3r::GUI::ColorScheme;
use strict;
use warnings;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(@SELECTED_COLOR @b);
our (@SELECTED_COLOR);
our @COLOR_MAGENTA = [0.82745,0.21176,0.50980]; # This is an array, ye
+s?!
our $COLORMAGENTA = [0.82745,0.21176,0.50980]; # only for testing
sub getMODColorScheme {
print "-----> getColorScheme from MODULE\n";
print "from dollar: @{ $COLORMAGENTA } \n"; # 0.82745 0.21176 0.5
+098
print "from at : @COLOR_MAGENTA \n"; # ARRAY(0x59d88f8) ->
+ this needs to be 0.82745 0.21176 0.5098
if ($Slic3r::GUI::Settings->{_}{colorschema_solarized}) {
print "Using S O L A R I Z E from Slic3r::GUI::ColorScheme\n"
+;
@SELECTED_COLOR = @COLOR_MAGENTA;
} else {
@SELECTED_COLOR = [0,1,0];
}
}
1;
And in another file, I need to get STRING of @SELECTED_COLOR.
So I've done this so far:
# 3dscene.pm
use Slic3r::GUI::ColorScheme;
sub new {
my ($class, $parent) = @_;
Slic3r::GUI::ColorScheme::getMODColorScheme();
glColor4f( @SELECTED_COLOR , $volume->color->[3]); # this should b
+e like: glColor4f(0.82745,0.21176,0.50980, 1);
# glColor4f(@{ @SELECTED_COLOR }, $volume->color->[3]); # this doe
+s not work at all!
# ERROR from line above: Can't use string ("1") as an ARRAY ref wh
+ile "strict refs" in use
}
Somehow I get
ARRAY(0x59d88f8) back from
@SELECTED_COLOR. If I use
$COLORMAGENTA in 3dscene.pm (as this:
glColor4f(@{ $COLORMAGENTA }, $volume->color->[3]);), then I get the expected output (0.82745 0.21176 0.5098).
How can I get 0.82745 0.21176 0.5098 from
@SELECTED_COLOR?
Any help is appreciated. Thanks.
This is my first PERL question/experience ever; please be gentle.