Running perl from a browser without a web server?

S

sstark

Hi, I'd like to run a perl script (using CGI.pm) from a web browser but
without using a web server. Is there any way to do that?

thanks
Scott
 
G

Gunnar Hjalmarsson

sstark said:
Hi, I'd like to run a perl script (using CGI.pm) from a web browser but
without using a web server. Is there any way to do that?

Why do you ask? If it's because you find it difficult to install a
server, try this bundle: http://www.indigostar.com/indigoperl.htm

It gives you Perl and Apache with CGI, mod_perl and PHP.

Can't be easier than that.
 
X

xhoster

sstark said:
Hi, I'd like to run a perl script (using CGI.pm) from a web browser but
without using a web server. Is there any way to do that?

HTTP::Daemon

Xho
 
D

Dave Weaver

Hi, I'd like to run a perl script (using CGI.pm) from a web browser but
without using a web server. Is there any way to do that?

I think you misunderstand how things work.

Web browswers don't run Perl. Web browsers talk to web servers.
Web servers can talk to programs written in Perl (or any other
langauge) using the CGI.

If you wish to write a CGI program you will need to have a web server
for it to communicate with.

There are freely available bundles that contain Perl & a web server
that you can easily install on your own PC, for example IndigoPerl
from http://www.indigostar.com/
 
E

Eric Bohlman

Hi, I'd like to run a perl script (using CGI.pm) from a web browser but
without using a web server. Is there any way to do that?

You'd have to build a "mini web server" into the program itself, so that
when you start it (you'd have to do *that* using you're OS's program-start
mechanism), it starts listening on a local port, which you in turn point
your browser at. As Xho pointed out, you could use HTTP::Daemon to build
it, though it would still involve a bit of work. IIRC,
Net::HTTP::Server::Simple does a bit of the work for you.
 
S

sstark

Hi all, thanks for the many replies. To clarify:

Yes I could easily install Apache; however for security reasons my
employer forbids it, or at least requires a lot of security precautions
that I'd rather not deal with. I'm looking at ways to make the script a
standalone that I can give to users so they can run it on their own
machines without installing a server.

Perhaps the mini web server would do the trick, I'll look into that.

What I'm really looking for, though, is simply a wysiwyg interface that
allows users to click on choices and enter text into fields. Perhaps
the browser/CGI solution isn't the only way. I seem to recall seeing
some kind of Perl graphical interface a few years ago, some kind of
"widget" thingie. Anybody know what I'm talking about and if there's a
way to accomplish what I want?

thanks,
Scott
 
X

xhoster

Eric Bohlman said:
You'd have to build a "mini web server" into the program itself, so that
when you start it (you'd have to do *that* using you're OS's
program-start mechanism), it starts listening on a local port, which you
in turn point your browser at. As Xho pointed out, you could use
HTTP::Daemon to build it, though it would still involve a bit of work.
IIRC, Net::HTTP::Server::Simple does a bit of the work for you.

I think it is just HTTP::Server::Simple, at least that is the closest I
found at search.cpan.org. I wish I knew about this module earlier. (Or
maybe I wish it existed earlier--it is pretty new.)

Xho
 
P

Paul Lalli

sstark said:
What I'm really looking for, though, is simply a wysiwyg interface that
allows users to click on choices and enter text into fields. Perhaps
the browser/CGI solution isn't the only way. I seem to recall seeing
some kind of Perl graphical interface a few years ago, some kind of
"widget" thingie. Anybody know what I'm talking about and if there's a
way to accomplish what I want?

There are many different ways of creating GUIs with Perl. The one with
which I am most familiar is Perl/Tk. If you installed ActiveState's
version of Perl, you already have it installed. Take a look at
perldoc Tk

Otherwise, you can download the Tk toolkit from CPAN:
http://search.cpan.org/~ni-s/Tk-804.027/pod/overview.pod

You might also want to have a look at www.perltk.org

Paul Lalli
 
N

News KF

Hi,

If your IT team is sensitive to servers, them I suggest, that your
temporary server should just listen to the localhost (where the browser
and the perlscript would be running).
By this you would use the browser as generic graphical front end for
your perl cgi scripts.

Other option is of course to use perlTK.
Depends on what you'd like to achieve exactly and how much experience
you'r having with perl-cgi and html vs. tcl/tk , which perltk borrowed
the widgets from.


bye


nkf
 
D

Damian James

...
What I'm really looking for, though, is simply a wysiwyg interface that
allows users to click on choices and enter text into fields. Perhaps
the browser/CGI solution isn't the only way. I seem to recall seeing
some kind of Perl graphical interface a few years ago, some kind of
"widget" thingie. Anybody know what I'm talking about and if there's a
way to accomplish what I want?

There are several GUI toolkits available for Perl. You are probably
thinking of Perl::Tk, but I suggest searching google for previous
threads here about Perl GTK. WxPerl is another option.

--Damian
 
C

ChrisO

sstark said:
Hi all, thanks for the many replies. To clarify:

Yes I could easily install Apache; however for security reasons my
employer forbids it, or at least requires a lot of security precautions
that I'd rather not deal with. I'm looking at ways to make the script a
standalone that I can give to users so they can run it on their own
machines without installing a server.

Perhaps the mini web server would do the trick, I'll look into that.

What I'm really looking for, though, is simply a wysiwyg interface that
allows users to click on choices and enter text into fields. Perhaps
the browser/CGI solution isn't the only way. I seem to recall seeing
some kind of Perl graphical interface a few years ago, some kind of
"widget" thingie. Anybody know what I'm talking about and if there's a
way to accomplish what I want?

I know it does little good to ask your company to "lighten up," but I'm
always amazed at the things employers want and then tie their employees'
hands behind their backs, usually in the name of "security." My own
company is guilty of this too much to my chagrin sometimes.

Anyway, not that it'll help en totale, but Simon Cozens had a rather
nice article in The Perl Journal (TPJ) recently which spoke of this
delimma of having an app whose presentation layer was a browser running
against a web server installed on the same machine. Again, I know you
said you can't do that, but the article might be worth a look anyway to
see if it can give you some ideas.

Also, with ActiveState Perl, you can install PerlScript on the
*client-side* browser and run Perl in the browser same as Javascript,
BUT... I doubt this will help you much and of course it doesn't provide
a CGI interface. That requires something on the "backend" even if on
the same machine, which is why I simply said "no" to your original
question. Everyone here is presenting HTTP::Daemon and such, and it's
merely a way of "tricking" your employer, which in my mind makes the
forbiding of a real server install ludicrious. Those are still "backend
servers," even if on the same box. You can't get around that. It's
easy to install Apache to answer requests ONLY from the localhost hence
providing you a local server that opens no security holes.

But again, I sympathize. I've actually investigated the HTTP::Daemon
thingy for the exact same reason, so I sympathize. The article however
may provide other ideas or provide a platform for you to justify doing
exactly what he did (which included a full hands-free install approach too.)

-ceo
 
S

Sherm Pendley

Dave Weaver said:
Web browswers don't run Perl.

It's more accurate to say that web browsers don't run CGI.

But some of them can run Perl, under the right conditions. If you've installed
ActivePerl for Windows, it integrates with the Windows Scripting Host. That
means, among other things, you can put Perl inside of <script ...> elements and
IE will be able to run it.

Of course, that won't help the OP - it's an entirely different environment from
CGI, and won't help with CGI development at all.

sherm--
 
F

Flatman

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQBDDI3yexs8k4f5tB4RAlmHAJwNCLdsB0473bhrnY5snkfw05TesACeLhmG
x43spO3u+e//HZAs0UF6vMM=
=LtHl
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top