Mysql::Simple

Mysql::Simple

am 17.09.2004 19:17:24 von Dan Bolser

I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
a password it uses Term::ReadPassword to get the user to supply one.

It uses use Getopt::Long to read mysql style options (in passthrough
mode).

Finally it provides a simple interface, allowing you to code things like
the following (but not much else)...

#!/usr/bin/perl

use Mysql::Simple qw( doQuery );

$x = doQuery( ) or die "$DBI::errstr\n";

for (@$x){
print join("\t", @$_), "\n";
}

__END__

Quite simple eh?

I am looking for feedback, and perhaps a volunteer to help make this a
proper CPAN module.

The befifit of this module is never writing another connection string, and
not worrying about where to put your password.

It needs work on the range of mysql command line options supported and for
prepared queries (which it does support). The docs need some work.




--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 19:20:14 von Rudy Lippan

On Fri, 17 Sep 2004, Dan Bolser wrote:

> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find

For this part you can just pass in mysql_read_default_group (there is some
code in CVS that will causes DBD::mysql to default to reading the group
"dbd_mysql" if the no group is passed in)


Rudy.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 19:20:14 von Rudy Lippan

On Fri, 17 Sep 2004, Dan Bolser wrote:

> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find

For this part you can just pass in mysql_read_default_group (there is some
code in CVS that will causes DBD::mysql to default to reading the group
"dbd_mysql" if the no group is passed in)


Rudy.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 19:28:41 von Dan Bolser

I found a bug in this function on old versions.

Also it makes the connection string look ugly (and I never like to look at
it anyway (I have a week stomach)). Also can you supply multiple files?

Thanks for the comments.

Would / could you use such a cpan module?

Cheers,
Dan.

On Fri, 17 Sep 2004, Rudy Lippan wrote:

>On Fri, 17 Sep 2004, Dan Bolser wrote:
>
>> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
>> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
>
>For this part you can just pass in mysql_read_default_group (there is some
>code in CVS that will causes DBD::mysql to default to reading the group
>"dbd_mysql" if the no group is passed in)
>
>
>Rudy.
>


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 19:28:41 von Dan Bolser

I found a bug in this function on old versions.

Also it makes the connection string look ugly (and I never like to look at
it anyway (I have a week stomach)). Also can you supply multiple files?

Thanks for the comments.

Would / could you use such a cpan module?

Cheers,
Dan.

On Fri, 17 Sep 2004, Rudy Lippan wrote:

>On Fri, 17 Sep 2004, Dan Bolser wrote:
>
>> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
>> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
>
>For this part you can just pass in mysql_read_default_group (there is some
>code in CVS that will causes DBD::mysql to default to reading the group
>"dbd_mysql" if the no group is passed in)
>
>
>Rudy.
>


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 21:19:24 von Jeremy Zawodny

On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:
>
> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
> a password it uses Term::ReadPassword to get the user to supply one.

Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
MySQL is a real product name, using proper capitalization seems only
fair and intuitive.

> I am looking for feedback, and perhaps a volunteer to help make this a
> proper CPAN module.

I might be able to help with that.

> The befifit of this module is never writing another connection string, and
> not worrying about where to put your password.

Hey, that was one of the goals behind DBIx::DWIW too. :-)

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 17.09.2004 21:19:24 von Jeremy Zawodny

On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:
>
> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
> a password it uses Term::ReadPassword to get the user to supply one.

Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
MySQL is a real product name, using proper capitalization seems only
fair and intuitive.

> I am looking for feedback, and perhaps a volunteer to help make this a
> proper CPAN module.

I might be able to help with that.

> The befifit of this module is never writing another connection string, and
> not worrying about where to put your password.

Hey, that was one of the goals behind DBIx::DWIW too. :-)

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 18.09.2004 12:49:23 von Dan Bolser

On Fri, 17 Sep 2004, Jeremy Zawodny wrote:

>On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:
>>
>> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
>> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
>> a password it uses Term::ReadPassword to get the user to supply one.
>
>Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
>MySQL is a real product name, using proper capitalization seems only
>fair and intuitive.

Great, MySQL::Simple it is.

>
>> I am looking for feedback, and perhaps a volunteer to help make this a
>> proper CPAN module.
>
>I might be able to help with that.

Naturally I wan't to help as much as I can, but I have no experience
packaging up a module for CPAN, and I guess this is relativly easy for
someone who knows what they are doing.

>> The befifit of this module is never writing another connection string, and
>> not worrying about where to put your password.
>
>Hey, that was one of the goals behind DBIx::DWIW too. :-)

:) I like the module. It looks good. I wouldn't want to try to reimplement
any of the nice features supported by your module in MySQL::Simple, as it
looks like you have done a good job on those important features. Also I
guess I should look at DBIx::Password to see if it more sensible than
calls to Term::ReadPassword.

However, I gues you can tell from the name, a big aim of MySQL::Simple is
that it it as simple as possible, doing the minimum amount of
functionality, and mimicking a true mysql application as much as possible
(by reading command line args).

So I guess there is still room for MySQL simple?

How should we/I procede? I can put the code somewhere, or I can read a
'cpan packaging module begginers guide / how-to / cookbook' and we can go
from there.

>Jeremy
>

Thanks very much for your support,
Dan.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Mysql::Simple

am 18.09.2004 12:49:23 von Dan Bolser

On Fri, 17 Sep 2004, Jeremy Zawodny wrote:

>On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:
>>
>> I have made a perl module called Mysql::Simple which parses /etc/my.cfg
>> and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
>> a password it uses Term::ReadPassword to get the user to supply one.
>
>Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
>MySQL is a real product name, using proper capitalization seems only
>fair and intuitive.

Great, MySQL::Simple it is.

>
>> I am looking for feedback, and perhaps a volunteer to help make this a
>> proper CPAN module.
>
>I might be able to help with that.

Naturally I wan't to help as much as I can, but I have no experience
packaging up a module for CPAN, and I guess this is relativly easy for
someone who knows what they are doing.

>> The befifit of this module is never writing another connection string, and
>> not worrying about where to put your password.
>
>Hey, that was one of the goals behind DBIx::DWIW too. :-)

:) I like the module. It looks good. I wouldn't want to try to reimplement
any of the nice features supported by your module in MySQL::Simple, as it
looks like you have done a good job on those important features. Also I
guess I should look at DBIx::Password to see if it more sensible than
calls to Term::ReadPassword.

However, I gues you can tell from the name, a big aim of MySQL::Simple is
that it it as simple as possible, doing the minimum amount of
functionality, and mimicking a true mysql application as much as possible
(by reading command line args).

So I guess there is still room for MySQL simple?

How should we/I procede? I can put the code somewhere, or I can read a
'cpan packaging module begginers guide / how-to / cookbook' and we can go
from there.

>Jeremy
>

Thanks very much for your support,
Dan.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org