Re: Re: dynamic update part of a table

2003-06-30 Thread Dennis Stout
> Yeah, I think I am finally getting this...
> so in my template.html file, I write this:
> ...*
>
> and in a perl script, (I am not using sql, in fact, I
> am just reading from a text file) I read from the
> file, assign the proper html tag value* to a variable
> $quote_of_the_day*
> and then I use the line:
> my $template = HTML::Template->new(filename =>
> "tempalte.html");
> to load the template hteml file*
> and do a
> $template->param(QUD => $quote_of_the_day)*
> and finally
> output with
> return $template->output();*
>
> are the points marked by (*) above correct?

Exactly.

> okay...here is another point...say this is my main
> page, I want the user to c it when it browses to
> http://localhost/
> if I am using an Apache2 for win32 server...is it
> possible for the server to call my perl script when
> the user browses to http://localhost/ (no localhost of
> course) ... can u see what my problem is?

Er, yes.  Altho this functionality is sort of broken with Apache 2 and
mod_perl 2  But in a production environment of Apache 1.3.27 and mod_perl
1.27, I have redirected any all input to a subroutine in a script.

Goto http://ttms.stout.dyndns.org and see what you see.  From there, add
anything you like to the URI.

I suggest reading the mod_perl API on the apache website, it tells you how to
use mod_perl with Apache.

I can help you write a RequestHandler to handle it.

Dennis


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: dynamic update part of a table

2003-06-30 Thread Dennis Stout
> okay...here is another point...say this is my main
> page, I want the user to c it when it browses to
> http://localhost/
> if I am using an Apache2 for win32 server...is it
> possible for the server to call my perl script when
> the user browses to http://localhost/ (no localhost of
> course) ... can u see what my problem is?

I might just be thinking WAY to advanced here too.

Might be a way of doing an Apache config for it.

something like


  PermanentRedirect "localhost/cgi-bin/blah.cgi"


Go read up on that, I highly doubt that exact context will work.  And as I
said, I work with Apache 1.3, not 2.0.  They got some more work to do on the
2.0 series yet before I even think about switching...

Dennis


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: dynamic update part of a table

2003-06-30 Thread Ling F. Zhang
> Go read up on that, I highly doubt that exact
context will work.  And as I
> said, I work with Apache 1.3, not 2.0.  They got
some more work to do on the
> 2.0 series yet before I even think about
switching...
I totally agree...the only reason I installed 2.0 in
the first place is I didn't want the trouble of
compiling and installing the WebDAV module...which as
it turns out, never really worked when I try to use m$
w2k's own client...well, that belongs to another forum...

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: dynamic update part of a table

2003-06-30 Thread Dennis Stout
> I totally agree...the only reason I installed 2.0 in
> the first place is I didn't want the trouble of
> compiling and installing the WebDAV module...which as
> it turns out, never really worked when I try to use m$
> w2k's own client...well, that belongs to another forum...


I have a question relevant to this forum.

When will they fix the Apache Request Object in Apache/mod_perl 2.x?

I want my $r god dammit >:|

Dennis


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: dynamic update part of a table

2003-06-30 Thread Ling F. Zhang
> 
>   PermanentRedirect "localhost/cgi-bin/blah.cgi"
> 
This both work and doesn't work...
the correct line should be:
RedirectPermanent /index.html
http://localhost/cgi-bin/blah.cgi

the problem is that the 2nd argument of
RedirectPermanent must be an URL (not a URL
path)...what if someone is browsing my computer using
http://myipaddress/
they will get redirected to, effectively:
http://127.0.0.1/cgi-bin/blah.cgi
this is obviously not cool!  I don't think this is an
apache-version problem...do u think u have a fix?

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl CGI Newbie

2003-06-30 Thread Kristofer Hoch
Mark,
  Try this.  It is completly untested so you may have to tweak it a
bit.
I wrote it this morning before having coffee.

Kristofer
#!/usr/bin/perl
use warnings;
use strict;
use CGI::Carp 'fatalsToBrowser';
use CGI;

sub writeToFile{
  my $result = shift || return; # Returns if undefined
  open(OUTFILE, ">>/home/markus/cgi-bin/chap05/test.txt") || die
"Error: $!";
  print OUTFILE "$result\n";
  close(OUTFILE);  
}

my $WebPage = new CGI;

