FAQ
Hi,

I have a table called plant_species which by default creates a schema result class PlantSpecy when I run my app_create.pl script. To get around this I've tried passing moniker_map='{ plant_species => "PlantSpecies" }' as an extra argument. It looks like the argument is read because it appears in lib/App/Model/App.pm but I still have a PlantSpecy.pm file rather than PlantSpecies.pm.

Can anyone help?

Thanks very much,

Matt.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110504/ce01ed68/attachment.htm

Search Discussions

  • Hernan Lopes at May 4, 2011 at 4:37 pm
    you should name your model singular, not plural
    On Wed, May 4, 2011 at 1:31 PM, matthew couchman (JIC) wrote:

    Hi,



    I have a table called plant_species which by default creates a schema
    result class PlantSpecy when I run my app_create.pl script. To get around
    this I�ve tried passing moniker_map=�{ plant_species => �PlantSpecies� }� as
    an extra argument. It looks like the argument is read because it appears in
    lib/App/Model/App.pm but I still have a PlantSpecy.pm file rather than
    PlantSpecies.pm.



    Can anyone help?



    Thanks very much,



    Matt.







    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110504/34fdcf3f/attachment.htm
  • Denny at May 4, 2011 at 4:43 pm

    On Wed, 2011-05-04 at 13:37 -0300, Hernan Lopes wrote:
    you should name your model singular, not plural
    Species is singular and plural. Like sheep.

    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 490 bytes
    Desc: This is a digitally signed message part
    Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110504/34c5a979/attachment.pgp
  • Lee at May 4, 2011 at 6:01 pm
    What plural should he use?
    On 04/05/2011 18:37, Hernan Lopes wrote:
    you should name your model singular, not plural

    On Wed, May 4, 2011 at 1:31 PM, matthew couchman (JIC)
    wrote:

    Hi,

    I have a table called plant_species which by default creates a
    schema result class PlantSpecy when I run my app_create.pl
    <http://app_create.pl> script. To get around this I�ve tried
    passing moniker_map=�{ plant_species => �PlantSpecies� }� as an
    extra argument. It looks like the argument is read because it
    appears in lib/App/Model/App.pm but I still have a PlantSpecy.pm
    file rather than PlantSpecies.pm.

    Can anyone help?

    Thanks very much,

    Matt.


    _______________________________________________
    List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/



    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110504/23420b68/attachment.htm
  • matthew couchman (JIC) at May 5, 2011 at 1:33 pm
    Hi again,

    To clarify: app_create.pl correctly creates Species.pm when it encounters a table called species but is confused when it encounters any preceding string in the table name (e.g. plant_species) and attempts to singularise it (e.g. PlantSpecy.pm).

    This is the command I use to create the model:

    perl script/app_create.pl model App DBIC::Schema \
    App::Schema create=static dbi:mysql:app_db 'username' 'password' \
    AutoCommit=1 \
    moniker_map='{ plant_species => "PlantSpecies" }' \
    components=EncodedColumn

    Is the syntax correct? Would 'inflect_plural' be a more suitable argument? If anyone could give some examples of how to use moniker_map/inflect_plural/another on the command line that would be really useful.

    Thanks very much,

    Matt.


    From: Lee
    Sent: 04 May 2011 19:02
    To: The elegant MVC web framework
    Subject: Re: [Catalyst] moniker_map arg in app_create.pl

    What plural should he use?

    On 04/05/2011 18:37, Hernan Lopes wrote:
    you should name your model singular, not plural
    On Wed, May 4, 2011 at 1:31 PM, matthew couchman (JIC) wrote:
    Hi,

    I have a table called plant_species which by default creates a schema result class PlantSpecy when I run my app_create.pl<http://app_create.pl> script. To get around this I've tried passing moniker_map='{ plant_species => "PlantSpecies" }' as an extra argument. It looks like the argument is read because it appears in lib/App/Model/App.pm but I still have a PlantSpecy.pm file rather than PlantSpecies.pm.

    Can anyone help?

    Thanks very much,

    Matt.




    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/







    _______________________________________________

    List: Catalyst@lists.scsys.co.uk

    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst

    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110505/30f07804/attachment.htm
  • matthew couchman (JIC) at May 5, 2011 at 3:27 pm
    <sheepish>

    Sorry! It looks like I just had my arguments in the wrong order:

    perl script/app_create.pl model App DBIC::Schema \
    App::Schema create=static \
    components=EncodedColumn \
    AutoCommit=1 \
    moniker_map='{ plant_species => "PlantSpecies" }' \
    dbi:mysql:antspec 'username' 'password'

    does the trick. Thanks for the replies.

    </sheepish>


    From: matthew couchman (JIC)
    Sent: 05 May 2011 14:34
    To: The elegant MVC web framework
    Subject: RE: [Catalyst] moniker_map arg in app_create.pl

    Hi again,

    To clarify: app_create.pl correctly creates Species.pm when it encounters a table called species but is confused when it encounters any preceding string in the table name (e.g. plant_species) and attempts to singularise it (e.g. PlantSpecy.pm).

    This is the command I use to create the model:

    perl script/app_create.pl model App DBIC::Schema \
    App::Schema create=static dbi:mysql:app_db 'username' 'password' \
    AutoCommit=1 \
    moniker_map='{ plant_species => "PlantSpecies" }' \
    components=EncodedColumn

    Is the syntax correct? Would 'inflect_plural' be a more suitable argument? If anyone could give some examples of how to use moniker_map/inflect_plural/another on the command line that would be really useful.

    Thanks very much,

    Matt.


    From: Lee
    Sent: 04 May 2011 19:02
    To: The elegant MVC web framework
    Subject: Re: [Catalyst] moniker_map arg in app_create.pl

    What plural should he use?

    On 04/05/2011 18:37, Hernan Lopes wrote:
    you should name your model singular, not plural
    On Wed, May 4, 2011 at 1:31 PM, matthew couchman (JIC) wrote:
    Hi,

    I have a table called plant_species which by default creates a schema result class PlantSpecy when I run my app_create.pl<http://app_create.pl> script. To get around this I've tried passing moniker_map='{ plant_species => "PlantSpecies" }' as an extra argument. It looks like the argument is read because it appears in lib/App/Model/App.pm but I still have a PlantSpecy.pm file rather than PlantSpecies.pm.

    Can anyone help?

    Thanks very much,

    Matt.




    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/






    _______________________________________________

    List: Catalyst@lists.scsys.co.uk

    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst

    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110505/34cedd7c/attachment.htm
  • Tomas Doran at May 6, 2011 at 6:58 am

    On 5 May 2011, at 16:27, matthew couchman (JIC) wrote:

    <sheepish>

    Sorry! It looks like I just had my arguments in the wrong order:

    perl script/app_create.pl model App DBIC::Schema \
    App::Schema create=static \
    components=EncodedColumn \
    AutoCommit=1 \
    moniker_map='{ plant_species => "PlantSpecies" }' \
    dbi:mysql:antspec 'username' ?password?

    does the trick. Thanks for the replies.

    </sheepish>
    That was hella easy to miss (I at least had _no idea_).

    A doc patch with an example to help other people avoid the same trap
    would be very welcome :)

    Cheers
    t0m
  • Dave Howorth at May 6, 2011 at 9:02 am

    Tomas Doran wrote:
    On 5 May 2011, at 16:27, matthew couchman (JIC) wrote:

    Sorry! It looks like I just had my arguments in the wrong order:
    That was hella easy to miss (I at least had _no idea_).

    A doc patch with an example to help other people avoid the same trap
    would be very welcome :)
    It's a bit odd that DBIx::Class::Schema::Loader make_schema_at doesn't
    produce an error or a warning when it doesn't find a table called
    'PlantSpecies'.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMay 4, '11 at 4:31p
activeMay 6, '11 at 9:02a
posts8
users6
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase