| 1 | package Zing::Kernel; | ||
| 2 | |||
| 3 | use 5.014; | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use registry 'Zing::Types'; | ||
| 9 | use routines; | ||
| 10 | |||
| 11 | use Data::Object::Class; | ||
| 12 | use Data::Object::ClassHas; | ||
| 13 | |||
| 14 | extends 'Zing::Watcher'; | ||
| 15 | |||
| 16 | use Zing::Logic::Kernel; | ||
| 17 | |||
| 18 | our $VERSION = '0.26'; # VERSION | ||
| 19 | |||
| 20 | # ATTRIBUTES | ||
| 21 | |||
| 22 | has 'journal' => ( | ||
| 23 | is => 'ro', | ||
| 24 | isa => 'Channel', | ||
| 25 | new => 1, | ||
| 26 | ); | ||
| 27 | |||
| 28 | fun new_journal($self) { | ||
| 29 | $self->app->journal | ||
| 30 | } | ||
| 31 | |||
| 32 | has 'scheme' => ( | ||
| 33 | is => 'ro', | ||
| 34 | isa => 'Scheme', | ||
| 35 | req => 1, | ||
| 36 | ); | ||
| 37 | |||
| 38 | # BUILDERS | ||
| 39 | |||
| 40 | fun new_logic($self) { | ||
| 41 | my $debug = $self->env->debug; | ||
| 42 | Zing::Logic::Kernel->new(debug => $debug, process => $self) | ||
| 43 | } | ||
| 44 | |||
| 45 | # METHODS | ||
| 46 | |||
| 47 | method term() { | ||
| 48 | return $self->app->term($self)->kernel; | ||
| 49 | } | ||
| 50 | |||
| 51 | 1; | ||
| 52 | |||
| 53 | =encoding utf8 | ||
| 54 | |||
| 55 | =head1 NAME | ||
| 56 | |||
| 57 | Zing::Kernel - Kernel Process | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | =head1 ABSTRACT | ||
| 62 | |||
| 63 | Kernel Watcher Process | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | =head1 SYNOPSIS | ||
| 68 | |||
| 69 | use Zing::Kernel; | ||
| 70 | |||
| 71 | my $kernel = Zing::Kernel->new(scheme => ['MyApp', [], 1]); | ||
| 72 | |||
| 73 | # $kernel->execute; | ||
| 74 | |||
| 75 | =cut | ||
| 76 | |||
| 77 | =head1 DESCRIPTION | ||
| 78 | |||
| 79 | This package provides a watcher process which launches the scheme and | ||
| 80 | supervises the resulting process, and thus is a system manager with control | ||
| 81 | over everything in the system. | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | =head1 INHERITS | ||
| 86 | |||
| 87 | This package inherits behaviors from: | ||
| 88 | |||
| 89 | L<Zing::Watcher> | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | =head1 LIBRARIES | ||
| 94 | |||
| 95 | This package uses type constraints from: | ||
| 96 | |||
| 97 | L<Zing::Types> | ||
| 98 | |||
| 99 | =cut | ||
| 100 | |||
| 101 | =head1 ATTRIBUTES | ||
| 102 | |||
| 103 | This package has the following attributes: | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | =head2 journal | ||
| 108 | |||
| 109 | journal(Channel) | ||
| 110 | |||
| 111 | This attribute is read-only, accepts C<(Channel)> values, and is optional. | ||
| 112 | |||
| 113 | =cut | ||
| 114 | |||
| 115 | =head2 scheme | ||
| 116 | |||
| 117 | scheme(Scheme) | ||
| 118 | |||
| 119 | This attribute is read-only, accepts C<(Scheme)> values, and is required. | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | =head1 METHODS | ||
| 124 | |||
| 125 | This package implements the following methods: | ||
| 126 | |||
| 127 | =cut | ||
| 128 | |||
| 129 | =head2 execute | ||
| 130 | |||
| 131 | execute() : Object | ||
| 132 | |||
| 133 | The execute method launches the scheme and executes the event-loops for all | ||
| 134 | processes. | ||
| 135 | |||
| 136 | =over 4 | ||
| 137 | |||
| 138 | =item execute example #1 | ||
| 139 | |||
| 140 | # given: synopsis | ||
| 141 | |||
| 142 | $kernel->execute; | ||
| 143 | |||
| 144 | =back | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | =head1 AUTHOR | ||
| 149 | |||
| 150 | Al Newkirk, C<awncorp@cpan.org> | ||
| 151 | |||
| 152 | =head1 LICENSE | ||
| 153 | |||
| 154 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||
| 155 | |||
| 156 | This is free software; you can redistribute it and/or modify it under the terms | ||
| 157 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||
| 158 | file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>. | ||
| 159 | |||
| 160 | =head1 PROJECT | ||
| 161 | |||
| 162 | L<Wiki|https://github.com/iamalnewkirk/zing/wiki> | ||
| 163 | |||
| 164 | L<Project|https://github.com/iamalnewkirk/zing> | ||
| 165 | |||
| 166 | L<Initiatives|https://github.com/iamalnewkirk/zing/projects> | ||
| 167 | |||
| 168 | L<Milestones|https://github.com/iamalnewkirk/zing/milestones> | ||
| 169 | |||
| 170 | L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md> | ||
| 171 | |||
| 172 | L<Issues|https://github.com/iamalnewkirk/zing/issues> | ||
| 173 | |||
| 174 | =cut |