Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
go ahead... be a heretic
 
PerlMonks  

CGI.pm OO mode plain text

by andyford (Curate)
on Nov 20, 2006 at 18:17 UTC ( [id://585162]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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 18: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 18: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 04: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}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://585162]
Approved by Paladin
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.