CGI scripts, security and MySQL

2004-09-03 Thread michael watson (IAH-C)
Hi

I need to know what is the accepted way of handling the following.  I
have a MySQL database, and a host of CGI scripts which present forms to
the users as web pages, they fill them in and then the data is written
to the database.  I need to make this secure such that only users I want
can use the system.  I want to set up a username and password so that
users can log in once at the beginning of a session, carry out their
work filling in various forms and writing to the database, and then
log-out at the end.

What is the best way to do this?  I've thought about creating a MySQL
user/password for each person who needs to enter data, but I don't want
them to have to enter their username and password on every form.  I
guess what I need is some sort of persistant DBI connection that is
present over multiple runs of various CGI scripts (until the person logs
off or the browser is closed...)

I am running Suse Linux 8.2, MySQL 4, Apache 1.3.28 and perl 5.8.0

Cheers
Mick

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: ODBC

2004-09-03 Thread Ron Goral


 -Original Message-
 From: Wiggins d Anconia [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 01, 2004 8:33 AM
 To: Rearick, Kenneth N.; '[EMAIL PROTECTED]'
 Subject: Re: ODBC


 
 
 
  I have a CGI program in which I am trying to access a database. When I
 run the code in active state feeding it the input from the form it runs
 fine. When I try to run it as a cgi from IE using Apache web server the
 data from the form comes in fine but it can not seem to attach to the
 database.
 
  Is there anyway to see the errors that the DBI:ODBC is generating when
 the application is being run from the server? Any ideas why the ODBC
 connect is failing?
 

 You can use CGI::Carp and 'fatalsToBrowser' to have fatal messages
 thrown to the browser, alternatively error messages are generally sent
 to the Apache error log.  Check there for what they have to say. You
 could also turn off DBI's automatic exceptions and catch them yourself,
 but this is a fair amount more work (at least while prototyping).

  $dbh = DBI-connect(DBI:ODBC:$SERVER, $USER, $PASSWORD);
 
 

 Sorry can't help with the connect issue, I suspect if you can find the
 error output it will.  If not you might try the dbi-users group or maybe
 someone else with ODBC experience will chime in.

 http://danconia.org


CGI::Carp may not capture errors that occur in the DBI module. However, DBI
has a built in logging functionality called trace which allows you to
specify the level of detail you want to see as well as specify where you
want the trace output stored.  Note that trace will log everything that is
being done in the name of DBI, so be prepared to wade through alot of info.
Though I would recommend reading the entire documentation, atleast go to
this address and check out this function:

http://search.cpan.org/~timb/DBI-1.43/DBI.pm#TRACING

HTH,
Peace in Christ -
Ron Goral



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: CGI scripts, security and MySQL

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, michael watson (IAH-C) wrote:
I need to make this secure such that only users I want can use the 
system.  I want to set up a username and password so that users can 
log in once at the beginning of a session, carry out their work 
filling in various forms and writing to the database, and then log-out 
at the end.

What is the best way to do this?  I've thought about creating a MySQL 
user/password for each person who needs to enter data, but I don't 
want them to have to enter their username and password on every form. 
I guess what I need is some sort of persistant DBI connection that is 
present over multiple runs of various CGI scripts (until the person 
logs off or the browser is closed...)

I am running Suse Linux 8.2, MySQL 4, Apache 1.3.28 and perl 5.8.0
Think about what your requirements are here; you seem to have a grab bag 
of good ideas that are all mixed up together.

* System authentication
You're asking for a way to avoid making people fill out their username  
password with each form. A proper authentication system won't allow this 
situation. The two basic ways you can do authentication are at the 
server level, with Apache-enforced HTTP authentication (this is the 
version where the, and at the application level, with code in your CGI 
scripts that manages user account details.

I personally think Apache-level authentication is easier -- if you just 
add the right directives to your httpd.conf, it's magically turned on 
for you. For whatever reason though, this isn't often done these days -- 
it's more popular to reinvent this particular wheel over and over again.

If you go for the more popular application level logins, the general 
approach will mean storing the user's account name in a cookie, and then 
checking this cookie with each request. As long as the cookie has the 
right information, they won't have to log in with each page -- it will, 
in effect, do that automatically in the background.

* Database users:
I suspect it's not so important to control who's user account is writing 
to the database, as much as it is to know who wrote what data in the 
database. Make sense? With that in mind, you could do either or both of 
[a] add fields to the tables that note who last touched each row, or 
(probably better) [b] maintain a log of what changes are being made and 
by who -- this log could even be as simple as a datestamp, the user 
name, and the SQL statement.

This should make maintainence of the database easier, as you don't have 
to maintain separate MySQL accounts for each user along with the other 
accounts they are going to need.

* DBI connection persistence:
It makes sense to maintain a connection to the database, but not so much 
because of user access control considerations, but just for performance: 
being able to avoid building up  tearing down a DB connection with 
every page view gets very expensive. The best way to get around this is 
probably to use mod_perl instead of regular CGI scripts, and then turn 
on Apache::DBI for database connection pooling. This can help a lot.

Does this help ? More questions ?

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Mr. Loh's Not Afraid to Be Naked'
 by Sandra Tsing Loh
 from 'This American Life: Lies, Sissies, and Fiascoes'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI scripts, security and MySQL

2004-09-03 Thread Octavian Rasnita
Hi,

You can put something like this, in httpd.conf file:

include ...path_to_file

And make the directory where sits that file readable only by the root user.

Then, in that file, put something like:

SetEnv usr user_name
SetEnv pass parolissima

Those 2 environment variables will be seen by any script that runs on that
server.

If you want them to be seen only by the scripts which are ran by a certain
virtualhost, put that  include line between virtualhost... and
/virtualhost.

T

- Original Message - 
From: Chris Devers [EMAIL PROTECTED]
To: michael watson (IAH-C) [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, September 03, 2004 3:08 PM
Subject: Re: CGI scripts, security and MySQL


 On Fri, 3 Sep 2004, michael watson (IAH-C) wrote:

  I need to make this secure such that only users I want can use the
  system.  I want to set up a username and password so that users can
  log in once at the beginning of a session, carry out their work
  filling in various forms and writing to the database, and then log-out
  at the end.
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: CGI scripts, security and MySQL

2004-09-03 Thread Octavian Rasnita
No, the environment variables are set a single time at the start (or
restart) of the web server.
The problem is that if there is any change in httpd.conf file, the server
must be restarted and this might not be very easy for a system with very
many users, but it is not impossible.
Teddy


- Original Message - 
From: Chris Devers [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; michael watson (IAH-C)
[EMAIL PROTECTED]
Sent: Friday, September 03, 2004 3:31 PM
Subject: Re: CGI scripts, security and MySQL


 On Fri, 3 Sep 2004, Octavian Rasnita wrote:

  You can put something like this, in httpd.conf file:
 
  include ...path_to_file
 
  And make the directory where sits that file readable only by the root
user.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: CGI scripts, security and MySQL

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, Octavian Rasnita wrote:
No, the environment variables are set a single time at the start (or
restart) of the web server.
Ok, that's what I thought.
So in what way does this help manage a pool of several users?
This seems to be a solution in search of some other problem...

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Drama Bug'
 by David Sedaris
 from 'This American Life: Lies, Sissies, and Fiascoes'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI scripts, security and MySQL

2004-09-03 Thread Octavian Rasnita
This might be helpful for more users, because a system admin can create
automaticly a special dir where the users can put their config files, and
insert that file in httpd.conf.
After that, every user can create its own config file, with any variables
they want (their names should not be only user and pass), and after that
chmod that special dir in order to be viewd only by the root.

T

Teddy

- Original Message - 
From: Chris Devers [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; michael watson (IAH-C)
[EMAIL PROTECTED]
Sent: Friday, September 03, 2004 3:56 PM
Subject: Re: CGI scripts, security and MySQL



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: ODBC

2004-09-03 Thread Rearick, Kenneth N.
Thanks for the help. It turned out to be a setup problem with ODBC the DNS was in the 
user area not the system. But the information on tracing errors help identify where 
the problem was located. 

-Original Message-
From: Ron Goral [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 03, 2004 6:35 AM
To: Rearick, Kenneth N.; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: ODBC



 -Original Message-
 From: Wiggins d Anconia [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 01, 2004 8:33 AM
 To: Rearick, Kenneth N.; '[EMAIL PROTECTED]'
 Subject: Re: ODBC


 
 
 
  I have a CGI program in which I am trying to access a database. When I
 run the code in active state feeding it the input from the form it runs
 fine. When I try to run it as a cgi from IE using Apache web server the
 data from the form comes in fine but it can not seem to attach to the
 database.
 
  Is there anyway to see the errors that the DBI:ODBC is generating when
 the application is being run from the server? Any ideas why the ODBC
 connect is failing?
 

 You can use CGI::Carp and 'fatalsToBrowser' to have fatal messages
 thrown to the browser, alternatively error messages are generally sent
 to the Apache error log.  Check there for what they have to say. You
 could also turn off DBI's automatic exceptions and catch them yourself,
 but this is a fair amount more work (at least while prototyping).

  $dbh = DBI-connect(DBI:ODBC:$SERVER, $USER, $PASSWORD);
 
 

 Sorry can't help with the connect issue, I suspect if you can find the
 error output it will.  If not you might try the dbi-users group or maybe
 someone else with ODBC experience will chime in.

 http://danconia.org


CGI::Carp may not capture errors that occur in the DBI module. However, DBI
has a built in logging functionality called trace which allows you to
specify the level of detail you want to see as well as specify where you
want the trace output stored.  Note that trace will log everything that is
being done in the name of DBI, so be prepared to wade through alot of info.
Though I would recommend reading the entire documentation, atleast go to
this address and check out this function:

http://search.cpan.org/~timb/DBI-1.43/DBI.pm#TRACING

HTH,
Peace in Christ -
Ron Goral


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: CGI scripts, security and MySQL

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, Octavian Rasnita wrote:
This might be helpful for more users, because a system admin can 
create automaticly a special dir where the users can put their config 
files, and insert that file in httpd.conf.

After that, every user can create its own config file, with any 
variables they want (their names should not be only user and 
pass), and after that chmod that special dir in order to be viewd 
only by the root.
This is all nice to know, but it doesn't appear to have anything at all 
to do with the questions that the guy was asking.

He wants web site user accounts, with control /or a record of who is 
doing what in the database.

He wants some kind of database connection persistance.
He is not trying to set environment variables in Apache.
It isn't obvious how setting variables like this gets him anywhere near 
the stated requirements of the system.


--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Christmas Freud'
 by David Rakoff
 from 'This American Life: Lies, Sissies, and Fiascoes'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Problems installing DBD-Interbase on Fedora

2004-09-03 Thread Cristi Ocolisan
Hi, everybody!

I have to work with FireBird database, for a project of mine.

I grabbed from CPAN a DBD-InterBase (version 0.43) to work with, and
installed it on Windows. It works perfectly. 

I also installed it on Red Hat 9 at my work place and it works very well.
The problems started when I tried to install DBD-Interbase on Fedora, at my
client's place.

I get the same error no matter what version of DBD-Interbase I use.

When I type make I get the following error:

Error: Cannot parse function definition from 'strEQ(item, #name)) { \' in
Interbase.xs, line 478 ' in Interbase.xs, line 487n definition from'
keyname = #name;
make: *** [InterBase.c] Error 1


Can anyone tell me where is the problem or what does this error message
mean?

Or what can I do, to make it work? 

Any help is highly appreciated.
Cristi Ocolisan.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




can´t call method xyz on an undefined value at...

2004-09-03 Thread Bastian Angerstein

Good Morning,

I, once again, have a question.

How can I check if a Method is undefined or not without getting this error?




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Inserting short strings into longer strings -- strncpy in Perl?

2004-09-03 Thread Charles K. Clarkson
From: Jeff 'japhy' Pinyan mailto:[EMAIL PROTECTED] wrote:

: On Sep 3, Edward Wijaya said:
: 
: : @arr1 =('GATGGATTAAAGGAGAGGTACTTACAGG',
: : 'CGCCCAAGAGGCCAGAGCGGAGCA',
: : 'CGTTAATGCATTAAAGTTCT');
: : 
: :@arr2 = ('tcctcta',
: : 'aggccac',
: : 'agctgcg');
: : 
: : 
: : Is there any efficient way to copy each element
: : of @arr2 as part of each elements in @arr1
: : such that it gives result:
: : 
: : @arr3 =('GAtcctctaAAGGAGAGGTACTTACAGG',
: : 'CGCCCAAGAGGCCAGaggccacCA',
: : 'CGTTAAagctgcgAAGTTCT');
: 
: Use substr($str, $pos, 0, $addition) to insert $addition into
: $str at position $pos. 
: 
:   $a = perl;
:   $b = t ea;
:   substr($a, 2, 0, $b);
:   print $a;  # pet earl
: 
: To get a random position, I'd use:
: 
:   substr($big, rand(length $big), 0, $small);

@array3 indicates the string was to overwrite at a
random position. I assume the entire string must be inside
the result.

my $start = length( $big ) - length( $small ) + 1;

substr( $big, rand $start, length $small ) = $small;


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: screensaver prevention

2004-09-03 Thread JP
 Why not just change it in the system settings?
Because my administrator turned off the permissions to change te settings


 If that's not good enough, why not have Perl poke at the registry so
 that it can change the system settings?
I don't want to poke around on somebody elses system; it is not mine but a
customer's

 Why use Perl for this,
because its fun! and because I know I can do it if I just know which module
to use to easily move the pointer around.

 or any scripting language for that matter?
I don't know any other scripting language on windows

of course I can ty my mobile phone to the mouse and call myself every few
minutes. that way the mouse moves just a little bit by the vibration of the
phone. but then agian, although it is fun aswell, I don't consider it wise
to let my mobile lay around my  office desk  when nobody (trusted) is around
;o)

JP



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: can´t call method xyz on an undefined value at...

2004-09-03 Thread Charles K. Clarkson
Bastian Angerstein [EMAIL PROTECTED] wrote:

: How can I check if a Method is undefined or not without
: getting this error?


Assuming you mean the method to an object. Use the
UNIVERSAL method 'can'.


use CGI;
my $q = CGI-new();
print method 'xyz' invalid for '\$q'\n unless $q-can( 'xyz' );
print method 'xyz' valid for '\$q'\n;

__END__

use CGI ('xyz');
my $q = CGI-new();
print method 'xyz' invalid for '\$q'\n unless $q-can( 'xyz' );
print method 'xyz' valid for '\$q'\n;

__END__


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




can´t call method xyz on an undefined value at...

2004-09-03 Thread Bastian Angerstein
Now I gate can´t call methode can on an undefined value xyz line xyz.
Any Idea?


-Ursprüngliche Nachricht-
Von: Charles K. Clarkson [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 3. September 2004 10:37
An: 'Bastian Angerstein'; 'Mailinglist Perl Beginners'
Betreff: RE: can´t call method xyz on an undefined value at...


Bastian Angerstein [EMAIL PROTECTED] wrote:

: How can I check if a Method is undefined or not without
: getting this error?


Assuming you mean the method to an object. Use the
UNIVERSAL method 'can'.


use CGI;
my $q = CGI-new();
print method 'xyz' invalid for '\$q'\n unless $q-can( 'xyz' );
print method 'xyz' valid for '\$q'\n;

__END__

use CGI ('xyz');
my $q = CGI-new();
print method 'xyz' invalid for '\$q'\n unless $q-can( 'xyz' );
print method 'xyz' valid for '\$q'\n;

__END__


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: screensaver prevention

2004-09-03 Thread JP
Here is what I've been trying:

#!perl

use warnings;
use strict;

use Win32::API;
use Tk::CursorControl;

$cursor-moveto(0, 0, -time=1000);

but I receive an error:

Global symbol $cursor requires explicit package name at D:\tmp\ste.pl line
9.
Execution of D:\tmp\ste.pl aborted due to compilation errors.



Jp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  Why not just change it in the system settings?
 Because my administrator turned off the permissions to change te settings

 
  If that's not good enough, why not have Perl poke at the registry so
  that it can change the system settings?
 I don't want to poke around on somebody elses system; it is not mine but a
 customer's

  Why use Perl for this,
 because its fun! and because I know I can do it if I just know which
module
 to use to easily move the pointer around.

  or any scripting language for that matter?
 I don't know any other scripting language on windows

 of course I can ty my mobile phone to the mouse and call myself every few
 minutes. that way the mouse moves just a little bit by the vibration of
the
 phone. but then agian, although it is fun aswell, I don't consider it wise
 to let my mobile lay around my  office desk  when nobody (trusted) is
around
 ;o)

 JP





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Hi

2004-09-03 Thread Anish Kumar K.
Hi

I am Beginner in perl..Can any one sugges some sample programs of PERL where I can 
build the skills. Please let me know at the earliest. Thanks

Anish


RE: can´t call method xyz on an undefined value at...

2004-09-03 Thread Charles K. Clarkson
Bastian Angerstein [EMAIL PROTECTED] wrote:

: Now I gate can´t call methode can on an undefined
: value xyz line xyz. Any Idea?
 

Show us your code.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: screensaver prevention

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, JP wrote:
Here is what I've been trying:
It's good that your using 'use strict', but you have to be aware that 
this changes how you have to write your code. The 'use strict' pragma 
forces you to explicitly declare variables by prefixing them with my 
the first time they are used.

Therefore, the fix is simply to edit this line:
$cursor-moveto(0, 0, -time=1000);
to look like this instead:
my $cursor-moveto(0, 0, -time=1000);
That should get you past this error.

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Mr. Loh's Not Afraid to Be Naked'
 by Sandra Tsing Loh
 from 'This American Life: Lies, Sissies, and Fiascoes'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: screensaver prevention

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, JP wrote:
Why not just change it in the system settings?
Because my administrator turned off the permissions to change te settings
Ok, that changes everything. This was worth mentioning in your first 
mail! :-)


--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Mr. Loh's Not Afraid to Be Naked'
 by Sandra Tsing Loh
 from 'This American Life: Lies, Sissies, and Fiascoes'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Hi

2004-09-03 Thread Bob Showalter
Anish Kumar K. wrote:
 Hi

Welcome.

 
 I am Beginner in perl..Can any one sugges some sample programs of
 PERL where I can build the skills. Please let me know at the
 earliest. Thanks  

Start at http://learn.perl.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Where to get Math-TrulyRandom for PPM?

2004-09-03 Thread Edward WIJAYA
Hi,
I've tried all the repositories
as suggested by Active State documentation,
including Jenda's repository.
But I always encounter error message
Fail to download...
Hope to hear from you guys again.
Regards
Edward WIJAYA
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Inserting short strings into longer strings -- strncpy in Perl?

2004-09-03 Thread Edward WIJAYA

@array3 indicates the string was to overwrite at a
random position. I assume the entire string must be inside
the result.

Yes, you are right Charles.
And thanks so much too for Gunnar and Jeff.
Best,
Edward WIJAYA
SINGAPORE
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Problems installing DBD-Interbase on Fedora

2004-09-03 Thread Chris Devers
On Fri, 3 Sep 2004, Cristi Ocolisan wrote:
When I type make I get the following error:
Error: Cannot parse function definition from 'strEQ(item, #name)) { \' in
Interbase.xs, line 478 ' in Interbase.xs, line 487n definition from'
keyname = #name;
make: *** [InterBase.c] Error 1
Can anyone tell me where is the problem or what does this error 
message mean?
This sounds like a possible problem with the module itself, but I don't 
know anything about Interbase, so I'm not sure where to start.

You may have better luck by trying either the DBI list, or if you get no 
help there, contact the module authors directly.

Information on the DBI users list is available here:
http://lists.perl.org/showlist.cgi?name=dbi-users
http://www.mail-archive.com/[EMAIL PROTECTED]/
According to CPAN.org, DBD::Interbase was written by Edwin Pratomo 
[EMAIL PROTECTED] and Daniel Ritz [EMAIL PROTECTED]:

http://search.cpan.org/~edpratomo/DBD-InterBase-0.43/InterBase.pm
It may also be worth contacting these two for suggestions.
Or maybe someone here will speak up, but I think in this case you'll 
have more luck by going to the module specific list for advice...

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'The Greatest Phone Message of All Time'
 by Jonathan Goldstein
 from 'This American Life: Crimebusters and Crossed Wires'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



newbie question about regex

2004-09-03 Thread Maurice Lucas
Hello,
I call my script with the following line
$ ./count.pl /var/log/file text
this works fine but sometimes the text is foo(bar) and then my scripts 
gives an error.
syntax error near unexpected token `foo(b'

Could somebody give me a hint?
I'm working on linux
My script

#!/usr/bin/perl
use strict;# Always use strict
use warnings;  # Very helpful, especially if you are new to Perl
die No argument\n if ( @ARGV == 0 );
#my $logfile = /var/log/qmail/smtpd/rejects/[EMAIL PROTECTED] 
/var/log/qmail/smtpd/rejects/current;
my $logfile = $ARGV[0];
my $string = $ARGV[1];
my $tai_cmd = /usr/local/bin/tai64n2tai;
my $count = 0;

my $now = time;
my $before = $now-86400;
# Open a file like this
open( LOG, cat $logfile|$tai_cmd| ) or die Cannot open '$logfile': $!\n;
while( LOG ) {
   my $line = $_;# $_ contains the current line of LOG
   my $entrytime = substr($line,0,10);
   if ($entrytime = $now  $entrytime = $before) {
   ++$count if ( $line =~ m/$string/ );
   }
}
print $string\n$count\n;

with kind regards,
Met vriendelijke groet,
Maurice Lucas
TAOS-IT 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Problems installing DBD-Interbase on Fedora

2004-09-03 Thread Cristi Ocolisan

Hi Chris,

I already asked on perl.dbi.users this question and I got only one response.
It seems that I have to ask the authors directly.

Anyway, I found a different driver, called Bundle::DBD::InterBase that works
also on Fedora.

Thank you.

-Original Message-
From: Chris Devers [mailto:[EMAIL PROTECTED] 
Sent: 3 septembrie 2004 17:26
To: Cristi Ocolisan
Cc: [EMAIL PROTECTED]
Subject: Re: Problems installing DBD-Interbase on Fedora

On Fri, 3 Sep 2004, Cristi Ocolisan wrote:

 When I type make I get the following error:

 Error: Cannot parse function definition from 'strEQ(item, #name)) { \' in
 Interbase.xs, line 478 ' in Interbase.xs, line 487n definition from'
 keyname = #name;
 make: *** [InterBase.c] Error 1

 Can anyone tell me where is the problem or what does this error 
 message mean?

This sounds like a possible problem with the module itself, but I don't 
know anything about Interbase, so I'm not sure where to start.

You may have better luck by trying either the DBI list, or if you get no 
help there, contact the module authors directly.

Information on the DBI users list is available here:

 http://lists.perl.org/showlist.cgi?name=dbi-users
 http://www.mail-archive.com/[EMAIL PROTECTED]/

According to CPAN.org, DBD::Interbase was written by Edwin Pratomo 
[EMAIL PROTECTED] and Daniel Ritz [EMAIL PROTECTED]:

 http://search.cpan.org/~edpratomo/DBD-InterBase-0.43/InterBase.pm

It may also be worth contacting these two for suggestions.

Or maybe someone here will speak up, but I think in this case you'll 
have more luck by going to the module specific list for advice...


-- 
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'The Greatest Phone Message of All Time'
  by Jonathan Goldstein
  from 'This American Life: Crimebusters and Crossed Wires'


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: newbie question about regex

2004-09-03 Thread Wiggins d Anconia
 Hello,
 
 I call my script with the following line
 $ ./count.pl /var/log/file text
 this works fine but sometimes the text is foo(bar) and then my
scripts 
 gives an error.
  syntax error near unexpected token `foo(b'
 

I believe the syntax error is from your shell and you can get around
this by quoting your string to search on...

$ ./count.pl /var/log/file 'foo(bar)'

Should do it.

snip

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: newbie question about regex

2004-09-03 Thread Maurice Lucas
Hello,
I call my script with the following line
$ ./count.pl /var/log/file text
this works fine but sometimes the text is foo(bar) and then my
scripts
gives an error.
 syntax error near unexpected token `foo(b'
I believe the syntax error is from your shell and you can get around
this by quoting your string to search on...
$ ./count.pl /var/log/file 'foo(bar)'
Should do it.
Sometimes,...
even the most simple problems could take several hours to understand until 
you ask and somebody's gives th right answer,

Thanks everybody for the quick and right answer
With kind regards,
Maurice Lucas
TAOS-IT 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: newbie question about regex

2004-09-03 Thread David Dorward
On Fri, Sep 03, 2004 at 04:33:43PM +0200, Maurice Lucas wrote:
 $ ./count.pl /var/log/file text
 this works fine but sometimes the text is foo(bar) and then my scripts 
 gives an error.
 syntax error near unexpected token `foo(b'

That's a shell issue, not a Perl issue. Escape your brackets or
quite your text so that bash (or sh or whatever) won't try to
do something special with it.

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Comparing Arrays' Values

2004-09-03 Thread Errin Larsen
Hi guys (and gals!),

I want to compare a constant, known (expected values) array with the
results I'm collecting in another array.

Something like this, but I don't think this works the way I want it to:

my @rray1 = qw( One Two Three );
chomp( my @rray2 = STDIN );

print The 2 arrays are the same\n if( @rray1 eq @rray2 );

So that if I enter:
  Oneenter
  Twoenter
  Threeenter
  ctrl-D
on the terminal when I run the code, It will print The 2 arrays are
the same on the next line.

However, my tests seem to indicate I don't really know what's happeneing when I:
  @rray1 eq @rray2

Can someone help me?

--Errin

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Comparing Arrays' Values

2004-09-03 Thread Wiggins d Anconia
 Hi guys (and gals!),
 
 I want to compare a constant, known (expected values) array with the
 results I'm collecting in another array.
 
 Something like this, but I don't think this works the way I want it to:
 
 my @rray1 = qw( One Two Three );
 chomp( my @rray2 = STDIN );
 
 print The 2 arrays are the same\n if( @rray1 eq @rray2 );
 
 So that if I enter:
   Oneenter
   Twoenter
   Threeenter
   ctrl-D
 on the terminal when I run the code, It will print The 2 arrays are
 the same on the next line.
 
 However, my tests seem to indicate I don't really know what's
happeneing when I:
   @rray1 eq @rray2
 
 Can someone help me?
 
 --Errin

The above does not work because 'eq' is forcing the arrays into scalar
context, therefore you are testing whether the length of the arrays is
string (not numeric that would be C==) equal.  But how to do this can
be found in the FAQ,

perldoc -q 'test whether two arrays or hashes are equal'

perldoc perlfaq4, has some other juicy bits about analysing arrays and
other data stores.

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Maketext and UTF-8

2004-09-03 Thread Andrés Felipe Hernández
Hi again,

Is there a more specific list I can refer this to? I didn’t get any answers
to my questions so I thought it would be good idea to ask somewhere else :)

Cheers,
Andrés


-Original Message-
From: Andrés Felipe Hernández [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 02, 2004 12:47 PM
To: 'perl beginners'
Subject: Maketext and UTF-8


Hello list,

I'm having a little bit of trouble using Maketext with when returning texts
with special characters (á, é ... etc).

Although the text is returned successfully a warning is generated saying
this:

Malformed UTF-8 character (unexpected non-continuation byte 0x72 after start
byte 0xe9) in pattern match (m//) at /...Perl/5.6.1/Locale/Maketext/Guts.pm
line 32, STDIN line 3.

How do I get rid of that warning?

Thanks for your help,
Andres



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response