Uhh ... like this?
<Service connect>
Code my $c = shift;
Code return DBI->connect( ... );
</Service>
By marking Code as a "combine", you will end up with all the code
within that block in the same scalar that you can eval later.
But, I personally wouldn't have code in your config files. Instead, I
would do what I suggested earlier and build the code from basic
concepts. *shrugs* If you have code in the config file, that ends up
providing a security hole - you have to secure not just your code from
prying hands, but your config files as well. While config parameters
are sensitive, someone could change the code and you'd execute it
without knowing. That code could do something like email your database
to someone else. Changing parameter values could never do that.
Rob
On Tue, 28 Dec 2004 12:29:25 -0500, Stevan Little
<[EMAIL PROTECTED]> wrote:
> Very Nice Rob!
>
> I knew it was a good idea to ask the list before I started writing any
> code.
>
> The only thing still is multi-line code entries, I would like to be
> able to do this:
>
> <Registry MyApp>
> <Container DBI>
> Literal dsn dbi:mysql:test
> Literal username test
> Literal password ****
> <Service connect>
> my $c = shift;
> return DBI->connect($c->get('dsn'),
> $c->get('username'),
> $c->get('password'));
> </Service>
> </Container>
> </Registry>
>
> On Dec 28, 2004, at 12:22 PM, Rob Kinyon wrote:
> >
> > <Registry MyApp>
> > <Container DBI>
> > Literal dsn dbi:mysql:test
> > Literal username test
> > Literal password ****
> > <ConstructorInjection connect>
> > Class DBI
> > Constructor connect
> > Parameter dsn
> > Parameter username
> > Parameter password
> > </ConstructorInjection>
> > </Container>
> > </Registry>
> >
> > Or, you can have the Literal items be containers. It's up to you.
> >
> > The important things to note:
> > 1) You can have multiple items on the same line
> > 2) You can aggregate multiple lines into the same option
> > 3) You can have hash options, so that the first item is the key to the
> > rest of the line
> > 4) Structure your config file the way you structure your code - it'll
> > make more sense to you.
> >
> > Rob
> >
> > _______________________________________________
> > sw-design mailing list
> > [email protected]
> > http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
> >
>
> _______________________________________________
> sw-design mailing list
> [email protected]
> http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
>
_______________________________________________
sw-design mailing list
[email protected]
http://metaperl.com/cgi-bin/mailman/listinfo/sw-design