Re: Perl and Microsoft Excel?

2001-11-30 Thread Hans Poo

El Jue 29 Nov 2001 19:31, Ian escribió:
 Mensaje firmado por ID de clave desconocido 962F87CA
 In the wide and wonderful world of Microsoft and Linux, I'm in the
 need of an interesting soloution.

 I'm presenting this to the list because I've ran out of good ideas.

I recommend making a mod_perl application for the list and store the 
information in mysql (and forget about excel if you can), and then, just take 
that information and publish on the web. 

Hans



Re: Files problem, pulling my dam hair out

2001-11-30 Thread Hans Poo

El Jue 29 Nov 2001 19:37, Chuck Carson escribió:
 I have the following config:

 apache 1.3.22 with perl 1.26 built statically

 I want to use perl to dynamically generate html pages, so I have .pl
 files under DOCUMENT_ROOT.

 I have this config:

 Alias /perl /usr/local/apache/cgi-bin
 Directory /usr/local/apache/cgi-bin 
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options +ExecCGI
 /Directory
 Files *.pl
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options ExecCGI
 /Files

 Whenever I try and get a perl script from a web browser, it pops up a
 dialog asking to save the damn file. I have tried Netscape 4.79 on NT
 and Unix as well as IE 5.5. I have configured a server in this manner
 probably 100 times, I cannot find what I a missing this particuliar
 time.


 Anyone have any ideas?

 Thanks,
 Chuck


 Chuck Carson
 Systems Administrator
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 858.202.4188 Office
 858.442.0827 Mobile
 858.623.0460 Fax

The content type is not getting rigth to the browser !

If you are using a funny extension for your files you need the apache  
AddType directive.

AddType text/html .myextension

Maybe you are just forgeting to send the http Content-Type: text/html as your 
first instruction. There are many ways to do it:

print Content-Type:text/html\n\n;

or 

use CGI qw/:standard/;
print header;

or the mod_perl way

In any case, you miss to Put a mod_perl directive PerlSendHeader on (to fix 
malformer headers) in your directory configuration.

Hans Poo



[ANNOUNCE] OpenFrame 2.05

2001-11-30 Thread Leon Brocard

This is the first wide announcement of the release of OpenFrame.

OpenFrame is an Application Framework for Perl and the Web. It is
designed to do enough to make your life easier, and provide enough
flexibility to make extending it to do what *you* want it to pretty
easily.

It doesn't have to run under mod_perl, but it can. It doesn't have to
use the Template Toolkit, but it can. It doesn't have to use SOAP to
distribute parts of it on seperate machines, but it can. I hope you're
beginning to get the idea...

It is available from CPAN (2.05 will be up shortly):
http://search.cpan.org/search?dist=OpenFrame

Please check out the website for demonstrations, documentation and a
presentation on OpenFrame:
http://openframe.fotango.com/

Thanks. I'd love to get some feedback on it, Leon
--
... the bunnies are coming!



Vhosts + mod_perl

2001-11-30 Thread James

Hi,

Does anyone have a quick example of setting up a vhost with mod_perl 
enabled please? Also an ordinary cgi-bin, with file extensions .pl and 
.cgi enabled?

Also with a vhost, I can name the host anything I like can't I? For 
example, say my domain is localhost.localdomain but I'm using dyndns to 
make it a hostname, say, trains.ath.cx. I can assign fred.trains.ath.cx 
and john.trains.ath.cx with vhosts, the requests will get piped to my 
main machine which is trains, and the vhost section will take care of 
the rest, knowing which document root to use, right? I don't have to 
mess around with DNS or anything do I to make new subdomains?

Is it:

virtualhost fred.trains.ath.cx /doc/root
Options +Indexes +ExecCGI
DocumentIndex ??? index.html default.html
perl-handler # hmm, get mod_perl working in /doc/root/perl
cgi-bin 
# hmmm, get a cgi-bin happening in /doc/root/cgi-bin
/virtualhost

Or something like that?

Many Thanks.
James




Re: Vhosts + mod_perl

2001-11-30 Thread Stephen Reppucci


Well, you certainly haven't inconvenience yourself by taking the
time to look at the copious documentation available on this, now
have you?

That said, here's a snippet of what you want to use:

