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

Fellow Monks:

I'm attempting to use the Chart::Plot::Annotated module to implement a graph with annotated data points. Obviously if all was going well I wouldn't be asking for your help!!

I can't get the darn thing to run!! The module as it sits on CPAN errors out with the following when trying to use it:
Bareword "Chart::Plot::Annotated::_DataPt" not allowed while "strict s +ubs" in use at Annotated.pm line 14. BEGIN not safe after errors--compilation aborted at Annotated.pm line +131.

And I believe it has something to do with the implementation of the following code:
package Chart::Plot::Annotated; use 5.006; use strict; use warnings; use Carp; our $VERSION = '0.01'; ################################################################## # define this class: use base 'Chart::Plot'; use Class::MethodMaker # the extra data well put into the Chart::Plot object object_list => [ Chart::Plot::Annotated::_DataPt => '_AnnoData' ], # formatting internals get_set => [ qw [ _anno_xOffset _anno_yOffset _anno_font _anno_color + ] ], # error-reporting get_set => [ '_problem' ];

I've attempted to repair the module. I encapsulated the problematic "bareword" in single quotes which allowed it to run cleanly at first, but upon attempting to instantiate a new object using it it returns the following error: Can't locate object method "new" via package "Chart::Plot::Annotated::_DataPt" (perhaps you forgot to load "Chart::Plot::Annotated::_DataPt"?) at /usr/local/lib/perl5/site_perl/5.8.6/Chart/Plot/Annotated.pm line 48.
I've attempted a few other things to try to fix it but to no avail. I don't have the necessary knowledge of this level of OO programming and subclasses to understand is wrong!!!

Can someone please help??

Replies are listed 'Best First'.
Re: Chart::Plot::Annotated Problem
by gam3 (Curate) on Apr 02, 2005 at 15:32 UTC
    I applied the following patch and could then generate a graph.
    --- ./Annotated.pm 2002-08-16 17:55:31.000000000 -0400 +++ ./blib/lib/Chart/Plot/Annotated.pm 2005-04-02 10:30:00.000000000 +-0500 @@ -11,7 +11,7 @@ use base 'Chart::Plot'; use Class::MethodMaker # the extra data we'll put into the Chart::Plot object - object_list => [ Chart::Plot::Annotated::_DataPt => '_AnnoData' ], + object_list => [ 'Chart::Plot::Annotated::_DataPt' => '_AnnoData' ] +, # formatting internals get_set => [ qw [ _anno_xOffset _anno_yOffset _anno_font _anno_colo +r ] ], @@ -20,7 +20,7 @@ get_set => [ '_problem' ]; ################################################################## # define an auxiliary class: -use Class::Struct Chart::Plot::Annotated::_DataPt => +use Class::Struct 'Chart::Plot::Annotated::_DataPt' => [ X => '$', Y => '$', anno => '$' ]; ################################################################## # new public method:
    -- gam3
    A picture is worth a thousand words, but takes 200K.
      Thanks so much!! That fixed it.
Re: Chart::Plot::Annotated Problem
by tlm (Prior) on Apr 02, 2005 at 07:10 UTC

    Why does the error refer to Chart::Plot::_DataPt? It should be Chart::Plot::Annotated::_DataPt. Did you edit that part of the code? That may be the problem.

    the lowliest monk