<commit_before>#!/usr/bin/perl
use v5.14;
use warnings;
use AnyEvent;
use UAV::Pilot::ARDrone::Driver::Mock;
use UAV::Pilot::ARDrone::Video::Mock;
use UAV::Pilot::SDL::Video;
use UAV::Pilot::SDL::Window;
use UAV::Pilot::Video::H264Decoder;


{
    my $cv = AnyEvent->condvar;

    my $driver = UAV::Pilot::ARDrone::Driver::Mock->new({
        host => 'localhost',
    });
    $driver->connect;

    my $window = UAV::Pilot::SDL::Window->new;

    my $vid_display = UAV::Pilot::SDL::Video->new;
    my @displays = ($vid_display);
    my @h264_handlers = (UAV::Pilot::Video::H264Decoder->new({
        displays => \@displays,
    }));
    $vid_display->add_to_window( $window );

    my $video = UAV::Pilot::ARDrone::Video::Mock->new({
        fh       => \*STDIN,
        handlers => \@h264_handlers,
        condvar  => $cv,
        driver   => $driver,
    });

    $video->init_event_loop;
    $cv->recv;
}<commit_msg>Register all the events that need registering<commit_after>#!/usr/bin/perl
use v5.14;
use warnings;
use AnyEvent;
use UAV::Pilot::ARDrone::Driver::Mock;
use UAV::Pilot::ARDrone::Video::Mock;
use UAV::Pilot::Events;
use UAV::Pilot::SDL::Events;
use UAV::Pilot::SDL::Video;
use UAV::Pilot::SDL::Window;
use UAV::Pilot::Video::H264Decoder;


{
    my $cv = AnyEvent->condvar;
    my $events = UAV::Pilot::Events->new({
        condvar => $cv,
    });

    my $driver = UAV::Pilot::ARDrone::Driver::Mock->new({
        host => 'localhost',
    });
    $driver->connect;

    my $window = UAV::Pilot::SDL::Window->new;

    my $vid_display = UAV::Pilot::SDL::Video->new;
    my @displays = ($vid_display);
    my @h264_handlers = (UAV::Pilot::Video::H264Decoder->new({
        displays => \@displays,
    }));
    $vid_display->add_to_window( $window );

    my $video = UAV::Pilot::ARDrone::Video::Mock->new({
        fh       => \*STDIN,
        handlers => \@h264_handlers,
        condvar  => $cv,
        driver   => $driver,
    });

    my $sdl_events = UAV::Pilot::SDL::Events->new;

    $events->register( $_ ) for $sdl_events, $window;
    $_->init_event_loop for $video, $events;
    $cv->recv;
}
{'fraction_non_alphanumeric': 0.19839773798303487, 'fraction_numerical': 0.01413760603204524, 'mean_word_length': 3.4229166666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5367655', 'n_tokens_mistral': 865, 'n_tokens_neox': 785, 'n_words': 135}