logo       

Re: RFC: IOC Configuration syntax/mini-language: msg#00024

Subject: Re: RFC: IOC Configuration syntax/mini-language
On Tue, 28 Dec 2004 12:50:03 -0500, Stevan Little
<stevan@xxxxxxxxxxxxxxxx> wrote:
> 
> On Dec 28, 2004, at 12:39 PM, Rob Kinyon wrote:
> > Uhh ... like this?
> >
> > <Service connect>
> >     Code my $c = shift;
> >     Code return DBI->connect( ... );
> > </Service>
> 
> Yuk

Ok ... How about:
<Service connect>
    Code \
        my $c = shift; \
        return DBI->connect( ... );
</Service>

It looks somewhat C macro-ish, but it'll work. :-)

> > 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.
> 
> Well part of the problem is that IOC::Service requires a code-ref. The
> ConstructorInjection and SetterInjection ones do not, but you can't
> always fit something into one of those. IOC::Service provides a nice
> bridge to do both ConstructorInjection and SetterInjection at the same
> time, plus any other weirdness your object might want/need in order to
> be fully configured when you get it from the IOC::Container.
> 
> > *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.
> 
> I would argue that you _should_ secure your config file as much as
> possible, if not more than you secure your code. Your config file will
> usually have the database connection parameters as well as username and
> password. That type of data should be protected  more than just
> DBI->connect($config{dsn}....) stuff IMO.
> 
> > 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.
> 
> True, it could open up some funky exploits, but on some level you need
> to put that responsibilty on the user of the code, and not on the code.
> If the concern is there that sub-refs are dangerous, then you just need
> to be sure that your objects can all be configured with Setter and
> Constructor injection, but I don't want to force that restriction on
> others.
> 
> One thought, would a Safe compartment be any help with this? I could
> create an IOC::Service::Safe which would initialize the component (i.e.
> - execute the sub-ref from the config) within a Safe compartment. I
> have never used Safe, so I am not very familair.
> 
> Any thoughts on that?
> 
> Steve
> 
> >
> > Rob
> >
> > On Tue, 28 Dec 2004 12:29:25 -0500, Stevan Little
> > <stevan@xxxxxxxxxxxxxxxx> 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
> >>> sw-design@xxxxxxxxxxxx
> >>> http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
> >>>
> >>
> >> _______________________________________________
> >> sw-design mailing list
> >> sw-design@xxxxxxxxxxxx
> >> http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
> >>
> >
> > _______________________________________________
> > sw-design mailing list
> > sw-design@xxxxxxxxxxxx
> > http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
> >
> 
> _______________________________________________
> sw-design mailing list
> sw-design@xxxxxxxxxxxx
> http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe