![]() Some style is applied by using Twitter’s Bootstrap and Google’s Prettify from CDN sites. This (template lexical) variable will be created by the controller using the stash command later.Īny functions you see are called helpers in Mojolicious parlance and are more accurately curried controller methods. Notice that in the show template, a variable $doc is seen. The show and submit templates (both of which request the basic layout) are the views that will be seen when a user wants to display a paste or create new one. The contents of the requesting template will be inserted at the content directive. The first template defines a basic html layout which will be applied to any other template that requests it. %= submit_button 'Paste' => class => 'btn btn-primary' %= text_area 'content', class => 'form-control' %= tag label => for => 'content' => 'Paste Content' %= text_field 'title', class => 'form-control' %= tag label => for => 'title' => 'Title' %= tag div => class => 'form-group' => begin %= form_for '/' => role => form => method => POST => begin %= tag pre => class => 'prettyprint' => begin Mojolicious has its own templating engine which is a thin layer over normal Perl syntax. The Templatesīefore I dive into the server-side code, let’s look at the templates which will form the view of the application. To demonstrate a non-blocking application, I am going to write a simple pastebin using Mojolcious and Mango, a non-blocking MongoDB library (from the same developers as Mojo). ![]() ![]() The reason that Node is popular is that it is designed to be non-blocking.īy writing your webapp in a non-blocking style using a non-blocking framework, you can often build a faster and smarter application, requiring fewer servers to handle the same amount of traffic.Īlthough Perl has several web frameworks, only one was written with non-blocking design in mind: Mojolicious. While I have many answers to that question, I personally believe the most important difference is that Mojolicious is designed to be non-blocking. One question I often hear is “Why should I chose Mojolicious versus one of the other major Perl web frameworks?” ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |