Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Scripts for a Browser?

Status
Not open for further replies.

JustKIDn

MIS
May 6, 2002
386
0
0
US
Hi All,

I've been using Perl on and off for quite a while now. But I've never had a need to use Perl to display data in a browser.

Until now. Is it possible to write a Perl script to display data on a browser without using a Web Server like Apache?

I'm thinking about something I could write to be used on a stand alone PC. (probably windows, because that's what's on the clients PC).

If I could do it, then I could use SQLite for the database. This way I'd have a low-end solution that won't need an administrator to maintain it.

Just a thought!

If I can't do it this way, I might use Apache and SQLite with Perl.

Have you heard of SQLite?

tgus

____________________________
Families can be together forever...
 
You could certainly use Perl to listen to port 80 (or whatever) for HTTP requests using IO::Socket or HTTP::Daemon, etc. Here's one: ( And another: ( The question is, why would you want to? Just load up Apache... it'll be less of an administrative headache than building your own! You can use Webmin or some other front end to maintain the config file if you don't want to use a text editor.

Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Thanks Tom,

No, I wasn't saying I wanted to build my own or even use a different web server.

Having never written a Perl script to run in a browser, I was just wondering if I HAVE to use a web server.

If I have to use a web server, I will probably use Apache.

I just wanted to keep the number of things installed on the client PC to a minimum. As they will probably be using the PC for multiple tasks. And there won't be anyone who knows how to maintain it. Which is one reason for using SQLite.

Another question;

If I have to use a web server anyway. Whould it be easier to use Perl or PHP?

tgus

____________________________
Families can be together forever...
 
In my experience, php is far easier to use and maintain, while perl is far more powerful. If your looking for simplicity head for php. It is an extremely easy language to pick up.
 
Are you looking for a client side script or a server side script? I am not sure exactly what you are trying to do when say yo would have to install apache aon the client side. The best way to go would be to have a server side script that format the data as webpage then the clients broswer would display it. In this case I think you would do better with php. It was made for this.

Randy
smiletiniest.gif


You can Email me at: RCooper@cinci.rr.com
 
Thanks guys,

Yes I've been using PHP for a while now and I do find it easy to use. But I've never used Perl as a .cgi script so I don't know what that would look like. That's why I was asking if PHP or Perl was easier for this.

Randy, ideally, I would like to do this client side. So I don't have to have a web server. But PHP is NOT client side, so that won't work. I've done a lot of stuff with Perl without the need for a web server (because everything I've done is for Linux, DOS or a DOS window).

Since I can do things with Perl as stand-alone I was HOPING there might be some trick to do it in a browser without a web server. I was pretty sure it wasn't possible. I just had to ask.

As I said before, this is a stand alone PC. (no network, no internet) So the web server, browser, PHP or Perl will all have to be installed on the same PC.

I've heard that you can use JavaScript to access data in a database. But I haven't seen anything on this. And I'd rather not use JavaScript. And from what I can tell, Python is also a server side script.

tgus

____________________________
Families can be together forever...
 
Search this forum for 'perlscript'

There is some wacky guy who swears by it. It should do what you are asking IF the client has ACtiveState Perl installed and IF the OS is windows and IF you are using IE.

Otherwise perl won't run client side.
 
If you're just looking for client-side scripting, use JavaScript. If we're not quite understanding what you want to do, then perhaps you can explain better.

Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Yea ,if you are lookign for client side I strongly recommend javascript or vbscript as well.

However is perl is a MUST then you -can- do it. I don't think you should, but you can.
 
Thanks again guys,

No, I don't think I want to get stuck in a 'nitch' product. PerlScript sounds nice and it may be exactly what I'm looking for. But it doesn't sound like there is much commitment from the community. So it may not be around for the long term.

And I don't use ie.

If Javascript can do what I want, I might look into it. But I haven't found anything on Javascript and Databases.

I guess it's not clear what I am doing.

I want to put together a cataloging or library program to display what items are in the database in a browser.

As this is on a PC that may have multiple uses and multiple users that are not very computer literate. I wanted to make it so there is little or no maintainance required. And hopefully as few things as possible to break.
This is why I wanted to use SQLite and a browser without a web server.
If I have to use a web server, I will probably use Apache, SQLite and PHP with Mozilla Firebird.

If anyone knows about Javascript use with databases, I'm listening.

Thanks for the comments, keep them coming!

tgus

____________________________
Families can be together forever...
 
If your users are not computer literate asking them to install activestate perl in order to run your webpages is not the way to go.

What does 'having a webserver' to do with your end-user being computer illiterate? They shouldnt care how they get the data really. No matter what you need a database, that is not running on the client, why is that any different then a web server?
 
You can use Perl, CGI, and a database to access local resources via a local apache server at I'm not sure this is the right approach though. You could use Perl to write a GTK+ program in Gnome for a front-end.

Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
My users would not be installing Perl.
I would be installing everything needed myself.

As the PC is a standalone machine, everything will need to be installed on this PC. Remember, there is NO network and NO internet.

For this reason, I need to set the web server to automatically start-up on boot-up also PHP and database. All on this same PC.

Sometimes users start to get smart and begin 'cleaning' the hard drive. At some point they begin to remove files and directories they know nothing about (they don't recognize) and then it's broke.

tgus

____________________________
Families can be together forever...
 
Thanks Tom,

That's probably the approach I'll take.
Except I don't want to build a front-end. That's why I'm using a browser.
Otherwise I'd just use Visual Basic or Access.

tgus

____________________________
Families can be together forever...
 
As long as the page(s) are local, you don't need a web server to render a page on a browser.

There's always a better way. The fun is trying to find it!
 

tviman,

That's what I wanted to hear.

How can I do it?

Can you give any examples?



tgus

____________________________
Families can be together forever...
 
You can't do any dynamic stuff like you want to

I'd use VisualBasic with an Access database installed on the local machine. That will get you what you want I think.

Firebird is a nice SQL engine that runs nicely as well.
 
Except I don't want to build a front-end. That's why I'm using a browser.
Otherwise I'd just use Visual Basic or Access.


With a browser I believe you'd have to build as much of a front end as you would with Access. I would just go with Access unless there's $$ concerns.

I want to put together a cataloging or library program to display what items are in the database in a browser.

So you just want to display the items? How will they get into the database?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top