in reply to Choose your own Adventure - for Perl & Windows

It's like you want to confuse people who want to make sane web apps. This is so not how you do it.
  • Comment on Re:Choose your own Adventure - for Perl & Windows

Replies are listed 'Best First'.
Re^2: Choose your own Adventure - for Perl & Windows
by FreeBeerReekingMonk (Deacon) on Apr 11, 2017 at 22:09 UTC
    It looks like you want to propose a better way... I welcome your tutorial.

    Well. I present a gentle way to install Strawberry Perl executable, that sets the path for you, and registers .pl extensions to perl.exe... and then you double click on it and poof it works. Quick results. One file. All in there (well, I removed cookies, threading, and ssl). Sure, takes a while to understand, but everything is exposed, instead of hidden in perl-modules which also take time to grasp. I would double the installation time with Dancer or Mojo (due to the large amount of tests during the cpan install).

      "I welcome your tutorial."
      use strict; use warnings; use Mojolicious::Lite; my %pages = ( '/' => { title => 'Begin', blurb => 'This is where you begin.', choices => [ { text => 'Choice 1', link => '/foo' }, { text => 'Choice 2', link => '/bar' }, ], }, 'foo' => { title => 'Foo', blurb => 'This is what happens when you Foo.', choices => [ { text => 'End', link => '/end' }, ], }, 'bar' => { title => 'Foo', blurb => 'This is what happens when you Bar.', choices => [ { text => 'Restart', link => '/' }, { text => 'End', link => '/end' }, ], }, 'end' => { title => 'End', blurb => 'This is the end.', choices => [], }, ); get '/' => { template => 'index', %{ $pages{'/'} } }; get '/:key' => sub { my $c = shift; my $key = $c->param('key'); return $c->reply->not_found unless $pages{$key}; $c->render( template => 'index', %{ $pages{$key} } ); }; app->start; __DATA__ @@ index.html.ep <html> <head> <!-- links to bootstrap here --> <title><%= $title %></title> </head> <body> <div class="container"> <h1><%= $blurb %></h1> % for my $choice (@$choices) { <a href="<%= $choice->{link} %>" class="btn btn-primary" role="but +ton"><%= $choice->{text} %></a> % } </div> </body> </html>
      All that extra code you have is unnecessary.
      "I would double the installation time with Dancer or Mojo (due to the large amount of tests during the cpan install)."

      Don't run the tests then.

      "but everything is exposed, instead of hidden in perl-modules which also take time to grasp"

      That is a poor way of looking at things. Rather than expose your own solution which simply reinvents a wheel that was already produced, tested AND deployed ... you get to use a solution that maintained by someone else. Nothing is hidden.

      "Sure, takes a while to understand, "

      It takes LONGER to understand your code and more importantly, it will take longer to correct, improve and maintain your code base. Really, you should be ashamed for posting that crap here and you should be publicly berated for your attitude.

Re^2: Choose your own Adventure - for Perl & Windows
by cbeckley (Curate) on Apr 11, 2017 at 14:27 UTC

    Lighten up, Francis.

      No. We are perfectly free to criticize at this site, especially code like the OP posted which is: unmaintainable, non-robust, highly coupled and is clearly aimed to confuse others. It flies in the face of best practices and only serves as an example of how to write garbage.