need help designing a database table (or tables) to hold a hash (%config) and ( %group)

need help designing a database table (or tables) to hold a hash (%config) and ( %group)

am 22.04.2011 18:58:06 von Agnello George

Hi All

I have just registered to this site , i am a network engineer and
recently got busy coding in perl ( just a beginner )

i am creating a script for deployment of websites and i need to create
=A0hash =A0 =A0%config ( which stores a lot of configurations setting for
each type of website ) =A0... i have been manually =A0eaditing this hash
but now the =A0hash =A0has to now be generated from a a database ( mysql )
.... i have =A0never worked =A0with designing a database structure . Can
any one guide =A0me how to go about =A0it =A0.


my hash structure looks some thing like this

my %config  = ( 'website_auto_1' =3D> {
=A0 =A0 =A0 'group' =3D> 'website_auto_group1',
=A0 =A0 'tempdir' =3D> '/var/www/html/temp/auto' ,
=A0 'svnurl' =3D> 'http://svn.intranet.com/repos/branch/auto',
=A0 'excludes' =3D>
'uploaded_images|includes/config.php|admin/includes/config.p hp|.svn',
=A0 'tarpath' =3D> '/var/www/html/temp/autotar/',
=A0 'tarname' =3D> 'auto',
=A0 =A0'rmtrootdir' =3D> '/var/www/projects/auto',
=A0 =A0'rmttmpdir' =3D> '/temp/auto',
=A0 =A0'rmteserver' =3D> '192.168.1.26' },

website_auto_2 =3D> { ....
:
:
) ;

%group =3D ( =A0website_auto_1  => { auto_group =3D> [ name =3D> user1 =
, name
=3D> user2 , name =3D> user6 ] },
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0website_auto_2  => { auto_group =3D>=
[ name =3D> user2 ,
=A0name =3D> user5 ] }, ...
:
:
);

i am not too sure if the %group ( not really implement this ) =A0hash is
correct , but i what i want to do is , my deployment script should
only allow users who are logged in =A0to deploy a particular website (
eg website_auto_1 ) =A0if they belong to the group .


thanks in advanced






--
Regards
Agnello D'souza

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

Re: need help designing a database table (or tables) to hold a hash( %config) and ( %group)

am 29.04.2011 17:44:34 von Peter Vereshagin

Be sure to wear flowers on your hat, perl!
2011/04/22 22:28:06 +0530 Agnello George => To perl@lists.mysql.com :
AG> I have just registered to this site , i am a network engineer and
AG> recently got busy coding in perl ( just a beginner )

There are several options for you. For a beginner, I'd like to mention the Tie::DBI.

AG> i am creating a script for deployment of websites and i need to create
AG> šhash š š%config ( which stores a lot of configurations setting for
AG> each type of website ) š... i have been manually šeaditing this hash
AG> but now the šhash šhas to now be generated from a a database ( mysql )
AG> ... i have šnever worked šwith designing a database structure . Can
AG> any one guide šme how to go about šit š.
AG>
AG>
AG> my hash structure looks some thing like this
AG>
AG> my %config š= ( 'website_auto_1' => {
AG> š š š 'group' => 'website_auto_group1',
AG> š š 'tempdir' => '/var/www/html/temp/auto' ,
AG> š 'svnurl' => 'http://svn.intranet.com/repos/branch/auto',
AG> š 'excludes' =>
AG> 'uploaded_images|includes/config.php|admin/includes/config.p hp|.svn',
AG> š 'tarpath' => '/var/www/html/temp/autotar/',
AG> š 'tarname' => 'auto',
AG> š š'rmtrootdir' => '/var/www/projects/auto',
AG> š š'rmttmpdir' => '/temp/auto',
AG> š š'rmteserver' => '192.168.1.26' },
AG>
AG> website_auto_2 => { ....
AG> :
AG> :
AG> ) ;
AG>
AG> %group = ( šwebsite_auto_1 š=> { auto_group => [ name => user1 , name
AG> => user2 , name => user6 ] },
AG> š š š š š š š š šwebsite_auto_2 š=> { auto_group => [ name => user2 ,
AG> šname => user5 ] }, ...
AG> :
AG> :
AG> );
AG>
AG> i am not too sure if the %group ( not really implement this ) šhash is
AG> correct , but i what i want to do is , my deployment script should
AG> only allow users who are logged in što deploy a particular website (
AG> eg website_auto_1 ) šif they belong to the group .

Is it of any mysql-specific?
I'd like to put ORM implementations like Rose::DB::Object and DBIx::Class on your list but looking at your code I'm not sure if you need just (de)serialize from/to blob/text field with Data::Dumper is the first stop...

73! Peter pgp: A0E26627 (4A42 6841 2871 5EA7 52AB 12F8 0CE1 4AAC A0E2 6627)
--
http://vereshagin.org

--
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