root/lang/perl/Plusen/trunk/lib/Plusen.pm @ 6705

Revision 6705, 1.4 kB (checked in by yappo, 5 years ago)

lang/perl/Plusen: import

Line 
1package Plusen;
2
3use strict;
4use warnings;
5our $VERSION = '0.01';
6
7use Class::Component;
8__PACKAGE__->load_components(qw/ Plaggerize /);
9
10use base 'Class::Accessor::Fast';
11__PACKAGE__->mk_accessors(qw/ script is_exit /);
12
13use Encode ();
14use Plusen::Script;
15
16sub new {
17    my($class, $args) = @_;
18    my $self = $class->NEXT( new => $args );
19
20    $self->script( Plusen::Script->new({ c => $self }) );
21
22    $self->script->$_( Encode::encode('utf8', $self->conf->{meta}->{$_}) ) for qw/ title author email /;
23    $self->is_exit(0);
24
25    $self;
26}
27
28sub bootstrap {
29    my $class = shift;
30    my $self  = $class->new( @_ );
31
32    $self->run_hook('script.load');
33    $self->run_hook('device.init');
34
35    $self->script->top;
36
37    $self->event_loop;
38
39    $self;
40}
41
42sub event_loop {
43    my $self = shift;
44    while (!$self->is_exit) {
45        $self->run_hook('device.read');
46        sleep 0.2;
47    }
48}
49
501;
51__END__
52
53=head1 NAME
54
55Plusen - pluggable presentation framework
56
57=head1 SYNOPSIS
58
59  use Plusen;
60
61=head1 DESCRIPTION
62
63Plusen is
64
65=head1 AUTHOR
66
67Kazuhiro Osawa E<lt>ko@yappo.ne.jpE<gt>
68
69=head1 SEE ALSO
70
71=head1 EXAMPLE
72
73L<http://svn.coderepos.org/share/docs/yappo/devsumi2008/devsumi2008.pl>,
74L<http://svn.coderepos.org/share/docs/yappo/devsumi2008/devsumi2008.yaml>,
75
76=head1 LICENSE
77
78This library is free software; you can redistribute it and/or modify
79it under the same terms as Perl itself.
80
81=cut
Note: See TracBrowser for help on using the browser.