CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
where does the output go?

 



tedo59
New User

May 8, 2011, 12:56 AM

Post #1 of 3 (768 views)
where does the output go? Can't Post

I'm just getting started with perl and wanted to do some graphical work. I wondered if someone can please tell me where the image output from the "A Simple Example" on this page goes? http://linuxgazette.net/issue83/padala.html
I tried running it in the Eclipse SDE and from a terminal in Linux but just got a load of gobbledegook.
cheers
Mark


shawnhcorey
Enthusiast


May 8, 2011, 4:44 AM

Post #2 of 3 (764 views)
Re: [tedo59] where does the output go? [In reply to] Can't Post

The program is design to be a CGI. To see the output, store it in a file and open it with an image viewer. A web browser will do.

Replace these lines:


Code
print "Content-type: image/png\n\n"; 
print $myimage->png;


with:


Code
my $file = "example.png"; 
open my $png_fh, '>:raw', $file or die "could not open $file: $!\n";
print $png_fh $myimage->png or die "could not print to $file: $!\n";
close $png_fh or die "could not close $file: $!\n";


The image is stored in example.png.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


tedo59
New User

May 8, 2011, 8:34 AM

Post #3 of 3 (756 views)
Re: [shawnhcorey] where does the output go? [In reply to] Can't Post

Thank you very much for your help, that worked.
Mark

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives