Skip to content

Commit

Permalink
Application released
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsr committed Mar 25, 2014
1 parent 338bffc commit dbb11d9
Show file tree
Hide file tree
Showing 14 changed files with 2,334 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
fab-online
==========

Monitor similar to Open_Access_Control written on Perl and Mojolicious
Monitor similar to Open_Access_Control written on Perl and Mojolicious<br>

Require libmojolicious-perl.<br>
To start app please enter morbo ./script/open_access<br>
To long collect data from OpenAccess control just add to crontab script/db_gen/parse_in_db, first changing path
to your text file with logs and database parameters<br>

18 changes: 18 additions & 0 deletions lib/OpenAccess.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package OpenAccess;
use Mojo::Base 'Mojolicious';

# This method will run once at server start
sub startup {
my $self = shift;

# Documentation browser under "/perldoc"
$self->plugin('PODRenderer');

# Routes
my $r = $self->routes;

# Normal route to controller
$r->route('/')->to('example#welcome');
}

1;
19 changes: 19 additions & 0 deletions lib/OpenAccess/Example.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package OpenAccess::Example;
use Mojo::Base 'Mojolicious::Controller';
use DBI;
use Data::Dumper;

sub welcome {
my $self = shift;
my @a;
my $dbh = DBI->connect('DBI:mysql:openaccess', 'root', 'toor') || die "Could not connect to database: $DBI::errstr";
$dbh->do('set names utf8');
my $sth = $dbh->prepare("SELECT u.id, u.name, u.surname, u.tag, l.created FROM users as u JOIN log as l on l.tag=u.tag GROUP BY u.id ORDER BY l.created DESC LIMIT 10");
$sth->execute();
my $a = $sth->fetchall_hashref("tag");
warn Dumper $a;
$self->render(
users => $a,
}

1;
1,145 changes: 1,145 additions & 0 deletions log/development.log

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html><html>
<head>
<title>Welcome to the Mojolicious real-time web framework!</title>
</head>
<body>
<h2>Welcome to the Mojolicious real-time web framework!</h2>
This is the static document "public/index.html",
<a href="/welcome">click here</a> to get back to the start.
</body>
</html>
Loading

0 comments on commit dbb11d9

Please sign in to comment.