/[Frey]/trunk/lib/Frey/MapReduce.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/MapReduce.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 820 - (hide annotations)
Fri Dec 12 18:01:48 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 764 byte(s)
trivial map-reduce on yaml files
1 dpavlin 820 package Frey::MapReduce;
2     use Moose;
3    
4     extends 'Frey';
5     with 'Frey::Web';
6     with 'Frey::Storage';
7     with 'Frey::File';
8    
9     use YAML qw/LoadFile/;
10    
11     has path => (
12     is => 'rw',
13     isa => 'Str',
14     required => 1,
15     default => 'var/introspect/',
16     );
17    
18     sub as_markup {
19     my ($self) = @_;
20    
21     my $introspect;
22    
23     my @files = map {
24     my $class = $_;
25     my $path = $self->path . '/' . $_;
26     my $data = LoadFile( $path );
27     $data = [ keys %{ $data->{ 'runnable' } } ];
28    
29     $class =~ s{\.ya?ml$}{};
30     $introspect->{ $class } = $data;
31     $_;
32     } $self->dir_extension( $self->path, '\.(ya?ml)$' );
33    
34     warn "# introspect ", $self->dump( $introspect );
35    
36     $self->store('var/Frey/Class/Browser/runnable.yaml', $introspect );
37    
38     return $self->dump({
39     files => \@files,
40     introspect => $introspect,
41     });
42     }
43    
44     1;

  ViewVC Help
Powered by ViewVC 1.1.26