Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reverted shebang change
  • Loading branch information
kraih committed Nov 24, 2014
1 parent 3239ff8 commit fe6ddcf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
3 changes: 1 addition & 2 deletions Changes
@@ -1,6 +1,5 @@

5.65 2014-11-24
- Improved installable scripts to use #!perl. (jberger)
5.65 2014-11-23

5.64 2014-11-22
- Fixed bug in Mojolicious::Commands where the global Getopt::Long
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -114,7 +114,8 @@ __DATA__
use strict;
use warnings;
use lib 'lib';
use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
# Start command line interface for application
require Mojolicious::Commands;
Expand Down
18 changes: 0 additions & 18 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -1430,24 +1430,6 @@ get automatically installed with the modules.

1;

Finally a few small changes should be made to the application script. The
shebang becomes the recommended C<#!perl>, which the toolchain rewrites to the
proper shebang during installation. Also use L<FindBin> rather than L<lib>,
since installable scripts can't use L<lib> without breaking updated dual-life
modules.

#!perl

use strict;
use warnings;

use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }

# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyApp');

That's really everything, now you can package your application like any other
CPAN module.

Expand Down
26 changes: 21 additions & 5 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -612,9 +612,9 @@ allow running tests again.
use warnings;

use lib 'lib';
use Mojolicious::Commands;

# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyApp');

And the directory structure of our hybrid application should be looking like
Expand Down Expand Up @@ -721,11 +721,27 @@ moved into the appropriate directories.

=head2 Script

Finally C<myapp.pl> can be moved into a C<script> directory and renamed to
C<my_app> to follow the CPAN standard.
Finally C<myapp.pl> can be replaced with a proper L<Mojolicious> script.

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

Only a few small details change, since installable scripts can't use L<lib>
without breaking updated dual-life modules.

#!/usr/bin/env perl

use strict;
use warnings;

use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }

# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyApp');

=head2 Simplified tests

Expand Down Expand Up @@ -761,7 +777,7 @@ And our final directory structure should be looking like this.

myapp
|- script
| +- my_app
| +- myapp
|- lib
| |- MyApp.pm
| +- MyApp
Expand Down
2 changes: 1 addition & 1 deletion script/hypnotoad
@@ -1,4 +1,4 @@
#!perl
#!/usr/bin/env perl

use strict;
use warnings;
Expand Down
2 changes: 1 addition & 1 deletion script/mojo
@@ -1,4 +1,4 @@
#!perl
#!/usr/bin/env perl

use strict;
use warnings;
Expand Down
2 changes: 1 addition & 1 deletion script/morbo
@@ -1,4 +1,4 @@
#!perl
#!/usr/bin/env perl

use strict;
use warnings;
Expand Down

0 comments on commit fe6ddcf

Please sign in to comment.