Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Mojolicious::Lite;
- use Mojo::UserAgent;
- use Modern::Perl;
- get '/' => sub {
- # get this to render the hello tempalte
- my $ua = Mojo::UserAgent->new;
- my $self = shift;
- #$self->render(data => $self->ua->get('http://api.powerhousemuseum.com/api/v1/category/xml/?api_key=8fbb61ea34d6f5d')->res->dom->result->categories->category->[0]->{name}');
- my $dom = Mojo::DOM->new('http://api.powerhousemuseum.com/api/v1/category/xml/?api_key=8fbb61ea34d6f5d');
- $self->stash(
- );
- # $self->render(data => $self->ua->get('http://api.powerhousemuseum.com/api/v1/category/xml/?api_key=8fbb61ea34d6f5d')->res->dom->find('name'));
- $self->render('hello');
- };
- # <%= say $ua->get('http://mojolicio.us/')->res->dom->html->head->title %>
- # get the names for stuff after the sub domain
- get '/:fname/:lname' => sub {
- my $self = shift;
- $self->stash(
- fname => uc $self->param('fname'),
- lname => uc $self->param('lname')
- );
- $self->render('dick');
- };
- #start the application
- app->start;
- ## the rest of the file will be a template for markup
- ## Hello template:
- __DATA__
- @@ layouts/wrapper.html.ep
- <h1><%= title %></h1>
- <%= content %> this is the layout wrapper<br>
- @@ hello.html.ep
- <h1>YO againnn</h1>
- <%= $dom %>
- <br>
- @@ dick.html.ep
- % title 'referencing the wrapper';
- % layout 'wrapper';
- Yo <%= $fname %> <%= $lname %>!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement