in reply to RFC: Mojolicious::Lite and Moo: A Very Basic Application Layout

Whats with the anonysub and fake global/closure? Also you got a syntax error
  • Comment on Re: RFC: Mojolicious::Lite and Moo: A Very Basic Application Layout

Replies are listed 'Best First'.
Re^2: RFC: Mojolicious::Lite and Moo: A Very Basic Application Layout
by karlgoethebier (Abbot) on Aug 05, 2015 at 21:35 UTC
    "...fake global/closure? Also you got a syntax error..."

    What do you mean with fake global closure?

    I guess $xml is a lexical method, isn't it?

    And my code compiles/runs: http://localhost:8080/foo?nose=anonmonk yields:

    <?xml version="1.0" encoding="utf-8"?> <myapp><nose>anonmonk</nose></myapp>

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      This looks like error  my $params->{nose} = $c->param('nose');

      B::Deparse 1.1401 (perl 5.16...) doesn't know what that is :) ($my $params{'nose'} = $c->param('nose'));

      I guess $xml is a lexical method, isn't it?

      gratuitous :)

      tobyinkster's argument goes

      Stop writing 'private' methods
      ●If a method is useful for end-users, then promote it to a public method.
      ●If a method exists in your namespace, then document it.
      ●Otherwise, use 'lexical methods' – coderefs.
      

      My argument goes, if you want it as a seperate method, document it, use _private convention, its as old as perl and its open

      otherwise put it in sub nose

      8/10 times I see a _lexical_method its useful to subclasses

      The same goes for  my %classdataUsefulButInaccessibleDirectly 8/10 times it should be  our %...

      Its like insideout objects ... as soon as you need to subclass and do something the author didn't think , all these OOPy protections become hurdles

        ..."looks like error ... B::Deparse 1.1401 (perl 5.16...) doesn't know what that is :) ($my $params{'nose'} = $c->param('nose'));"

        I guess that won't compile. But there ain't no $my and $params{'nose'} in my code.

        As fare as i remember i wrote:

        get '/foo' => sub { my $c = shift; my $params->{nose} = $c->param('nose'); $c->render( text => $moo->nose($params) ); };

        And what about this crap my %classdataUsefulButInaccessibleDirectly?

        "Its like insideout objects ... as soon as you need to subclass and do something the author didn't think , all these OOPy protections become hurdles"

        Now stop parroting and get lost!

        «The Crux of the Biscuit is the Apostrophe»