Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use Mojolicious::Lite;
- use lib 'lib';
- use Hostinfo;
- use Conty;
- get '/' => 'index';
- helper 'hostinfo' => sub { Hostinfo->new() };
- helper 'conty' => sub { Conty->new() };
- websocket '/stylehouse' => sub {
- my $self = shift;
- $self->app->log->info("WebSocket opened");
- $self->on(message => sub {
- my ($self, $msg) = @_;
- $self->app->log->info("WebSocket: $msg");
- Mojo::IOLoop->stream($self->tx->connection)->timeout(300000);
- $self->conty->message($self, $msg);
- });
- $self->app->log->info("happens:!". anydump($self->app->conty));
- $self->conty->initiate();
- };
- package Conty;
- use Mojo::Base 'Mojolicious::Controller';
- use Scriptalicious;
- use Texty;
- my @apps;
- sub initiate { # notice a screen
- my $self = shift;
- $self->app->log->info("Doesn't work". anydump($self->app->conty));
- # Can't locate object method "conty" via package "Mojolicious" at lib/Conty.pm line 10.
- # or $self->hostinfo
- $self->app->send("ws.send('screen: '+screen.availWidth+'x'+screen.availHeight.')");
- # startup things...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement