Skip to content

Commit

Permalink
lite scripts are myapp.pl, full are script/my_app
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed Nov 24, 2014
1 parent bdb7f92 commit f9e57d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
16 changes: 5 additions & 11 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -1431,16 +1431,10 @@ get automatically installed with the modules.
1;

Finally C<myapp.pl> can be replaced with an installable L<Mojolicious> script.

$ rm myapp.pl
$ mkdir script
$ touch script/myapp
$ chmod 744 script/myapp

Only a few small details change. We change the shebang to the recommended
C<#!perl>, which the toolchain rewrites to the proper shebang during
installation. We also use C<FindBin> rather than L<lib> since installable
scripts can't use L<lib> without breaking updated dual-life modules.
Only a few small details change. The shebang becomes the recommended C<#!perl>,
which the toolchain rewrites to the proper shebang during installation. Also
use C<FindBin> rather than L<lib> since installable scripts can't use L<lib>
without breaking updated dual-life modules.

#!perl

Expand All @@ -1457,7 +1451,7 @@ scripts can't use L<lib> without breaking updated dual-life modules.
That's really everything, now you can package your application like any other
CPAN module.

$ ./script/myapp generate makefile
$ ./script/my_app generate makefile
$ perl Makefile.PL
$ make test
$ make manifest
Expand Down
17 changes: 13 additions & 4 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -617,11 +617,19 @@ allow running tests again.
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyApp');

And the directory structure of our hybrid application should be looking like
this.
Move the file into a C<script> directory and rename it to C<my_app> to follow
the CPAN standard.

$ mkdir script
$ mv myapp.pl script/my_app
$ chmod 744 script/my_app

The resulting directory structure of our hybrid application should be looking
like this.

myapp
|- myapp.pl
|- script
+- my_app
|- lib
| |- MyApp.pm
| +- MyApp
Expand Down Expand Up @@ -752,7 +760,8 @@ can be simplified.
And our final directory structure should be looking like this.

myapp
|- myapp.pl
|- script
| +- my_app
|- lib
| |- MyApp.pm
| +- MyApp
Expand Down

0 comments on commit f9e57d1

Please sign in to comment.