Anonymous avatar Anonymous committed 58c752f

Eliminated the rest of the Readonly variables.

Comments (0)

Files changed (2)

CPANPLUS-Dist-Fedora/Changes

  memoized method that gets called at run time.
     - Fixes the build errors reported in:
         - http://nntp.x.perl.org/group/perl.cpan.testers/2202219
+ - Eliminated the rest of the Readonly variables and converted them to
+ object methods.
  
 0.0.2 TODO: FILL IN.
  - Applied a modified version of Chris Weyl's patch to 

CPANPLUS-Dist-Fedora/lib/CPANPLUS/Dist/Fedora.pm

 use Pod::POM;
 use Pod::POM::View::Text;
 use POSIX qw[ strftime ];
-use Readonly;
 use Text::Wrap;
 use Template;
 
 our $VERSION = '0.0.2';
 
-Readonly my $DIR => cwd;
-
-# Dealing with DATA gets increasingly messy, IMHO
-Readonly my $SPEC_TEMPLATE => <<'END_SPEC';
+sub _get_spec_template
+{
+    # Dealing with DATA gets increasingly messy, IMHO
+    # So we're going to use the Template Toolkit instead
+    return <<'END_SPEC';
 
 Name:       [% status.rpmname %] 
 Version:    [% status.distvers %] 
 - initial Fedora packaging
 - generated with cpan2dist (CPANPLUS::Dist::Fedora version [% packagervers %])
 END_SPEC
+}
 
 #--
 # class methods
           ]
     );
 
+    # This is done to initialise it.
+    $self->_get_current_dir();
+
     return 1;
 }
 
     $status->description(_module_description($module));
     $status->license(_module_license($module));
     #$status->disttop($module->name=~ /([^:]+)::/);
-    my $dir = $status->rpmdir($DIR);
+    my $dir = $status->rpmdir($self->_current_dir());
     $status->rpmvers(1);
 
     # Cache files
 
     # Prepare our template
     my $tmpl = Template->new({ EVAL_PERL => 1 });
+
+    my $spec_template = $self->_get_spec_template();
     
     # Process template into spec
     $tmpl->process(
-        \$SPEC_TEMPLATE, 
+        \$spec_template, 
         {
             status    => $status,
             module    => $module,
 
     return $self->{_packager};
 }
+
+sub _get_current_dir
+{
+    my $self = shift;
+
+    # Memoize it.
+    if (!defined($self->{_current_dir}))
+    {
+        $self->{_current_dir} = cwd();
+    }
+
+    return $self->{_current_dir};
+}
+
 1;
 
 __END__
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.