-
Notifications
You must be signed in to change notification settings - Fork 581
Emitted Events
Stefan Adams edited this page Dec 7, 2024
·
1 revision
Sometimes it would be nice to know all of the events that can be emitted in a Mojolicious app!
$ INC="$(perl -MMojo -e 'print map { $INC{$_} =~ s/Mojo.pm//; $INC{$_} } grep /Mojo.pm/, keys %INC')"; grep VERSION $INC/Mojolicious.pm ; for f in $(find $INC -name '*.pm' -path '*ojo*'); do grep -H -o -P "emit\([^\)]+\)" $f; done | sort | perl -p -E 's/^.*\/(?=Mojo\/)//; s/^(.*).pm:(?=emit)/$1\n\t/' | perl -n -E 'print and next if /^\s/; s/\//::/g; next if $_{$_}; ++$_{$_} and print'
our $VERSION = '9.38';
Mojo::Asset::Memory
emit(upgrade => my $file = Mojo::Asset::File->new)
Mojo::Content
emit('body')
emit(drain => $offset)
emit(read => $chunk)
emit(read => $out)
Mojo::Content::MultiPart
emit(part => $part)
Mojo::Content::Single
emit(upgrade => $multi)
Mojo::EventEmitter
emit('foo')
emit('foo', 123)
emit(roar => 3)
Mojo::IOLoop
emit('finish')
emit('reset')
Mojo::IOLoop::Client
emit(connect => $handle)
emit(connect => pop)
emit(error => "Can't connect: $@")
emit(error => "Can't resolve: $err")
emit(error => $! || 'Not connected')
emit(error => $!)
emit(error => $err)
emit(error => 'Connect timeout')
emit(error => 'IO::Socket::Socks 0.64+ required for SOCKS support')
emit(error => 'SOCKS upgrade failed')
emit(error => pop)
Mojo::IOLoop::Server
emit(accept => $handle)
emit(accept => pop)
Mojo::IOLoop::Stream
emit('close')
emit('drain')
emit('timeout')
emit(error => $!)
emit(read => $buffer)
emit(write => substr($self->{buffer}, 0, $written, '')
Mojo::IOLoop::Subprocess
emit('cleanup')
emit('spawn')
emit(progress => @$args)
Mojo::IOLoop::TLS
emit(error => $IO::Socket::SSL::SSL_ERROR)
emit(error => $_[1])
emit(error => 'IO::Socket::SSL 2.009+ required for TLS support')
emit(upgrade => delete $self->{handle})
Mojo::Log
emit('message', $level, @msgs)
Mojo::Message
emit('finish')
emit('progress')
emit('progress', 'body', $offset)
emit('progress', 'headers', $offset)
Mojo::Message::Request
emit(progress => 'start_line', $offset)
Mojo::Message::Response
emit(progress => 'start_line', $offset)
Mojo::Reactor::Poll
emit(error => "$what failed: $@")
Mojo::SMTP::Client
emit('start')
emit(response => $this->{last_cmd}, $resp)
Mojo::SQLite
emit(connection => $dbh)
Mojo::Sendgrid::Mail
emit(mail_send => @_)
Mojo::Server
emit(request => $tx)
Mojo::Server::CGI
emit(request => $tx)
Mojo::Server::Daemon
emit(request => $tx)
emit(request => server_handshake $ws)
Mojo::Server::PSGI
emit(request => $tx)
Mojo::Server::Prefork
emit('wait')
emit(finish => $graceful)
emit(heartbeat => $1)
emit(reap => $pid)
emit(spawn => $pid)
Mojo::Transaction
emit('finish')
emit(connection => $self->{connection} = shift)
Mojo::Transaction::HTTP
emit('request')
emit('resume')
emit(unexpected => $res)
Mojo::Transaction::WebSocket
emit($op == WS_TEXT ? 'text' : 'binary' => $msg)
emit('drain')
emit('resume')
emit('resume')
emit(finish => @args > 1 ? @args : (@args, undef)
emit(frame => $frame)
emit(json => j($msg)
emit(message => $op == WS_TEXT ? decode 'UTF-8', $msg : $msg)
Mojo::UserAgent
emit(prepare => $tx)
emit(start => $tx)