in reply to Re: Writing output to a scalar with XML::Writer
in thread Writing output to a scalar with XML::Writer

Holli, that doesnt work. Still get the following error message
Can't call method "print" on unblessed reference at /usr/opt/perl/5.8. +5/lib/XML/Writer.pm line 116. at /usr/opt/perl/5.8.5/lib/XML/Writer.pm line 116 XML::Writer::__ANON__[/usr/opt/perl/5.8.5/lib/XML/Writer.pm:12 +5] called at /usr/opt/perl/5.8.5/lib/XML/Writer.pm line 133 XML::Writer::__ANON__[/usr/opt/perl/5.8.5/lib/XML/Writer.pm:13 +5] called at /usr/opt/perl/5.8.5/lib/XML/Writer.pm line 476 XML::Writer::xmlDecl('XML::Writer=HASH(0xd6dbe0)') called at g +en_activity.pl line 150 main::gen_blob('HASH(0xd2edac)') called at gen_activity.pl lin +e 115

Below is my code
my $output; # XML Writers object 147 my $xmlObj = new XML::Writer(OUTPUT=> \$output, NEWLINES=>0) +; 148 149 # Start XML file with the line <xml version = "1.0 150 $xmlObj->xmlDecl();

Replies are listed 'Best First'.
Re^3: Writing output to a scalar with XML::Writer
by ikegami (Patriarch) on Feb 15, 2006 at 20:12 UTC

    What does print $XML::Writer::VERSION print?
    What does print ref \$output print?

      $XML::Writer::VERSION - 0.520

      print ref \$output
      This will print SCALAR

        0.520 did not support this. From the 0.520 documentation:

        OUTPUT

        An object blessed into IO::Handle or one of its subclasses (such as IO::File); if this parameter is not present, the module will write to standard output.

        Passing a string reference was only introduced in 0.530.