Re: Error messages with OSX Perl (still learning)

2004-12-20 Thread Albert Kaltenbaeck
Sorry, I was having a bad search day.
Found the following which works.
#!/usr/bin/perl
 use CGI::Carp qw( fatalsToBrowser );
  
 print "Content-type: text/html\n\n";
 print "Test Page";
 print "Hello World!"
 print "";
Thank You!
On Dec 20, 2004, at 4:23 PM, Albert Kaltenbaeck wrote:
I am converting MacPerl scripts to be used under OSX and having good 
success.

When I have a script error, I am directed to a web page  
"http://foo.example.com/cgi-bin/tester"; and a message that it can't 
find that site.

I have learned to leave the OSX server web error log open and the 
message of the problem is indicated there.

Is there a way to get a popup of some kind, instead of the redirect to 
"http://foo.example.com/cgi-bin/tester"; which displays the error 
directly?

The other works but I got to believe there is an easier way.
Any books or websites related to setting-up/customizing perl?
Albert

Albert Kaltenbaeck
15324 West 144th Terrace
Olathe, Kansas 66062
(913) 780-3835 Home
(913) 206-4579 Cell


Error messages with OSX Perl (still learning)

2004-12-20 Thread Albert Kaltenbaeck
I am converting MacPerl scripts to be used under OSX and having good 
success.

When I have a script error, I am directed to a web page  
"http://foo.example.com/cgi-bin/tester"; and a message that it can't 
find that site.

I have learned to leave the OSX server web error log open and the 
message of the problem is indicated there.

Is there a way to get a popup of some kind, instead of the redirect to 
"http://foo.example.com/cgi-bin/tester"; which displays the error 
directly?

The other works but I got to believe there is an easier way.
Any books or websites related to setting-up/customizing perl?
Albert


Re: HTML::TableExtract

2004-12-20 Thread Joseph Alotta
Thank you Matt.  This was what I was needing.
Joe.
On Dec 20, 2004, at 2:38 PM, Matt Sisk wrote:
Hi Joe,
You can do that two ways. One, you could check to see if any tables 
matched:

 if ($te->table_states) {
   ...
 }
Since you seem to be expecting only a single matched table in the 
document, however, the table extract object behaves the same as the 
single table state. So you can just check for rows:

 if ($te->rows) {
   ...
 }
Let me know if that doesn't work for you.
Cheers,
Matt
Joseph Alotta wrote:
Greetings,
I am using the TableExtracter and it bombs in the line marked with 
">>" when it don't match headers for the table.  I would like to 
check to see if it matched, but I don't know what to check.  Can 
someone please help me.

my $html = get($url) || warn "Can't fetch $url\n";
print "$string\n";
my $te = new HTML::TableExtract( headers => ["1 Year", "3 Year", 
"5 Year", "10 Year"] );
$te->parse($html);
  >>  my $p  = ($te->rows)[0];

my ( $one, $three, $five, $ten) = @$p;
Joe Alotta




Re: HTML::TableExtract

2004-12-20 Thread Sherm Pendley
OT for [EMAIL PROTECTED] - the answer is the same regardless of the OS 
you happen to be using. This would be more appropriate for a general 
Perl forum, perhaps comp.lang.perl.modules. Having said that...

On Dec 20, 2004, at 3:26 PM, Joseph Alotta wrote:
I am using the TableExtracter and it bombs in the line marked with 
">>" when it don't match headers for the table.
Define "bombs". Do you get an error message? If so, what is it?
I would like to check to see if it matched, but I don't know what to 
check.  Can someone please help me.

my $te = new HTML::TableExtract( headers => ["1 Year", "3 Year", 
"5 Year", "10 Year"] );
$te->parse($html);
  >>  my $p  = ($te->rows)[0];
You're pretty much asking for errors here, by subscripting the return 
value from a method that might return an empty list. You should check 
it first:

my @table_rows = $te->rows();
if (@table_rows) {
my ($one, $three, $five, $ten) = @{$table_rows[0]};
}
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


HTML::TableExtract

2004-12-20 Thread Joseph Alotta
Greetings,
I am using the TableExtracter and it bombs in the line marked with ">>" 
when it don't match headers for the table.  I would like to check to 
see if it matched, but I don't know what to check.  Can someone please 
help me.

my $html = get($url) || warn "Can't fetch $url\n";
print "$string\n";
my $te = new HTML::TableExtract( headers => ["1 Year", "3 Year", "5 
Year", "10 Year"] );
$te->parse($html);
  >>  my $p  = ($te->rows)[0];

my ( $one, $three, $five, $ten) = @$p;
Joe Alotta


Re: Trying to Install Bundle::DBD::mysql

2004-12-20 Thread Chris Devers
On Mon, 20 Dec 2004, Sherm Pendley wrote:

> No, it doesn't matter what user you use to grant the privileges. If 
> 'mysqluser' is your normal admin user, just log in to the mysql shell 
> as that user:
> 
> mysql -u mysqluser -p
> 
> For that matter, you could use phpMyAdmin to grant the privileges too. 
> The important part is that the user '[EMAIL PROTECTED]' needs full access 
> to the database 'test' - how you grant it that access is incidental.

To clarify, '[EMAIL PROTECTED]' is an account with the MySQL database.

It has no relation at all to the system 'root' account on your computer.

MySQL has its own set of accounts which generally have no connection to 
the ones on the system that the database server is running on. 

 

-- 
Chris Devers


Re: Trying to Install Bundle::DBD::mysql

2004-12-20 Thread Sherm Pendley
On Dec 20, 2004, at 9:05 AM, Lola Lee wrote:
Sherm Pendley said the following on 12/20/04 7:00 AM:
mysql> grant all privileges on test.* to '[EMAIL PROTECTED]';
Query OK, 0 rows affected (0.22 sec)

Odd . . . when I did this I got:
ERROR 1044: Access denied for user: '@localhost' to database 'test'
When I went into phpMyAdmin this is what I saw:
MySQL 4.0.20-standard running on localhost as [EMAIL PROTECTED]
I'd set up an user 'mysqluser' that is only allowed to access Mysql.  
So it looks like I need to set up root to access Mysql - is that 
correct?
No, it doesn't matter what user you use to grant the privileges. If 
'mysqluser' is your normal admin user, just log in to the mysql shell 
as that user:

mysql -u mysqluser -p
For that matter, you could use phpMyAdmin to grant the privileges too. 
The important part is that the user '[EMAIL PROTECTED]' needs full access 
to the database 'test' - how you grant it that access is incidental.

sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Re: Trying to Install Bundle::DBD::mysql

2004-12-20 Thread Lola Lee
Sherm Pendley said the following on 12/20/04 7:00 AM:
mysql> grant all privileges on test.* to '[EMAIL PROTECTED]';
Query OK, 0 rows affected (0.22 sec)

Odd . . . when I did this I got:
ERROR 1044: Access denied for user: '@localhost' to database 'test'
When I went into phpMyAdmin this is what I saw:
MySQL 4.0.20-standard running on localhost as [EMAIL PROTECTED]
I'd set up an user 'mysqluser' that is only allowed to access Mysql.  So 
it looks like I need to set up root to access Mysql - is that correct?

--
Lola - mailto:[EMAIL PROTECTED]
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Terrorism delenda est! (Terrorism must be destroyed utterly!)
I'm in Bowie, MD, USA, halfway between DC and Annapolis.


Re: Trying to Install Bundle::DBD::mysql

2004-12-20 Thread Sherm Pendley
On Dec 15, 2004, at 2:29 PM, Lola Lee wrote:
Several tests failed because access was denied, for instance:
t/mysql2...Mysql connect('database=test;host=','',...) failed: 
Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) at 
t/mysql2.t line 29

What else should I do to get this to run as should be?
The problem is that the self-tests are run by root, and root normally 
requires a password to connect to mysql.

You have two options: The simplest is to grant [EMAIL PROTECTED] full 
access to the "test" database, without requiring a password. In the 
mysql shell:

mysql> grant all privileges on test.* to '[EMAIL PROTECTED]';
Query OK, 0 rows affected (0.22 sec)
The second option is more complicated. You can start the CPAN shell 
with 'perl -MCPAN -e shell', and use the 'look DBD::mysql' command from 
there. That will download and unzip the latest module source, and open 
up a sub-shell in the source directory. From there, you can run 'perl 
Makefile.PL' using any of the options listed in INSTALL.html.

For example, to specify the database, user name and password to use, 
you'd run 'Makefile.PL' like this:

perl Makefile.PL --testdb=test --testuser=somebody 
--testpassword=blah

sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org