Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Begin documentation.

I've stopped for the moment to shave a yak with Dist::Zilla.
  • Loading branch information...
commit 334c0b866d07f92ebfea613cad0347bf3e1a8187 1 parent e0cf782
Rocco Caputo authored
25 docs/eg-14-synopsis.pl
... ... @@ -0,0 +1,25 @@
  1 +#!/usr/bin/env perl
  2 +
  3 +use warnings;
  4 +use strict;
  5 +use lib qw(lib);
  6 +
  7 +{
  8 + package App;
  9 + use Moose;
  10 + extends 'Reflex::Object';
  11 + use Reflex::Timer;
  12 +
  13 + has ticker => (
  14 + isa => 'Reflex::Timer',
  15 + is => 'rw',
  16 + setup => { interval => 1, auto_repeat => 1 },
  17 + traits => [ 'Reflex::Trait::Observer' ],
  18 + );
  19 +
  20 + sub on_ticker_tick {
  21 + print "tick at ", scalar(localtime), "...\n";
  22 + }
  23 +}
  24 +
  25 +exit App->new()->run_all();
111 docs/lib/Reflex.pm
... ... @@ -0,0 +1,111 @@
  1 +package Reflex;
  2 +
  3 +use warnings;
  4 +use strict;
  5 +
  6 +use Carp qw(croak);
  7 +
  8 +our $VERSION = '0.001';
  9 +
  10 +sub import {
  11 + my $class = shift;
  12 + my $caller_package = caller();
  13 +
  14 + # Use the packages in the caller's package.
  15 + # TODO - I think lexical magic isn't supported.
  16 +
  17 + eval join(
  18 + "; ",
  19 + "package $caller_package",
  20 + map { "use $class\::$_" }
  21 + @_
  22 + );
  23 +
  24 +
  25 + # Rewrite the error so that it comes from the caller.
  26 + if ($@) {
  27 + my $msg = $@;
  28 + $msg =~ s/(\(\@INC contains.*?\)) at .*/$1/s;
  29 + croak $msg;
  30 + }
  31 +}
  32 +
  33 +1;
  34 +
  35 +__END__
  36 +
  37 +=head1 NAME
  38 +
  39 +Reflex - Reactive classes for flexible programs.
  40 +
  41 +=head1 SYNOPSIS
  42 +
  43 + {
  44 + package App;
  45 + use Moose;
  46 + extends 'Reflex::Object';
  47 + use Reflex::Timer;
  48 +
  49 + has ticker => (
  50 + isa => 'Reflex::Timer',
  51 + is => 'rw',
  52 + setup => { interval => 1, auto_repeat => 1 },
  53 + traits => [ 'Reflex::Trait::Observer' ],
  54 + );
  55 +
  56 + sub on_ticker_tick {
  57 + print "tick at ", scalar(localtime), "...\n";
  58 + }
  59 + }
  60 +
  61 + exit App->new()->run_all();
  62 +
  63 +=head1 DESCRIPTION
  64 +
  65 +Reflex is a suite of classes to help programmers write reactive
  66 +programs. More to come
  67 +
  68 +=head1 GETTING HELP
  69 +
  70 +POE's mailing list.
  71 +Channel #poe on irc.perl.org.
  72 +
  73 +=head1 ACKNOWLEDGEMENTS
  74 +
  75 +irc.perl.org channel #moose and #poe. The former for assisting in
  76 +learning their fine libraries, sometimes against everyone's better
  77 +judgement. The latter for putting up with lengthy and sometimes
  78 +irrelevant design discussion for oh so long.
  79 +
  80 +=head1 SEE ALSO
  81 +
  82 +Moose
  83 +POE
  84 +Ohlo
  85 +Reflex namespace on CPAN.
  86 +Links to tutorials & reviews.
  87 +Home page for Reflex.
  88 +
  89 +=head1 BUGS
  90 +
  91 +TODO - Link to Reflex's RT queue. Explain how to send e-mail, too.
  92 +
  93 +=head1 AUTHORS
  94 +
  95 +Rocco Caputo
  96 +Point out that it's a FOSS project, and anyone may contribute.
  97 +
  98 +=head2 OTHER CONTRIBUTORS
  99 +
  100 +List here, when there are some.
  101 +
  102 +=head1 COPYRIGHT AND LICCENSE
  103 +
  104 +Copyright 2009 by Rocco Caputo.
  105 +
  106 +Reflex is free software. You may redistribute and/or modify it under
  107 +the same terms as Perl itself.
  108 +
  109 +TODO - Recommended best practice for licenses.
  110 +
  111 +=cut
28 docs/lib/Reflex/UdpPeer.pm
@@ -11,3 +11,31 @@ no Moose;
11 11 __PACKAGE__->meta()->make_immutable();
12 12
13 13 1;
  14 +
  15 +__END__
  16 +
  17 +=head1 NAME
  18 +
  19 +Reflex::UdpPeer - Base class for reactive UDP peers.
  20 +
  21 +=head1 DESCRIPTION
  22 +
  23 +Reflex::UdpPeer is a base class for reactive UDP peers. It takes all
  24 +its functionality from Reflex::Role::UdpPeer, so please see that
  25 +module for documentation.
  26 +
  27 +=head1 SEE ALSO
  28 +
  29 +Reflex::Role::UdpPeer - Documents Reflex::UdpPeer.
  30 +
  31 +=head1 BUGS
  32 +
  33 +TODO - Link to RT.
  34 +
  35 +=head1 AUTHORS
  36 +
  37 +Rocco Caputo.
  38 +
  39 +=head1 COPYRIGHT AND LICENSE
  40 +
  41 +=cut
