in reply to Re: Accessing parallel ports
in thread Accessing parallel ports

Thanks Khen1950fx,

I actually got it to work using the code below. I changed auto:0 to auto:1 and that did it.

require "subparseform.lib"; &Parse_Form; print "Set-cookie: cart_id=1234; user_id=123;\n"; print "Content-type: text/html\n\n"; use strict; use CGI; use Device::ParallelPort; # use Device::ParallelPort::drv::linux # Set up your parallel port object and tell it what driver to use. my $parport = Device::ParallelPort->new('auto:1'); # $parport->set_bit(0,1); # $parport->set_bit(1, 1); $parport->set_bit(2, 1); $parport->set_bit(3, 1); $parport->set_bit(4, 1); $parport->set_bit(5, 1); $parport->set_bit(6, 1); $parport->set_bit(7, 1);

If I don't comment out the CGI lines I get an Internal Server Error, that's why I have them. Is there a serious problem with doing it this way?

Replies are listed 'Best First'.
Re^3: Accessing parallel ports
by roboticus (Chancellor) on Jan 07, 2011 at 09:49 UTC

    tumoheat:

    If you check your server logs, I bet it's complaining about permissions. If so, talk to your system administrator about getting permission to access the parallel port for your web server account.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Roboticus,

      Thanks for your assistance. I commented out the CGI lines and it works fine. Maybe it's the way I learned to write dynamic web pages, but I always put all of my Perl files (with .cgi extensions) in a cgi-bin directory and execute them from there. And I've been putting in the 'use CGI' line from the beginning. I've never had a problem with it, and it works real well when passing data between forms. BTW, the whole point of my program was to control a green house in my garage - remotely via a web page - from my desk at work. It worked, so I am attempting to build on from there. FYI. Thanks again.