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

How do you print just tagless text with CGI.pm in OO mode?
In standard mode, you just

print 'text';

non-Perl: Andy Ford

Replies are listed 'Best First'.
Re: CGI.pm OO mode plain text
by Arunbear (Prior) on Nov 20, 2006 at 23:54 UTC
    print 'text'; will also work in OO mode - try it and see.
      As will $q->print('some text');

      Don
      WHITEPAGES.COM | INC
      Everything I've learned in life can be summed up in a small perl script!
Re: CGI.pm OO mode plain text
by duff (Parson) on Nov 20, 2006 at 23:55 UTC

    Um ... did you try using print 'text';? :-)

      I did, but the text never made it. My problem lies elsewhere.

      non-Perl: Andy Ford

        wild guess:
        my $q = CGI->new; print $q->header(); print 'hello, OO world!';
Re: CGI.pm OO mode plain text
by shmem (Chancellor) on Nov 21, 2006 at 09:09 UTC
    Should work with OO. But.. if the output doesn't show up, perhaps the print goes to a different filehandle?
    open(O,">","/dev/null"); select O; my $fh = select STDOUT; warn "fileno is ",fileno($fh),"\n"; select $fh; print 'text'; __END__ fileno is 3

    If you want to print to STDOUT and the fileno reported isn't 1, there's the problem.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}