lichtkind / Chart

a series of charting modules
https://metacpan.org/pod/Chart
5 stars 4 forks source link

Fix typos in Chart::Color::Scheme #3

Closed ppisar closed 2 years ago

ppisar commented 2 years ago

lib/Chart/Color/Scheme.pm contained:

use use Chart::Color::Named;
[...]
sub name_taken { exists  %set{$_[0]} }

That prevented from compiling that code:

$ perl -Ilib -c lib/Chart/Color/Scheme.pm
Bareword "Chart::Color::Named" not allowed while "strict subs" in use at lib/Chart/Color/Scheme.pm line 8.
Global symbol "%set" requires explicit package name (did you forget to declare "my %set"?) at lib/Chart/Color/Scheme.pm line 77.
Global symbol "%set" requires explicit package name (did you forget to declare "my %set"?) at lib/Chart/Color/Scheme.pm line 78.
exists argument is not a HASH or ARRAY element or a subroutine at lib/Chart/Color/Scheme.pm line 78.

I guess it's a typo and the author did not mean using a "use" module https://metacpan.org/pod/use. Regarding %set, I guess it should be %scheme based on a similar code in Chart::Color::Named.

Another issue is with $my_set and $val:

$ perl -Ilib -e 'use Chart::Color::Scheme'
Global symbol "$val" requires explicit package name (did you forget to declare "my $val"?) at lib/Chart/Color/Scheme.pm line 85.
Global symbol "$val" requires explicit package name (did you forget to declare "my $val"?) at lib/Chart/Color/Scheme.pm line 86.
Global symbol "$my_set" requires explicit package name (did you forget to declare "my $my_set"?) at lib/Chart/Color/Scheme.pm line 90.
Global symbol "$val" requires explicit package name (did you forget to declare "my $val"?) at lib/Chart/Color/Scheme.pm line 95.
Global symbol "$my_set" requires explicit package name (did you forget to declare "my $my_set"?) at lib/Chart/Color/Scheme.pm line 97.
Compilation failed in require at -e line 1.

This code looks unfinished. I simplified it to compile and do at least something.

lichtkind commented 2 years ago

yes your right but was fixed an hour later, i shouldnt have put too many loose ends but im still new to project and learn code base so was distracted. the module is now used by the main code base and all test run so i will not accept this patch, thank you for your effort a lot.

PS. In case you interested. I staring a rewrite that will leave most of the old code untouched for a while with some parallel functions. All the new will be called from a central API and old will be as known via Chart::$type. There will be also some separation in tests.