my little stupid script

2002-12-23 Thread max . calvo
Howdy; 

I am in the beginning stages to get mod_perl in my head. This is my second 
script after the Hello There script. I am trying ot get my little stupid 
script to work. What I am trying ot do is fairly simple; I thought. I am 
just trying to get the server to print the numbers from 1 to 10. Here is the 
script that I have been working for 5 days. Please help and thank you in 
advnaced. 


#!/user/bin/perl -w 

use strict; 

my $r = shift; 

$r-send_http_header('text/plain'); 

for (my $i = 0 ; $i  10; $i++) {
print $i\n;
}
1; 


thanks 


-max


Re: my little stupid script

2002-12-23 Thread max . calvo
Honza Pazdziora writes: 

On Mon, Dec 23, 2002 at 02:34:52PM -0500, darren chamberlain wrote:

* [EMAIL PROTECTED] [EMAIL PROTECTED] [2002-12-23 14:31]:
 I am in the beginning stages to get mod_perl in my head. This is my second 
 script after the Hello There script. I am trying ot get my little stupid 
 script to work. What I am trying ot do is fairly simple; I thought. I am 
 just trying to get the server to print the numbers from 1 to 10. Here is 
 the script that I have been working for 5 days. Please help and thank you 
 in advnaced. 
 
 
 #!/user/bin/perl -w 
 usr? 

 use strict; 
 
 my $r = shift; 

But first of all the question is if this code is run in an environment
where this shift will return Apache-request object. 

--

 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
  ... all of these signs saying sorry but we're closed ...





Thank you all. I got it working. And yes I am using Apache:Registry for my 
server configuration. The problem was with the logic in the 'for loop'. 

Thank you all again 

-Max


Re: Blank pages

2002-03-04 Thread max . calvo

Ged Haywood writes:

 Hi there, 
 
 On Fri, 1 Mar 2002, Axel Andersson wrote: 
 
 I run a mod_perl/mysql site, which works fine most of the time. Some
 pages, however, come out completely blank. Reload.. and hey presto,
 [snip]
 Well, it's a longshot, but thanks anyway.
 
 Another long shot, do you always specify full paths to files in your code?

 
 If you don't get anywhere with that then I'd suggest looking at the debugging
 section of the Guide: http://prel.apache.org/guide and/or peppering your code
 at strategic places with 'print STDERR $something_useful\n' statements. 
 
 73,
 Ged. 
 
 

 

I have been getting the same problems with  the same setup ( Mod_Perl / 
MySQL). But I am having a little fun with this setup. I populated a small 
table in the 'test' DB in MySQL withe the contents of 
'/usr/local/share/dict/propernames'. I then have the script to randomly 
chose an id from the DB table and then to select a row of info. I will post 
the scipt contents and some debugging data to give some more info on the 
internal processes. 

The Script is : 

 1 package DBNE;
 2
 3 use strict;
 4 use vars qw($DBH);
 5 use Apache;
 6 #use Apache::File;
 7 use DBI();
 8
 9 sub handler {
10 $DBH = DBI-connect(DBI:mysql:test,webuser,mult1scan) 
|| die $DBH-errstr;
11 my $r = shift;
12 my $h = $DBH-trace(5,/tmp/DBI.log);
13
14 $r-send_http_header;
15 my $sth = $DBH-prepare(SELECT MAX(id) FROM webtest);
16 $sth-execute;
17 my ($id) = $sth-fetchrow;
18
19 my $sth = $DBH-prepare(SELECT * FROM webtest WHERE id = 
ROUND( (RAND() * $id) + 1));
20 $sth-execute;
21
22 my ($id,$name,$last,$town) = $sth-fetchrow;
23 $r-print($id\t\t $name\t\t $last\t\t $town \n);
24 $sth-finish;
25
26 }
27
28 1; 

The debuging info is: 


 - DESTROY= undef at /home/mcalvo/ModPerl/DBNE.pm line 11
   DBI::db=HASH(0x81faf3c) trace level set to 5 in DBI 1.20-nothread
   Note: perl is running without the recommended perl -w option
   - prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT 
