GithubHelp home page GithubHelp logo

web5design / mojo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mojolicious/mojo

0.0 3.0 0.0 15.42 MB

Mojolicious - Perl real-time web framework

Home Page: http://mojolicio.us

License: Artistic License 2.0

Perl 99.92% JavaScript 0.08% XProc 0.01%

mojo's Introduction

Mojolicious Build Status

Back in the early days of the web, many people learned Perl because of a wonderful Perl library called CGI. It was simple enough to get started without knowing much about the language and powerful enough to keep you going, learning by doing was much fun. While most of the techniques used are outdated now, the idea behind it is not. Mojolicious is a new attempt at implementing this idea using state of the art technology.

Features

  • An amazing real-time web framework, allowing you to easily grow single file Mojolicious::Lite prototypes into well structured web applications.
    • Powerful out of the box with RESTful routes, plugins, commands, Perl-ish templates, content negotiation, session management, form validation, testing framework, static file server, first class Unicode support and much more for you to discover.
  • Very clean, portable and Object Oriented pure-Perl API without any hidden magic and no requirements besides Perl 5.10.1 (although 5.16+ is recommended, and optional CPAN modules will be used to provide advanced functionality if they are installed).
  • Full stack HTTP and WebSocket client/server implementation with IPv6, TLS, SNI, IDNA, Comet (long polling), keep-alive, connection pooling, timeout, cookie, multipart, proxy, and gzip compression support.
  • Built-in non-blocking I/O web server, supporting multiple event loops as well as optional preforking and hot deployment, perfect for embedding.
  • Automatic CGI and PSGI detection.
  • JSON and HTML/XML parser with CSS selector support.
  • Fresh code based upon years of experience developing Catalyst.

Installation

All you need is a one-liner, it takes less than a minute.

$ curl get.mojolicio.us | sh

We recommend the use of a Perlbrew environment.

Getting Started

These three lines are a whole web application.

use Mojolicious::Lite;

get '/' => {text => 'Hello World!'};

app->start;

To run this example with the built-in development web server just put the code into a file and start it with morbo.

$ morbo hello.pl
Server available at http://127.0.0.1:3000.

$ curl http://127.0.0.1:3000/
Hello World!

Duct tape for the HTML5 web

Web development for humans, making hard things possible and everything fun.

use Mojolicious::Lite;

# Simple plain text response
get '/' => {text => 'I ♥ Mojolicious!'};

# Route associating "/time" with template in DATA section
get '/time' => 'clock';

# Scrape information from remote sites
post '/title' => sub {
  my $self  = shift;
  my $url   = $self->param('url') || 'http://mojolicio.us';
  my $title = $self->ua->get($url)->res->dom->at('title')->text;
  $self->render(json => {url => $url, title => $title});
};

# WebSocket echo service
websocket '/echo' => sub {
  my $self = shift;
  $self->on(message => sub {
    my ($self, $msg) = @_;
    $self->send("echo: $msg");
  });
};

app->start;
__DATA__

@@ clock.html.ep
% use Time::Piece;
% my $now = localtime;
The time is <%= $now->hms %>.

Single file prototypes like this one can easily grow into well-structured applications.

Want to know more?

Take a look at our excellent documentation!

mojo's People

Contributors

kraih avatar marcusramberg avatar amenonsen avatar markstos avatar yuki-kimoto avatar jberger avatar acajou avatar gbarr avatar abh avatar melo avatar charsbar avatar akron avatar yko avatar alexvaluyskiy avatar rsp avatar tempire avatar mvuets avatar dsteinbrunner avatar memowe avatar chromatic avatar niczero avatar afresh1 avatar mons avatar ig3 avatar burak avatar bduggan avatar augensalat avatar nwatkiss avatar olegwtf avatar pwaring avatar

Watchers

JT5D avatar James Cloos avatar  avatar

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.