Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
View
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+use lib qw(lib);
+
+{
+ package App;
+ use Moose;
+ extends 'Reflex::Object';
+ use Reflex::Timer;
+
+ has ticker => (
+ isa => 'Reflex::Timer',
+ is => 'rw',
+ setup => { interval => 1, auto_repeat => 1 },
+ traits => [ 'Reflex::Trait::Observer' ],
+ );
+
+ sub on_ticker_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
+}
+
+exit App->new()->run_all();
111 docs/lib/Reflex.pm
View
@@ -0,0 +1,111 @@
+package Reflex;
+
+use warnings;
+use strict;
+
+use Carp qw(croak);
+
+our $VERSION = '0.001';
+
+sub import {
+ my $class = shift;
+ my $caller_package = caller();
+
+ # Use the packages in the caller's package.
+ # TODO - I think lexical magic isn't supported.
+
+ eval join(
+ "; ",
+ "package $caller_package",
+ map { "use $class\::$_" }
+ @_
+ );
+
+
+ # Rewrite the error so that it comes from the caller.
+ if ($@) {
+ my $msg = $@;
+ $msg =~ s/(\(\@INC contains.*?\)) at .*/$1/s;
+ croak $msg;
+ }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Reflex - Reactive classes for flexible programs.
+
+=head1 SYNOPSIS
+
+ {
+ package App;
+ use Moose;
+ extends 'Reflex::Object';
+ use Reflex::Timer;
+
+ has ticker => (
+ isa => 'Reflex::Timer',
+ is => 'rw',
+ setup => { interval => 1, auto_repeat => 1 },
+ traits => [ 'Reflex::Trait::Observer' ],
+ );
+
+ sub on_ticker_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
+ }
+
+ exit App->new()->run_all();
+
+=head1 DESCRIPTION
+
+Reflex is a suite of classes to help programmers write reactive
+programs. More to come
+
+=head1 GETTING HELP
+
+POE's mailing list.
+Channel #poe on irc.perl.org.
+
+=head1 ACKNOWLEDGEMENTS
+
+irc.perl.org channel #moose and #poe. The former for assisting in
+learning their fine libraries, sometimes against everyone's better
+judgement. The latter for putting up with lengthy and sometimes
+irrelevant design discussion for oh so long.
+
+=head1 SEE ALSO
+
+Moose
+POE
+Ohlo
+Reflex namespace on CPAN.
+Links to tutorials & reviews.
+Home page for Reflex.
+
+=head1 BUGS
+
+TODO - Link to Reflex's RT queue. Explain how to send e-mail, too.
+
+=head1 AUTHORS
+
+Rocco Caputo
+Point out that it's a FOSS project, and anyone may contribute.
+
+=head2 OTHER CONTRIBUTORS
+
+List here, when there are some.
+
+=head1 COPYRIGHT AND LICCENSE
+
+Copyright 2009 by Rocco Caputo.
+
+Reflex is free software. You may redistribute and/or modify it under
+the same terms as Perl itself.
+
+TODO - Recommended best practice for licenses.
+
+=cut
28 docs/lib/Reflex/UdpPeer.pm
View
@@ -11,3 +11,31 @@ no Moose;
__PACKAGE__->meta()->make_immutable();
1;
+
+__END__
+
+=head1 NAME
+
+Reflex::UdpPeer - Base class for reactive UDP peers.
+
+=head1 DESCRIPTION
+
+Reflex::UdpPeer is a base class for reactive UDP peers. It takes all
+its functionality from Reflex::Role::UdpPeer, so please see that
+module for documentation.
+
+=head1 SEE ALSO
+
+Reflex::Role::UdpPeer - Documents Reflex::UdpPeer.
+
+=head1 BUGS
+
+TODO - Link to RT.
+
+=head1 AUTHORS
+
+Rocco Caputo.
+
+=head1 COPYRIGHT AND LICENSE
+
+=cut
49 docs/requirements.otl
View
@@ -1,4 +1,4 @@
-[_] 54% Framework Requirements
+[_] 51% Framework Requirements
About
This document summarizes the best ideas from the patterns document.
The patterns document tries to enumerate all available options.
@@ -114,6 +114,7 @@
Is this not obvious?
[_] 0% Class Methods
Classes may be used as singletons.
+ [_] 0% Do we want to support this?
[_] 0% Messages must be associated with their triggers.
[_] 0% One message may trigger another, inner message.
[_] 0% The inner message must be associated with the outer message.
@@ -148,10 +149,12 @@
[_] 0% Receiver data is not visible to the sender.
[_] 0% Message-scoped resources should be stored in the message's continuation.
[_] 0% Message cancelation triggers associated resource cleanup.
- [_] 56% Common primitive classes must be provided.
- [_] 54% Low-level event watchers.
- [X] 100% Reflex::Handle
- [_] 25% Reflex::Timer
+ [_] 34% Common primitive classes must be provided.
+ [_] 2% Low-level event watchers.
+ [_] 0% Reflex::Handle
+ [_] 0% Determine API.
+ [_] 16% Reflex::Timer
+ [_] 0% Determine full API.
[_] 50% Delay a number of seconds.
[X] 100% Repeat with drift.
[_] 0% Repeat without drift.
@@ -160,21 +163,44 @@
[_] 0% Use DateTime for interval math.
[_] 0% Reflex::Cron
Wait for repeating times.
- [X] 100% Reflex::Signal
- [X] 100% Reflex::PID (SIGCHLD)
+ [_] 0% Determine API.
+ See POE::Component::Cron for clues.
+ Would Chris Fedde like to work on this?
+ [_] 0% Reflex::Signal
+ [_] 0% Determine API.
+ [_] 0% Reflex::PID (SIGCHLD)
+ [_] 0% Determine API.
[_] 0% What else?
- [_] 16% Primitive program pieces.
+ [_] 0% Primitive program pieces.
[_] 0% Reflex::App
+ [_] 0% Determine API.
[_] 0% Reflex::Client::HTTP
[_] 0% Reflex::Connector::Keepalive
[_] 0% Reflex::Connector
+ [_] 0% Determine API.
[_] 0% Reflex::Resolver
+ [_] 0% Determine API.
+ [_] 0% Determine how to make asynchronous.
+ Forked?
+ Coro?
+ Threads?
+ [_] 0% IPV4
+ [_] 0% IPv6
[_] 0% Reflex::Socket
+ [_] 0% Determine API.
[_] 0% Reflex::Stream
Use Data::Transform internally to parse & marshall data.
[_] 0% Reflex::Listener
+ [_] 0% Determine API.
+ See POE::Wheel::ListenAccept for clues.
[_] 0% Reflex::Process
- [X] 100% Reflex::UdpPeer
+ [_] 0% Determine API.
+ See POE::Wheel::Run for clues.
+ [_] 0% Reflex::UdpPeer
+ [_] 0% Determine API.
+ [_] 0% Reflex::Tail
+ [_] 0% Determine API.
+ See POE::Wheel::FollowTail for clues.
[_] 0% What else? Probably a lot!
[X] 100% POE Interfaces
[X] 100% Wheel wrappers.
@@ -210,10 +236,13 @@
my $event = Reflex::POE::Event->new(...);
$_[KERNEL]->post($event, @callback_params);
Syntax if events may not be blessed
- [X] 100% TODO
+ About
Some explicit cleanup must be provided and adhered to.
Rely on object DEMOLISH to automatically clean up for us.
CAVEAT: Components that stringify event names will fail.
+ Sorry, but they must be blessed for now.
+ The bless and DEMOLISH tracking is very convenient.
+ I haven't found a good, reliable way to avoid it.
Dispatch Mechanism
_default
Events that are objects in the Reflex::POE::Event class are invoked to deliver themselves.
Please sign in to comment.
Something went wrong with that request. Please try again.