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