Browse files

[proof-of-concept] lazily load ecosystem

Since it takes a bit of time to load a non-small JSON file, we defer this
task to when it's actually needed.
  • Loading branch information...
1 parent e737b38 commit d69966ef578876eb2523e3aa50a792e9f23bc601 @masak committed Jul 3, 2010
Showing with 5 additions and 5 deletions.
  1. +5 −5 proof-of-concept
View
10 proof-of-concept
@@ -38,8 +38,13 @@ class POC::ProjectsState is App::Pls::ProjectsState::Hash does FileBackend {
class POC::Ecosystem does App::Pls::Ecosystem does FileBackend {
has %.projects is rw;
+ has $!loaded-projects-file = False;
method project-info(Str $project --> Project) {
+ # This is *so* nice!
+ unless $!loaded-projects-file++ {
+ self.load-from-file;
+ }
die "No such project: $project"
unless %!projects.exists($project);
my %info = %.projects{$project};
@@ -266,13 +271,8 @@ class POC::Installer does App::Pls::Installer {
sub MAIN(Bool :$force) {
my $projstate = POC::ProjectsState.new(:filename("poc-projects.state"));
- note "Loading projects state...";
$projstate.load-from-file;
- note "...done.";
my $ecosystem = POC::Ecosystem.new(:filename("poc-projects.list"));
- note "Loading ecosystem...";
- $ecosystem.load-from-file;
- note "...done.";
my $core = App::Pls::Core.new(
:projects($projstate),

0 comments on commit d69966e

Please sign in to comment.