49 docs/requirements.otl
... ... @@ -1,4 +1,4 @@
1   -[_] 54% Framework Requirements
  1 +[_] 51% Framework Requirements
2 2 About
3 3 This document summarizes the best ideas from the patterns document.
4 4 The patterns document tries to enumerate all available options.
@@ -114,6 +114,7 @@
114 114 Is this not obvious?
115 115 [_] 0% Class Methods
116 116 Classes may be used as singletons.
  117 + [_] 0% Do we want to support this?
117 118 [_] 0% Messages must be associated with their triggers.
118 119 [_] 0% One message may trigger another, inner message.
119 120 [_] 0% The inner message must be associated with the outer message.
@@ -148,10 +149,12 @@
148 149 [_] 0% Receiver data is not visible to the sender.
149 150 [_] 0% Message-scoped resources should be stored in the message's continuation.
150 151 [_] 0% Message cancelation triggers associated resource cleanup.
151   - [_] 56% Common primitive classes must be provided.
152   - [_] 54% Low-level event watchers.
153   - [X] 100% Reflex::Handle
154   - [_] 25% Reflex::Timer
  152 + [_] 34% Common primitive classes must be provided.
  153 + [_] 2% Low-level event watchers.
  154 + [_] 0% Reflex::Handle
  155 + [_] 0% Determine API.
  156 + [_] 16% Reflex::Timer
  157 + [_] 0% Determine full API.
155 158 [_] 50% Delay a number of seconds.
156 159 [X] 100% Repeat with drift.
157 160 [_] 0% Repeat without drift.
@@ -160,21 +163,44 @@
160 163 [_] 0% Use DateTime for interval math.
161 164 [_] 0% Reflex::Cron
162 165 Wait for repeating times.
163   - [X] 100% Reflex::Signal
164   - [X] 100% Reflex::PID (SIGCHLD)
  166 + [_] 0% Determine API.
  167 + See POE::Component::Cron for clues.
  168 + Would Chris Fedde like to work on this?
  169 + [_] 0% Reflex::Signal
  170 + [_] 0% Determine API.
  171 + [_] 0% Reflex::PID (SIGCHLD)
  172 + [_] 0% Determine API.
165 173 [_] 0% What else?
166   - [_] 16% Primitive program pieces.
  174 + [_] 0% Primitive program pieces.
167 175 [_] 0% Reflex::App
  176 + [_] 0% Determine API.
168 177 [_] 0% Reflex::Client::HTTP
169 178 [_] 0% Reflex::Connector::Keepalive
170 179 [_] 0% Reflex::Connector
  180 + [_] 0% Determine API.
171 181 [_] 0% Reflex::Resolver
  182 + [_] 0% Determine API.
  183 + [_] 0% Determine how to make asynchronous.
  184 + Forked?
  185 + Coro?
  186 + Threads?
  187 + [_] 0% IPV4
  188 + [_] 0% IPv6
172 189 [_] 0% Reflex::Socket
  190 + [_] 0% Determine API.
173 191 [_] 0% Reflex::Stream
174 192 Use Data::Transform internally to parse & marshall data.
175 193 [_] 0% Reflex::Listener
  194 + [_] 0% Determine API.
  195 + See POE::Wheel::ListenAccept for clues.
176 196 [_] 0% Reflex::Process
177   - [X] 100% Reflex::UdpPeer
  197 + [_] 0% Determine API.
  198 + See POE::Wheel::Run for clues.
  199 + [_] 0% Reflex::UdpPeer
  200 + [_] 0% Determine API.
  201 + [_] 0% Reflex::Tail
  202 + [_] 0% Determine API.
  203 + See POE::Wheel::FollowTail for clues.
178 204 [_] 0% What else? Probably a lot!
179 205 [X] 100% POE Interfaces
180 206 [X] 100% Wheel wrappers.
@@ -210,10 +236,13 @@
210 236 my $event = Reflex::POE::Event->new(...);
211 237 $_[KERNEL]->post($event, @callback_params);
212 238 Syntax if events may not be blessed
213   - [X] 100% TODO
  239 + About
214 240 Some explicit cleanup must be provided and adhered to.
215 241 Rely on object DEMOLISH to automatically clean up for us.
216 242 CAVEAT: Components that stringify event names will fail.
  243 + Sorry, but they must be blessed for now.
  244 + The bless and DEMOLISH tracking is very convenient.
  245 + I haven't found a good, reliable way to avoid it.
217 246 Dispatch Mechanism
218 247 _default
219 248 Events that are objects in the Reflex::POE::Event class are invoked to deliver themselves.

0 comments on commit 334c0b8

Please sign in to comment.
Something went wrong with that request. Please try again.