MAX(id) FROM webtest')
   dbih_setup_handle(DBI::st=HASH(0x8156390)=DBI::st=HASH(0x81e90d8), 
DBD::mysql::st, 81faef4, Null!)
   dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Err, DBI::db=HASH(0x81faf3c)) 
SCALAR(0x818bc78) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), State, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Errstr, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Handlers, 
DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Debug, 
DBI::db=HASH(0x81faf3c)) 5 (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), FetchHashKeyName, 
DBI::db=HASH(0x81faf3c)) 'NAME' (already defined)
Setting mysql_use_result to 0
   - prepare= DBI::st=HASH(0x8156390) at /home/mcalvo/ModPerl/DBNE.pm line 
15
   - execute for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8)
   - dbd_st_execute for 081fac90
   - dbd_st_execute 1 rows
   - execute= 1 at /home/mcalvo/ModPerl/DBNE.pm line 16
   - fetchrow for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8)
   - dbd_st_fetch for 081fac90, chopblanks 0
   dbih_setup_fbav for 1 fields = 0x8135854
 Storing row 0 (1323) in 081fae64
   - dbd_st_fetch, 1 cols
   - fetchrow= ( '1323' ) [1 items] row1 at /home/mcalvo/ModPerl/DBNE.pm 
line 17
   - prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT 
* FROM webtest WHERE id = ROUND( (RAND() * 1323) + 1)')
   dbih_setup_handle(DBI::st=HASH(0x81faf90)=DBI::st=HASH(0x81faf24), 
DBD::mysql::st, 81faf78, Null!)
   dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Err, DBI::db=HASH(0x81faf3c)) 
SCALAR(0x818bc78) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), State, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Errstr, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Handlers, 
DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Debug, 
DBI::db=HASH(0x81faf3c)) 5 (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), FetchHashKeyName, 
DBI::db=HASH(0x81faf3c)) 'NAME' (already defined)
Setting mysql_use_result to 0
   - prepare= DBI::st=HASH(0x81faf90) at /home/mcalvo/ModPerl/DBNE.pm line 
19
   - execute for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24)
   - dbd_st_execute for 081e9084
   - dbd_st_execute 0 rows
   - execute= '0E0' at /home/mcalvo/ModPerl/DBNE.pm line 20
   - fetchrow for DBD::mysql::st 

Re: Mod_perl tutorials

2000-12-15 Thread Max Calvo

Hi all;

This is my first post in this mailing list. I am very interested in helping
out getting the modperl tutorials out. I have experience with Photoshop,
Illustrator and M$Office. I can help with the slices and web design.

Please let me know where I can help out.

-Max

- Original Message -
From: "Nathan Torkington" [EMAIL PROTECTED]
To: "mod_perl list" [EMAIL PROTECTED]
Sent: Thursday, December 14, 2000 10:06 AM
Subject: Re: Mod_perl tutorials


 Gunther Birznieks writes:
  However, I am willing to concede that as a first cut, fancy slides are
  probably not worth it because the slides will change too often. Once v1
is
  released, then someone can transcribe the slides to PPT (or maybe a tool
  will exist by then) as a "stable release" if they want to (probably
someone
  like me.)

 Getting anything done with a mailing list full of programmers is
 nearly impossible.  Everyone wants to write tools, but nobody has said
 "give me the slides for a week and I'll make them better".  Instead
 we're arguing about the best source format :-)

 I developed the slides in a POD-like slide format that Tom
 Christiansen uses.  One of his trainers developed a slide2rtf
 converter, and the rtf can then be imported into PowerPoint.  That
 doesn't work with StarOffice, as importing RTF immediately drops you
 into the WordProcessor.

 I think that my slides are pretty close to a v1.  I don't know that
 the subsequent tweaks will be worth the hassle of PPT conversion.

 I'd rather not revert back to the POD-like format.  Importing into PPT
 is a pain in the arse.  I'd rather find someone who wants to work on
 the class and say "ok, it's yours for a week--fix it".

 So consider this a call to arms: anyone with StarOffice/Powerpoint
 want to bang on the class?

 Nat





Re: mod_perl tutorials

2000-12-15 Thread Max Calvo

I would like to offer my services as HTML coder for the website. I Also have
experience with Adobe Photoshop and Illustrator.


-Max