in reply to Re^2: Using Perl to create XML
in thread Using Perl to create XML
What is the problem ?
Allow me to introduce you to splain, a command-line interface to perldiag.
C:\>splain C:\Perl\bin/splain.bat: Reading from STDIN Attempt to bless into a reference Attempt to bless into a reference (#1) (F) The CLASSNAME argument to the bless() operator is expected to +be the name of the package to bless the resulting object into. You've supplied instead a reference to something: perhaps you wrote bless $self, $proto; when you intended bless $self, ref($proto) || $proto; If you actually want to bless into the stringified version of the reference supplied, you need to stringify it yourself, for example by: bless $self, "$proto";
So it turns out there is actually a bug in the OOXML.pm file.
In subs new, tag, and text, he calls $self->new(...)
which is precisely the trigger for the diagnostic above.
Probably the easiest way to fix this is just to change
return bless $self, $class;
into
return bless $self;
That's not robust if OOXML is going to be subclassed, however. In that case,
I'd recommend the following simple change instead:
In sub new, immediately after the my( $class, ... line, insert the following line:
$class = ref($class) if ref($class);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Using Perl to create XML
by theophanie77 (Novice) on Apr 20, 2011 at 15:56 UTC |