NameVirtualHost 192.168.0.10
VirtualHost 192.168.0.10

  ServerName   www.logsoft.com
  ServerAlias  logsoft.com
  ServerAlias www2.logsoft.com

  DocumentRoot  /var/apache/htdocs

  Options  +ExecCGI +Indexes
  AddHandler   cgi-script .cgi


  Location /perl
SetHandler perl-script
PerlFreshRestart On
PerlHandler Foo:Bar
PerlSetVar SOME_VAR /usr/local/foo
  /Location

/VirtualHost

hth,
Steve

On Sat, 1 Dec 2001, James wrote:

 Does anyone have a quick example of setting up a vhost with mod_perl
 enabled please? Also an ordinary cgi-bin, with file extensions .pl and
 .cgi enabled?

 Also with a vhost, I can name the host anything I like can't I? For
 example, say my domain is localhost.localdomain but I'm using dyndns to
 make it a hostname, say, trains.ath.cx. I can assign fred.trains.ath.cx
 and john.trains.ath.cx with vhosts, the requests will get piped to my
 main machine which is trains, and the vhost section will take care of
 the rest, knowing which document root to use, right? I don't have to
 mess around with DNS or anything do I to make new subdomains?

 Is it:

 virtualhost fred.trains.ath.cx /doc/root
 Options +Indexes +ExecCGI
 DocumentIndex ??? index.html default.html
 perl-handler # hmm, get mod_perl working in /doc/root/perl
 cgi-bin
   # hmmm, get a cgi-bin happening in /doc/root/cgi-bin
 /virtualhost

 Or something like that?

 Many Thanks.
 James


-- 
Steve Reppucci   [EMAIL PROTECTED] |
Logical Choice Software  http://logsoft.com/ |
=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=




Re: Vhosts + mod_perl

2001-11-30 Thread James

Now, how did I know I was going to get flamed?? :/

Anyway thanks for the example. Some manuals are too hard to read, you 
have to be a goddamn PhD to read some of them out there to untangle the 
mess of cross references and incomplete examples. :/

But, with that e.g. that uses an IP address, from day to day I don't 
know what my IP address will be, can't I use:

NameVirtualHost fred.trains.ath.cx
VirtualHost fred
... foo
/VirtualHost

?

Thanks and all.
James


Stephen Reppucci wrote:

 Well, you certainly haven't inconvenience yourself by taking the
 time to look at the copious documentation available on this, now
 have you?
 
 That said, here's a snippet of what you want to use:
 
 NameVirtualHost 192.168.0.10
 VirtualHost 192.168.0.10
 
   ServerName   www.logsoft.com
   ServerAlias  logsoft.com
   ServerAlias www2.logsoft.com
 
   DocumentRoot  /var/apache/htdocs
 
   Options  +ExecCGI +Indexes
   AddHandler   cgi-script .cgi
 
 
   Location /perl
 SetHandler perl-script
 PerlFreshRestart On
 PerlHandler Foo:Bar
 PerlSetVar SOME_VAR /usr/local/foo
   /Location
 
 /VirtualHost
 
 hth,
 Steve
 
 On Sat, 1 Dec 2001, James wrote:
 
 
 Does anyone have a quick example of setting up a vhost with mod_perl
 enabled please? Also an ordinary cgi-bin, with file extensions .pl and
 .cgi enabled?
 
 Also with a vhost, I can name the host anything I like can't I? For
 example, say my domain is localhost.localdomain but I'm using dyndns to
 make it a hostname, say, trains.ath.cx. I can assign fred.trains.ath.cx
 and john.trains.ath.cx with vhosts, the requests will get piped to my
 main machine which is trains, and the vhost section will take care of
 the rest, knowing which document root to use, right? I don't have to
 mess around with DNS or anything do I to make new subdomains?
 
 Is it:
 
 virtualhost fred.trains.ath.cx /doc/root
 Options +Indexes +ExecCGI
 DocumentIndex ??? index.html default.html
 perl-handler # hmm, get mod_perl working in /doc/root/perl
 cgi-bin
  # hmmm, get a cgi-bin happening in /doc/root/cgi-bin
 /virtualhost
 
 Or something like that?
 
 Many Thanks.
 James
 





[OT] Re: Vhosts + mod_perl

2001-11-30 Thread Perrin Harkins

 Now, how did I know I was going to get flamed?? :/

 Anyway thanks for the example. Some manuals are too hard to read, you
 have to be a goddamn PhD to read some of them out there to untangle the
 mess of cross references and incomplete examples. :/

