On Sun Dec 12 02:20:29 2010, MichaelRWolf@att.net wrote:
Show quoted text0.08124/lib/DBIx/Class/Manual/Cookbook.pod#Using_database_functions_or_stored_procedures
Show quoted text>
>
> my $rs = $schema->resultset('Artist')->search(
> {},
> {
> select => [ 'name', { LENGTH => 'name' } ],
> as => [qw/ name name_length /],
> }
> );
>
> # Equivalent SQL:
> # SELECT name name, LENGTH( name )
> # FROM artist
OK. I didn't read enough to realize that my reported bug is not correct
as it stands. I retract my misinterpretation, but retain the stumbling
block that 'name_length' is only used once in the example. Let me
reframe this ticket as a request for example code to illustrate how 'as'
parameters are used in client code:
my $main_attraction = $rs->first->name;
my $marquee_characters_needed = $rs->first->name_length;
And.... likewise for the section of code that follows this one
my $quantity_sold = $rs->first->num_cds;
And, although you *do* have a link that explains the issue, I'd still
recommend having a phrase in this manual that summarizes:
...
NB The 'as' attribute does *not* affect the equivalent SQL. The 'as'
attribute does affect how you access the row objects from this record
set by remapping it to to a new inflation name.
Generally:
$obj->$inflation_name
$obj->get_column($inflation_name)
or
Specifically
$obj->name_length;
$obj->get_column('name_length');
$obj->num_cds;
$obj->get_column('num_cds');
even that link doesn't have complete coverage for
perhaps a phrase like 'The 'as' parameter