Giter Club home page Giter Club logo

mojoexample's Introduction

Purpose

Notes

  • Both apps make use of the DBIx::Class schema.
  • The schema is in lib/Schema.pm, lib/Schema/*
  • The DBIx::Class schema connects to a provided sqlite3 database, test.db
  • The controller tests create a new test.db, populated using fixtures from t/fixtures/*
  • The schema tests use an in-memory sqlite3 database, populated using fixtures from t/fixtures/*
  • Test::Database is a utility for populating the sqlite3 databases with fixtures from t/fixtures/*

Usage

Live

Running on Heroku

Heroku is running Hypnotoad, the full featured UNIX optimized preforking non-blocking I/O HTTP 1.1 and WebSocket server built around the very well tested and reliable Mojo::Server::Daemon with IPv6, TLS, Bonjour, libev and hot deployment support that just works.

To easily deploy your own Mojolicious app to Heroku, check out Deploy Perl Mojolicious web apps to Heroku.

Locally

A minimum of Perl 5.10 is required. If your Perl is too old, Perlbrew is über easy to install!

If you must run on Perl 5.8, you can try a back-ported version of Mojolicious, but you're on your own :)

Install

git clone [email protected]:tempire/MojoExample.git
cd MojoExample

Install the Carton package manager. Carton will install all dependencies to the local/ sub-directory.

curl -L cpanmin.us | perl - Carton
carton install

Run

Full app

carton exec morbo script/mojo_full

Light app

carton exec morbo mojolite

Index

Copyright License

Copyright (C) 2008-2014, Glen Hinkle.

MojoExample is free software, you can redistribute it and/or modify it under the same terms as Perl5 (http://dev.perl.org/licenses/).

mojoexample's People

Contributors

atz avatar jberger avatar tempire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mojoexample's Issues

Replace URLs in redirect_to into name of routes

You use absolute URL in redirect_to methods, it's no good.
Better solution is using name of routes, i.e.:

$r->route('/foo/bar')->to('foo#bar')->name('foo_bar');

$self->redirect_to('foo_bar');

Requires File::Slurp

File::Slurp is not mentioned in the dependencies, found the requirement by running the test suite.

FYI: Perl 5.016 required for Mojolicious installation

# carton install
Installing modules using /home/rackping/scripts/graphql/work/MojoExample/cpanfile
! Installing the dependencies failed: Your Perl (5.010001) is not in the range '5.016'
! Bailing out the installation for Mojolicious-9.21.
! Installing the dependencies failed: Module 'Mojolicious' is not installed

Requires SQL::Translator

$ prove -l

t/blogs.t ... DBIx::Class::Schema::deploy(): Can't deploy without a ddl_dir or SQL::Translator >= 0.11006 (see DBIx::Class::Optional::Dependencies for details) at /home/wcravens/Repos/MojoExample/lib/Test/Database.pm line 38

This is not mentioned in the dependencies.

Installing SQL::Translator fixed the problem.

how to use mojolicious on windows

Hi,
I am a new learner and i really interested in using his web framework on windows.
I have installed Strawberry Perl on windows 32 bit. I also installed Mojolicious using Cpan .
but found errors on hitting enter after "morbo hello" like

Can't opendir(templates): Invalid argument
at C:/Strawberry/perl/site/bin/../lib/Mojo/Home.pm line 66.

I don't know what are the requirements and steps to be followed to simply print a hello on the web.
I need a tutorial or say documentation for windows.
Thanks in advance for helping me

Problems running the scripts

Hey so the main application runs just fine for me, and I'm on ubuntu 14.04 LTS 32 bit.. Running the morbo development server with the mojolite app works just fine.

However, for some reason I am getting errors when I try to run the files that are in the t/ and script/ directories... especially those controller tests, I can't even run t/blogs.t without this error in particular:

~/mojo/MojoExample$ perl t/blogs.t
Can't locate Schema.pm in @inc (you may need to install the Schema module) (@inc contains: ../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at t/blogs.t line 5.
BEGIN failed--compilation aborted at t/blogs.t line 5.

Now most advice I find points me to proper usage of @inc and the use/require statements, so I tried adding "use lib '../lib';" to that file t/blogs.t so that @inc will look in that folder but it makes no difference.

2 months ago, I had it all working, though I recall solving similar issues in the process. When I run the script/generate_schema file, my shell complains about this similar issue with the @inc array:

~/mojo/MojoExample$ perl script/generate_schema
Can't locate DBIx/Class/Schema/Loader.pm in @inc (you may need to install the DBIx::Class::Schema::Loader module) (@inc contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at script/generate_schema line 4.

This problem persists, after having already installed the DBIx::Class::Schema::Loader from CPAN.

Do I have a dependency issue going horribly wrong? I'm banging my head against my desk, hoping that this is just some type of noobie problem with a quick fix... 2 months ago, I was able to run the controller tests and populate the test.db with my modifications to the fixtures. Now all of sudden the @inc array is just whipping me back lol. I just reinstalled ubuntu to clean my kernel up but the same problems are persisting.

Any time and attention to these matters is greatly appreciated. I appologize if I cause any face-palming, heh..

generate_script throws error

Hello,

When I run generate_script locally throws the error as below:
Bizarre copy of UNKNOWN in scalar assignment at C:/Dwimperl/perl/site/lib/DBIx/Class/Schema/Loader/Base.pm line 1059.

Please let me know if you have any suggestions/hints.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.