How to fix the Mojolicious-Boilerplate app?
Asked Answered
H

1

8

Today I started to learn the Mojolicious framework. IMHO, the best way is "learn by examples", so study some "already done" application a play with it. Therefore I downloaded the Mojolicious-Boilerplate, what should be a demo of Mojolicious and Twitter bootstrap. Unfortunately it doesn't even start.

#!/usr/bin/env perl
use Mojo::Base -strict;

use File::Basename 'dirname';
use File::Spec;

push @INC, join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib');

# Check if Mojolicious is installed;
die <<EOF unless eval 'use Mojolicious::Commands; 1';
It looks like you don't have the Mojolicious framework installed.
Please visit http://mojolicio.us for detailed installation instructions.

EOF

# Application
$ENV{MOJO_APP} ||= 'Boilerplate';

# Start commands
Mojolicious::Commands->start;

EDIT start & error:

$ morbo script/boilerplate 
Couldn't load application from file "script/boilerplate": Can't locate object method "start" via package "Mojolicious::Commands" at script/boilerplate line 20.

I found in the https://github.com/kraih/mojo/blob/master/Changes :

3.94 2013-04-08 - Removed deprecated start method from Mojolicious::Commands.

Have:

$ mojo version
CORE
  Perl        (v5.16.3, darwin)
  Mojolicious (4.18, Top Hat)

OPTIONAL
  EV 4.0+               (4.15)
  IO::Socket::IP 0.16+  (0.21)
  IO::Socket::SSL 1.75+ (1.952)

This version is up to date, have fun!
  • Can please anybody suggest me how to fix this starter app?
  • Or is here another "simple" app what shows some js,css,mojolicious "broilerplate"?
Hairpin answered 15/7, 2013 at 13:55 Comment(7)
how do you start it? please add the command you use the run the codeElastin
I also had an issue like this once... maybe the start needs to be replaced with start_app($name): mojolicio.us/perldoc/Mojolicious/Commands#start_appElastin
@BorisDäppen YES, that was simple :) (When one knows :)) - Please add your solution as answer, so as I can accept it. ;)Hairpin
@Boris has the answer ... but you could make a pull request to the author of github.com/tudorconstantin/Mojolicious-Boilerplate on github.com so the example and docs get updated :-)Subscript
@G.Cito huh - never used Github yet - and the app still not working as should, (not shown any menu) but (at least) it started - now can try learning - (and remember, I started learn mojo... today) ;)Hairpin
I opened an issue here, maybe the author fixes it... who knows :-) github.com/tudorconstantin/Mojolicious-Boilerplate/issues/4Elastin
I just now visited github and saw @BorisDäppen's issue. I am flattered to see someone actually tried to use the boilerplate recently, although, as you probably saw, I haven't got the time to work on it for more than a year. Unfortunately, I don't think I'll get the time to work on it sooner also - if one of you guys want to take it over, let me know.Rectilinear
P
6

As you mentioned yourself, the start method was deprecated and is now removed. The replacement for it is start_app($name) as you can find here: http://mojolicio.us/perldoc/Mojolicious/Commands#start_app

The example you are playing with is simply not up-to-date. If you brought it running on your machine you could make a pull-request to the official Git-repository (as G. Cito mentioned). I'm sure they will be glad receiving this fix.

Precautious answered 15/7, 2013 at 17:17 Comment(1)
Yes, the Mojolicious::Commands->start_app('Boilerplate'); helps to run the app. Maybe (When/If) I make it fully workable (didn't got any menu yet) will learn git/github. Thank you for help.Hairpin

© 2022 - 2024 — McMap. All rights reserved.