Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017

 view release on metacpan or  search on metacpan

devdata/https_mojolicious.io_blog_2017_12_05_day-5-your-apps-built-in-commands  view on Meta::CPAN


<pre><code>perl myapp.pl eval -V &#39;app-&gt;pg-&gt;db-&gt;query(&quot;SELECT NOW()&quot;)-&gt;hash&#39;
</code></pre>

<p>These last two database examples assumed that your app was using <a href="http://mojolicious.org/perldoc/Mojo/Pg">Mojo::Pg</a> but similar one-liners could work for any database that your app knows about.</p>

<p>There really is nothing like debugging or administering your application without having to copy and paste a bunch of your logic from your app to some script.
Although if you really find yourself using the <code>eval</code> command for the same tasks often ... well that should wait until tomorrow.</p>

              </section>
              <small><p><a href="https://commons.wikimedia.org/w/index.php?curid=44576486">Image</a> by <a href="//commons.wikimedia.org/w/index.php?title=User:Gsaisudha75&amp;action=edit&amp;redlink=1" title="User:Gsaisudha75 (page does not exist)">...
</small>

              <p class="tags">
                <span>Tagged in </span>:
                  <a href="/blog/tag/advent/">advent</a>,
                  <a href="/blog/tag/command/">command</a>,
                  <a href="/blog/tag/debugging/">debugging</a>,
                  <a href="/blog/tag/administration/">administration</a>
              </p>

devdata/https_mojolicious.io_blog_2017_12_22_day-22-how-to-build-a-public-rest-api  view on Meta::CPAN

command to create the app:</p>

<pre><code>$ mojo generate app MyApp
</code></pre>

<p>Check it works right by running the provided test:</p>

<pre><code>$ prove -l t
</code></pre>

<p>After that, edit <code>lib/MyApp.pm</code> to make it look like this:</p>

<pre><code>package MyApp;
use Mojo::Base &quot;Mojolicious&quot;;

sub startup {
  my $self = shift;

  # Load the &quot;api.yaml&quot; specification from the public directory
  $self-&gt;plugin(OpenAPI =&gt; {spec =&gt; $self-&gt;static-&gt;file(&quot;api.yaml&quot;)-&gt;path});
}



( run in 0.811 second using v1.01-cache-2.11-cpan-de7293f3b23 )