print $WebPage->header,
 $WebPage->start_html( {-title => 'Test: Write to a file }),
 $WebPage->b("Form"),
 $WebPage->start_form(
-method => 'POST',
-action => 'http://192.168.1.1/cgi-bin/chap05/test.cg',
 ),
 $WebPage->textfield(
-name=>'test',
-default=>'starting value',
-size=>50,
-maxlength=>80),
 $WebPage->end_html;

my $RESULT = $WebPage->param('test') || undef;

writeToFile($RESULT);

--- Mark Anthony Sioting <[EMAIL PROTECTED]> wrote:
> Dear Sirs,
> 
>As instructed, I put quotations on the attributes of my html file
> as follows:
>  
> 1:  
> 2:  
> 3:  Test: Write to a file
> 4:  
> 5:  http://192.168.1.1/cgi-bin/chap05/test.cgi";
> METHOD="POST">
> 6:  Name:
> 7:  
> 8:  
> 9:  
> 10:  
> 
>As you noticed I put the number lines on the scripts here on this
> email for your convinience :)
>Here's the revised perl script as per your instructions:
> 
> 1:   #!/usr/bin/perl
> 2:   use warnings;
> 3:   use CGI::Carp 'fatalsToBrowser';
> 4:   print "Content-type: text/html\n\n";
> 5:   use CGI qw(:all -debug);
> 6:   use strict;
> 7:
> 8:   #Declaration of variable
> 9:   my($test);
> 10: 
> 11:  #Assignment to variable
> 12:  $test = param('Test');
> 13:
> 14:  #save form data to a file
> 15:  open(OUTFILE, ">>/home/markus/cgi-bin/chap05/test.txt") || die
> "Error: $!";
> 16:  print OUTFILE "$test\n";
> 17:  close(OUTFILE);
> 18:
> 19:  print "Test: Write to a
> file\n";
> 20:  print "Thank you $test...";
> 
> 
>Upon running it on my browser, here's the message i got from the 
> browser:
> 
>  Content-type: text/html 
>  Software error:
>  Error: Permission denied at /home/markus/cgi-bin/chap05/test.cgi
> line 15.
> 
>  For help, please send mail to the webmaster ([EMAIL PROTECTED]),
> giving this error message and the time and date  
> of the error. 
> 
> What I did was I changed the permission of my text file, test.txt
> from 744 to 777. After the changes, I can now write to my text file.
> No errors were reported on the html output.
> 
> Thanks a lot for showing me the way to debug. Now, I can move on
> to the next lesson with confidence... Any books u may recommend? or
> articles or tutorials? 
> 
> 
> Thanks,
> 
> Mark Anthony C. Sioting
> 
> -- 
> __
> http://www.linuxmail.org/
> Now with e-mail forwarding for only US$5.95/yr
> 
> Powered by Outblaze
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


=
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++ 
W+++ w PS PE t++ b+ G e r+++ z
--END GEEK CODE BLOCK--

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



suid

2003-06-30 Thread Octavian Rasnita
Hi,


What should I need to do if I want one or more of my CGI programs to be run
by Apache user but in fact to run them by my own account?
I want to do this because I need to upload files, create directories and
other tasks with some programs, and Apache user doesn't have the right
permissions for these.

Thank you.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: suid

2003-06-30 Thread Scot Robnett
I'm not 100% sure of the security ramifications of this, but I believe you
chmod your script to 4711 and change your shebang to #!/usr/bin/perl -w -U.

-
Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]


-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 8:56 AM
To: [EMAIL PROTECTED]
Subject: suid


Hi,


What should I need to do if I want one or more of my CGI programs to be run
by Apache user but in fact to run them by my own account?
I want to do this because I need to upload files, create directories and
other tasks with some programs, and Apache user doesn't have the right
permissions for these.

Thank you.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: perl-modules

2003-06-30 Thread Kevin



> Hello,
> 
> is there a way of finding out, which modules are installed on a remote
> machine using a script?
> 
> there's this scenario:
> 
> I will have a website up soon, with CGI's - but I don't know, what
> modules are installed... so I'd write a script, that shows / lists all
> available modules...
> 
> but how do you do that?


This is a very handy tool that I always use:

http://www.scriptsolutions.com/programs/free/perldiver/




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Regex question.

2003-06-30 Thread Sara
I have a database with the following fields.

lname fnam M acct# mrmbirth Postdate  Post#   drln 
drfn m disch
DOE,JOHN,R,00037839842,207337,02151956,04072003,01980,LastName,FirstName,L,04102003

I have a very simple script which splits the delimiter , and shows the result in the 
same format as in database.
I want to do following things using regex, but I have tried my options to my level 
best, ::) no results yet,

1- Remove all the leading 000 from any field like acct# = 00037839842 should be 
37939842 and Post# should be 1980

2- Want to format dates like birth = 02151956 should be 02/15/1956

Any help??

Thanks,

Sara.