Some are, but this one isn't.  This is also off-topic since these aren't
mod_perl questions.

 But, with that e.g. that uses an IP address, from day to day I don't
 know what my IP address will be, can't I use:

 NameVirtualHost fred.trains.ath.cx
 VirtualHost fred
 ... foo
 /VirtualHost

http://httpd.apache.org/docs/vhosts/name-based.html

There are also tutorials on this subject linked from here:
http://httpd.apache.org/docs/misc/tutorials.html

- Perrin




Re: Vhosts + mod_perl

2001-11-30 Thread Maarten Koskamp

Take a look here:
http://dsb3.com/dave/dynipvhost.html
or here:
http://orbitstar.linux-site.net/pub/archive/apache-vhosts.html

Greetz.

maarten.




Re: Vhosts + mod_perl

2001-11-30 Thread Jorge Godoy

James [EMAIL PROTECTED] writes:

 Now, how did I know I was going to get flamed?? :/

 Anyway thanks for the example. Some manuals are too hard to read, you
 have to be a goddamn PhD to read some of them out there to untangle
 the mess of cross references and incomplete examples. :/

 But, with that e.g. that uses an IP address, from day to day I don't
 know what my IP address will be, can't I use:

 NameVirtualHost fred.trains.ath.cx
 VirtualHost fred
 ... foo
 /VirtualHost

I'm successfully using with my ADSL connection:



NameVirtualHost 0.0.0.0

VirtualHost 0.0.0.0
   ServerName vhost.something.here
   ...
/VirtualHost


See you,
-- 
Godoy. [EMAIL PROTECTED]

Solutions Developer   - Conectiva Inc. - http://en.conectiva.com
Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br


msg23179/pgp0.pgp
Description: PGP signature


Re: OT: Converting a ASP request to CGI?

2001-11-30 Thread Alessandro Forghieri

Greetings.

Thanks to all the respondednts - as it looks my original message was too
terse, I'll try to clarify a bit.

I have an app  that already works on Apache CGI.pm, Apache::Registry and
FastCGI.
It also works under PWS/IIS as CGI - and I'll be testing it under AS's
perlex shortly.

At present, the first thing it does is

use strict;
use CGI;

sub main {
my $q=new CGI;
#...
}

main();
1;

It then goes on to its errand, using $q, $q-param, $q-print to its heart
content.

I would like to plug it into IIS's ASP engine, ideally touching nary a line
of code, something along the lines of:


% @LANGUAGE = PerlScript

use CGI:FromAsp; #our valiant package.
my $q=CGI::FromAsp-new($Request);
#
#  $q now looks and feels like a CGI.
#  also print (or $query-print) does the RIGHT THING, and %ENV is what
# we'd expect it to be.
#
if ($q-isa('CGI')) { #it is..
$q-print($q-header(-type='text/html');
frobnicate($q);
$q-print($q-end_html());

} else {
print(h1CGI:FromAsp sucks like a tornado/h1\n);
}

%

Because my current knowledge of ASP is pretty basic, I do not know if it's
even possible... though it
sure looks like it should be.

Cheers,
alf





Re: Apache Bench

2001-11-30 Thread Joshua Chamas

Last I checked, ab which comes with Apache, had not yet been ported
to NT/2000 officially.  However, there does seem to be a port
available here:

  http://www.remotecommunications.com/apache/ab/

Upon testing their precompiled version however, I found that
that it doesn't seem to work too well, in that it can only 
do some 1 request per 4 seconds :(

-- Josh
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks Founder   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Running a shell command inside a cgi/perl script

2001-11-30 Thread Kairam, Raj

In my perl script I have a line like this.
system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);

hp4si is the destination printer.
/tmp/plotreq.txt  is small text file to be sent to the printer.
/tmp/plotid.txt is the output of lp command ( just one line to indicate job
id )to be saved.

If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
it is fine as a command line.

The same in the perl script as above, doesn't send the file to printer nor
does it create the /tmp/plotid.txt file.

I have tried this also and did not work.
@lplist = (/usr/bin/lp, -dhp4si /tmp/plotreq.txt);
system(@lplist);

This is the context.
sub search {
  some code
  
  open(REQFILE, /tmp/plotreq.txt) || die sorry, could not open
/tmp/plotreq.txt;
  some more code to generate content for plotreq.txt
  ..
  close(REQFILE);
   This is where I tried the above to send the file to the printer.
}

This sub is part of a cgi script that creates output for the browser. The
browser output is OK.
The /tmp/plotreq.txt is generated but not being sent to the printer.

Can somebody guide me to do it right ?.
Thanks
Raj kairam




Re: Running a shell command inside a cgi/perl script

2001-11-30 Thread J. J. Horner

* Kairam, Raj ([EMAIL PROTECTED]) [011130 15:10]:
 In my perl script I have a line like this.
 system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);
 
 hp4si is the destination printer.
 /tmp/plotreq.txt  is small text file to be sent to the printer.
 /tmp/plotid.txt is the output of lp command ( just one line to indicate job
 id )to be saved.
 
 If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
 it is fine as a command line.
 
 The same in the perl script as above, doesn't send the file to printer nor
 does it create the /tmp/plotid.txt file.
 
 I have tried this also and did not work.
 @lplist = (/usr/bin/lp, -dhp4si /tmp/plotreq.txt);
 system(@lplist);
 
 This is the context.
 sub search {
   some code
   
   open(REQFILE, /tmp/plotreq.txt) || die sorry, could not open
 /tmp/plotreq.txt;
   some more code to generate content for plotreq.txt
   ..
   close(REQFILE);
    This is where I tried the above to send the file to the printer.
 }
 
 This sub is part of a cgi script that creates output for the browser. The
 browser output is OK.
 The /tmp/plotreq.txt is generated but not being sent to the printer.
 
 Can somebody guide me to do it right ?.
 Thanks
 Raj kairam
 

Have you tried to 'su -' to nobody (or whomever your server is running as)
and run the command that way?  Have you tried to run the script from the command-line
and see what that yields?

On a side note, you may want to ensure that you are using Taint for all of your CGI
scripts when they interact with the OS.

Thanks,
JJ


-- 
J. J. Horner
H*,6a686f726e657240326a6e6574776f726b732e636f6d
***
H*,6a6a686f726e65724062656c6c736f7574682e6e6574

Freedom is an all-or-nothing proposition:  either we 
are completely free, or we are subjects of a
tyrannical system.  If we lose one freedom in a
thousand, we become completely subjugated.



msg23183/pgp0.pgp
Description: PGP signature


Re: Running a shell command inside a cgi/perl script

2001-11-30 Thread Rodney Broom

From: Kairam, Raj [EMAIL PROTECTED]

 system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);
 If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
 it is fine as a command line.

I may be missing something, but it looks to me like you are running a different 
command from system() than what you are doing on the command line. That is, system() 
apears to be getting this:

'/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt

And the shell apears to be getting this:

/usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt


When I need error checking, I'll often use open() instead of system().

---
Rodney Broom






Re: Running a shell command inside a cgi/perl script

2001-11-30 Thread Balazs Rauznitz

On Fri, Nov 30, 2001 at 03:08:16PM -0500, Kairam, Raj wrote:
 In my perl script I have a line like this.
 system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);
 
 hp4si is the destination printer.
 /tmp/plotreq.txt  is small text file to be sent to the printer.
 /tmp/plotid.txt is the output of lp command ( just one line to indicate job
 id )to be saved.
 
 If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
 it is fine as a command line.
 
 The same in the perl script as above, doesn't send the file to printer nor
 does it create the /tmp/plotid.txt file.
 
 I have tried this also and did not work.
 @lplist = (/usr/bin/lp, -dhp4si /tmp/plotreq.txt);

You're using system incorrectly; this should work:

system /usr/bin/lp -dhp4si /tmp/plotreq.txt   /tmp/plotid.txt; # no singlequotes 
arounf the command

-Balazs



Re: Running a shell command inside a cgi/perl script

2001-11-30 Thread Medi Montaseri


Use the CHILD_ERROR  $? to see what happend, for example

system( some command );
if ( $? )
{
then figure out what happend..
}
Note that you'll have to see what your command returns and parse that.
See perlvar(1), there is some shifting around to be done as well.

But I am not sure how this is related to ModPerl?

