1 |
dpavlin |
1 |
package SysIface::Example; |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use warnings; |
5 |
|
|
|
6 |
|
|
use base 'Mojolicious::Controller'; |
7 |
|
|
|
8 |
dpavlin |
4 |
use File::Slurp; |
9 |
|
|
|
10 |
dpavlin |
1 |
# This action will render a template |
11 |
|
|
sub welcome { |
12 |
|
|
my $self = shift; |
13 |
|
|
|
14 |
|
|
# Render template "example/welcome.html.epl" with message and layout |
15 |
|
|
$self->render( |
16 |
|
|
layout => 'default', |
17 |
dpavlin |
4 |
message => 'Welcome to the Mojolicious Web Framework!', |
18 |
|
|
commands => [ read_file('sh/commands.sh') ], |
19 |
dpavlin |
1 |
); |
20 |
|
|
} |
21 |
|
|
|
22 |
dpavlin |
6 |
sub atsar { |
23 |
|
|
my $self = shift; |
24 |
|
|
$self->render( |
25 |
|
|
layout => 'default', |
26 |
|
|
commands => [ 'atsar -n 1' ], |
27 |
|
|
); |
28 |
|
|
} |
29 |
|
|
|
30 |
dpavlin |
1 |
1; |