Hi,

I am new to C::A and Class::DBI. I have two questions during the learning process.

1. In my C::A script, I have

    $self->mode_param( path_info=> 1 );
then i will request http://localhost/movie/945
where "movie" will be the run mode because of mode_param, but how do i get the 945? do i need to manually parse path_info ?

2. I am trying to use Class::DBI::Loader. currently what i have is (simplified)

sub cgiapp_init {
    my $self = shift;
    my $loader = Class::DBI::Loader->new(
                     dsn => $self->config_param('database.data_source'),
                     options  => { RaiseError => 1, PrintError => 1},
                     namespace     => "ToRest",
                     relationships => 1,
    );
    if ( $loader ) {
        $self->{_To_Rest_Loader} = $loader;
    } else {
        $self->log->debug("dbi loader failed");
    }
}
I know I would need to create a few table classes in Class::DBI way. but i don't need it with Class::DBI::Loader as it does for me. but i felt a bit clumsy to have the $loader saved as $self->{_To_Rest_Loader}

is there a better way to do it?


In reply to questions on CGI::Application, Class::DBI::Loader by Qiang

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.