On Fri, 30 Nov 2001, Kairam, Raj wrote:

 In my perl script I have a line like this.
 system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);
 
 hp4si is the destination printer.
 /tmp/plotreq.txt  is small text file to be sent to the printer.
 /tmp/plotid.txt is the output of lp command ( just one line to indicate job
 id )to be saved.
 
 If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
 it is fine as a command line.
 
 The same in the perl script as above, doesn't send the file to printer nor
 does it create the /tmp/plotid.txt file.
 
 I have tried this also and did not work.
 @lplist = (/usr/bin/lp, -dhp4si /tmp/plotreq.txt);
 system(@lplist);
 
 This is the context.
 sub search {
   some code
   
   open(REQFILE, /tmp/plotreq.txt) || die sorry, could not open
 /tmp/plotreq.txt;
   some more code to generate content for plotreq.txt
   ..
   close(REQFILE);
    This is where I tried the above to send the file to the printer.
 }
 
 This sub is part of a cgi script that creates output for the browser. The
 browser output is OK.
 The /tmp/plotreq.txt is generated but not being sent to the printer.
 
 Can somebody guide me to do it right ?.
 Thanks
 Raj kairam
 
 

-- 
-
Medi Montaseri   [EMAIL PROTECTED]
Unix Distributed Systems EngineerHTTP://www.CyberShell.com
CyberShell Engineering
-




Re: Running a shell command inside a cgi/perl script

2001-11-30 Thread Brian Reichert

Just to toot my own horn, I'd like to mention that I wrote the
System2 module, with an eye toward running commands, and getting
isolated STDOUT/STDERR as well as exit values.  Well, it makes me
happy.

On Fri, Nov 30, 2001 at 03:45:23PM -0500, J. J. Horner wrote:
 * Kairam, Raj ([EMAIL PROTECTED]) [011130 15:10]:
  In my perl script I have a line like this.
  system( '/usr/bin/lp -dhp4si /tmp/plotreq.txt'  /tmp/plotid.txt);

You've got these quotes wrong: you're executing a command (via Bourne
shell) called '/usr/bin/lp -dhp4si /tmp/plotreq.txt', which I expect
doesn't exist on your system. :)

  I have tried this also and did not work.
  @lplist = (/usr/bin/lp, -dhp4si /tmp/plotreq.txt);
  system(@lplist);

Here, you're passing an argument to 'lp'; the filename it's looking
for is '-dhp4si /tmp/plotreq.txt'.  Again, I doubt that exists on
your system. :)

  
  hp4si is the destination printer.
  /tmp/plotreq.txt  is small text file to be sent to the printer.
  /tmp/plotid.txt is the output of lp command ( just one line to indicate job
  id )to be saved.

  If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt
  it is fine as a command line.

Here, your shell is breaking out the commands/arguments on whitespace,
which is what you were hoping for.

You'd want something like (modulo shell metacharacters, etc.):

  system qw('/usr/bin/lp -dhp4si /tmp/plotreq.txt  /tmp/plotid.txt');

But this doesn't get you STDERR, if there was any sortr of problem.

So, I do this:

  use System2;
  my @args = qw('/usr/bin/lp -dhp4si /tmp/plotreq.txt');
  my ($out, $err) = system2(@args);

You could now check $? for whether or not your invocation to lp failed:

  my ($exit_value, $signal_num, $dumped_core) = System2::exit_status($?);
  warn lp choked!: $err if $exit_value;

And, depending on the success/failure you have all of the output
of lp in STDOUT or STDERR, as appropriate.

  This is the context.
  sub search {
some code

open(REQFILE, /tmp/plotreq.txt) || die sorry, could not open
  /tmp/plotreq.txt;

You should use $! to print _why_ this failed.

some more code to generate content for plotreq.txt
..
close(REQFILE);
 This is where I tried the above to send the file to the printer.
  }

Note that you aren't making use of unique filenames.  This is a
CGI program; you could hypothetically have multiple instances of
this code running at once.

Hope this helps...

  Can somebody guide me to do it right ?.
  Thanks
  Raj kairam

 -- 
 J. J. Horner
 H*,6a686f726e657240326a6e6574776f726b732e636f6d
 ***
 H*,6a6a686f726e65724062656c6c736f7574682e6e6574
 
 Freedom is an all-or-nothing proposition:  either we 
 are completely free, or we are subjects of a
 tyrannical system.  If we lose one freedom in a
 thousand, we become completely subjugated.



-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA Intel architecture: the left-hand path