http://qs321.pair.com?node_id=708626


in reply to Pixel-based Plotting in Perl?

I recall doing the same thing as you: drawing, say, a bunch of diagonal lines on a screen using BASIC, and people coming up to me and going, "Whoa! What's that?" But that was in 1978 or so. :) These days, most people don't plot stuff like that on the console - although you still can, if you want to, at least in Linux (that's what the 'svga' library is for.) Assuming that you are running Linux, and want to do this with Perl, you could use Linux::Svgalib:

# From the module docs use Linux::Svgalib; my $svga = Linux::Svgalib->new(); $svga->init(); $svga->setmode(G640x480x16); # Set the color for the subsequent ops $svga->setcolor($color); # Place a pixel $svga->drawpixel($x, $y); # Draw a line $svga->drawline($x1, $y1, $x2, $y2); # ...and so on; see the other methods in the documentation $svga->setmode(TEXT);

This may be as close as you'll get to the old BASIC experience. :)

Update: Linux::Svgalib doesn't compile on my system (an error in the XS portion, which I'm too lazy to troubleshoot); however, vga seems to compile just fine, and appears (per the docs) to handle the same functions.


-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells