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"?
kobame
  • 5,766
  • 3
  • 31
  • 62
  • how do you start it? please add the command you use the run the code – Boris Däppen Jul 15 '13 at 14:17
  • 1
    I also had an issue like this once... maybe the `start` needs to be replaced with `start_app($name)`: http://mojolicio.us/perldoc/Mojolicious/Commands#start_app – Boris Däppen Jul 15 '13 at 15:31
  • @BorisDäppen YES, that was simple :) (When one knows :)) - Please add your solution as answer, so as I can accept it. ;) – kobame Jul 15 '13 at 16:20
  • 1
    @Boris has the answer ... but you could make a pull request to the author of https://github.com/tudorconstantin/Mojolicious-Boilerplate on github.com so the example and docs get updated :-) – G. Cito Jul 15 '13 at 16:30
  • @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) ;) – kobame Jul 15 '13 at 16:40
  • 1
    I opened an issue here, maybe the author fixes it... who knows :-) https://github.com/tudorconstantin/Mojolicious-Boilerplate/issues/4 – Boris Däppen Jul 15 '13 at 17:34
  • 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. – Tudor Constantin Jul 19 '13 at 12:49

1 Answers1

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.

Boris Däppen
  • 1,186
  • 7
  • 20
  • 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. – kobame Jul 15 '13 at 17:21