RE: CGI Question . . .
by Anonymous Monk on Apr 24, 2000 at 21:48 UTC
|
Perhaps this?
From "perldoc CGI"
In addition to the function sets, there are a number of pragmas that you can import. Pragmas, which are always preceded by a hyphen, change the way that CGI.pm functions in various ways. Pragmas, function sets, and individual functions can all be imported in the same use() line. For
example, the following use statement imports the standard
set of functions and disables debugging mode (pragma
-no_debug):
use CGI qw/:standard -no_debug/;
| [reply] |
Re: CGI Question . . .
by comatose (Monk) on Apr 24, 2000 at 21:54 UTC
|
I think I understand what you are trying to do, but you
may be taking a more difficult approach. Am I correct that
you want both versions to be used via a web browser?
Because of the interactions of the browser and the server
via forms and CGI, you aren't going to be able to do it
simply without different versions of your script and specific
configurations made on the client browser. Of course,
with perl, there's always more than one way to do it.
Probably the solution requiring the least modification to
your code would be to put everything needed on the CD.
The CD needs to have a web server, perl, and all your
scripts. If you are on Win32, have a batch file that
starts the server on the CD and then get a web browser to
go there. It'll be tricky no matter what, but good luck!
| [reply] |
RE: CGI Question . . .
by random (Monk) on Apr 24, 2000 at 21:55 UTC
|
Simplicus,
I don't think there is a way to link a page and a CGI script without some kind of server. However, you're looking at it from the wrong angle. You should be trying to get a server on the CD. Check out MicroWeb. It's proprietary, and I've never tried it personally, but it looks like it might do the job.
random | [reply] |
|
I just checked out, and it looks like it'll do the trick. Only problem is, it's $299. Maybe I can get the company to spring for it . . .%)
Thanks, though, you pointed me in the right direction.
Simplicus
| [reply] |
Re: CGI Question . . .
by chromatic (Archbishop) on Apr 25, 2000 at 00:02 UTC
|
| [reply] |
RE: CGI Question . . .
by Keighvin (Novice) on Apr 25, 2000 at 03:37 UTC
|
On the theme of good small servers, try www.sambar.com - free for personal use, etc. It's an awesome little server anyway (for Win32). | [reply] |
|
Thanks, and I gave you the vote here for your anonymous HTML 1.0 Facelift post . . . Simplicus
| [reply] |
RE: CGI Question . . .
by random (Monk) on Apr 24, 2000 at 21:58 UTC
|
Simplicus,
I don't think there is a way to link a page and a CGI script without some kind of server. However, you're looking at it from the wrong angle. You should be trying to get a server on the CD. Check out MicroWeb. It's proprietary, and I've never tried it personally, but it looks like it might do the job.
random | [reply] |
Re: CGI Question . . .
by httptech (Chaplain) on Apr 25, 2000 at 00:11 UTC
|
If the target platform is Win32 you can use
TinyWeb
It will run off of the CD, with no config file necessary.
It's written in Delphi, and the source is available. I am also
trying to make a "CGI on CD" system, and am planning to use TinyWeb
as the server. The executable is around 53K, and it runs CGI. And it's freeware.
One small thing I didn't like about it is it keeps access,
error and referrer logs, with no commandline switch to disable them.
I solved it by removing all logging routines from the source code (it
was fairly simple, and I know nothing about Delphi programming)
For the perl scripts themselves, I am compiling them into
standalone executables with perl2exe (which does cost money)
| [reply] |
|
I've used perlapp from ActiveState in the past. It sure as hell would fit a job like the one described to build freestanding executables... They seem to be alot more stable and less "chunkier" than the fully compiled *NIX executables.
At least I haven't had any freestanding apps core dump on me yet... Its worth the money (plus you a get a nice debugger).
Cheers.
| [reply] |
RE: CGI Question . . .
by da'ud (Initiate) on Apr 25, 2000 at 07:58 UTC
|
it's really quite simple (as far a I can see). Making a webserver in perl is _extremely_ simple.
So just put a few minimal perl distributions on the disk (one per platform you want to support) and put a script similar to the following (adopted from HTTP::Daemon pod):
use HTTP::Daemon;
use HTTP::Status;
my $d = new HTTP::Daemon LocalPort => 9999;
print "CDRom webserver running on: ", $d->url, "\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
if ($r->method eq 'GET') {
# here you do the stuff
# ...
} else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
then you make a few ways to start the server (autorun on win32, ...) and you are up and away.
think perl for perl is the most elevated
your humble brother
/dh | [reply] [d/l] |
RE: CGI Question . . .
by Simplicus (Monk) on Apr 25, 2000 at 18:02 UTC
|
Thanks to all of you, my friends. I'm using HTTP::daemon to write a small web server now, since I have to port this to UNIX and Windows. Couldn't have done it without you, thanks again for the help . . . Simplicus | [reply] |
RE: CGI Question . . .
by BoxCarWillie (Initiate) on Apr 25, 2000 at 04:44 UTC
|
---
put your name value pairs inside a text file
eg. v.txt
a=20
b=30
arg=40
If t.pl is your script then execute as t.pl < v.txt
sample :
use CGI;
my $page=new CGI ;
if (! $page->param() )
{
print ".. will NOT read from STDIN\n";
}
else
{
print ".. will read from STDIN\n";
foreach ( $page->param () )
{
print "$_ = @{[$page->param ($_)]}\n";
}
}
results:
(offline mode: enter name=value pairs on standard input)
.. will read from STDIN
a = 20
y = 30
arg = 40
Note: for more powerful solutions you may
want to look at how the function
read_from_cmdline in CGI.pm is used and called and what
it does. | [reply] [d/l] |