Controlling Serial Port from Web Browser with Perl (And updating HTML textarea with incoming data)

I have an embedded device I would like to control through a web browser.

I've got my webserver and Perl interpreter running and executing Perl code.  I have also been able to print incoming text from the embedded device to a inline frame on a "control" web page.  (All local)

At this point, I believe I am missing something rather basic to put this whole webapp together.

Once I start the serial port process up and have data being fed to my HTML page, how do I:

1.  Re-establish communication with the running CGI process so that I may make configuration changes to the serial port, or send data to the embedded device.

I.e.  Raise the DTR signal, change baudrate/commport/parity etc.

2.  Stop the web browser from continually looking like it's continually loading data.

I.e. Spinning hourglass or "Transferring data from" message in the web browser.

Seems doable, but out of my reach at the current moment.  
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is the serial port communication being done directly from your perl application, or is there some other application that is handling that communication?

What OS are you on?
WingTsunMonkAuthor Commented:

Thanks for the reply.  

Communication is being handled by the Perl program/script.  

I am currently developing the program on W2K, but will port to Unix\Linux as well.
1.  The CGI process should be your perl process - the web browser makes a request to your web server, the web server starts your perl program, your perl program communicates with the port.  Not really sure what you are asking here.

2.  The web browser will wait until all data has been received.  What is the problem with this?
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

WingTsunMonkAuthor Commented:
From what I understand of the traditional CGI web application model, a program is restarted with each web request.   It would appear, in my scenario, that I would have a continually running perl process that I would need to interact with at a later time.  

Our embedded device, once connected to a RS232 channel and DTR toggled High,  will continually spit out information that I need to display into a text area or inline frame.  I will also need to employ some sort of file upload to the embedded device to help facilitate firmware upgrades.

One approach I took was to load an HTML page that had an inline frame who's source was the perl script. I could get the serial information from the device, and display it in the inline frame, but I do not understand how to control the serial port program at this point.
Okay... I thought you were going to a web page, having the server send some info to the serial port, get the results, send them to the web browser, then be done.

It sounds like you need some program running continuously to get the data.

You could have that program get new information from the webserver in a couple of ways.  What you are looking for is known as interprocess communication - or IPC.  There is a perl page describing the different methods:

To have the web browser not be always loading, you could have the page get the available data - the server returns whatever is available so far, then finishes.  Then add a meta refresh to the page so it will get new data every so often.
Or you could use AJAX to have the page continually get new data.  
WingTsunMonkAuthor Commented:
Thanks....I thought I was headed in the correct direction but may have been tripping up on some concept.  

I'll look more into the IPC, I came across those modules at CPAN but quickly got lost in the magnitude of modules available at CPAN.  

Have you heard of, or had any working experience with Continuity, CoroChannel or Seaside?  

Could you comment on these?

They seem pretty new and there is not a "whole" lot of documentation on them.  
No, I haven't used any of those.  I have used several of the methods discussed on the perl IPC page though, so if you decide to go that way, and have questions about that, let me know.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WingTsunMonkAuthor Commented:
Thank you.  Based on your comment I will attack my problem from the direction you suggested.  If I do have a question,shall I post here or is there another preferred way I might ask you a question?
Posting here is the best way.  Not only me, but other experts will see your question.
WingTsunMonkAuthor Commented:

FYI for anyone interested.

I experimented with the latest build of Continuity on CPAN on a W2K system with ActiveState Perl 5.10.

The examples in the Continuity /eg will not work on Windows because Fcntl is not implemented yet on 5.10. (Or maybe never?)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.