Ignore:
Timestamp:
Sep 20, 2004, 3:59:43 PM (17 years ago)
Author:
kake
Message:

Added option of munging in custom lib paths on install.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Build.pm

    r500 r501  
    5757    my $script_name       = $config->{_}->{script_name};
    5858    my $template_path     = $config->{_}->{template_path};
     59    my $custom_lib_path   = $config->{_}->{custom_lib_path};
    5960    my @extra_scripts     = @{ $self->{config}{__extra_scripts} };
    6061    my @templates         = @{ $self->{config}{__templates} };
     
    7778            $self->fix_shebang_line($copy);
    7879            $self->make_executable($copy);
     80            $self->add_custom_lib_path( $copy, $custom_lib_path )
     81              if $custom_lib_path;
    7982        } else {
    8083            print "Skipping $install_directory/$script_filename (unchanged)\n";
     
    9295                $self->fix_shebang_line($copy);
    9396                $self->make_executable($copy) unless $script eq "wiki.conf";
     97                $self->add_custom_lib_path( $copy, $custom_lib_path )
     98                  if $custom_lib_path;
    9499            } else {
    95100                print "Skipping $install_directory/$script (unchanged)\n";
     
    109114}
    110115
     116sub add_custom_lib_path {
     117    my ($self, $copy, $lib_path) = @_;
     118    local $/ = undef;
     119    open my $fh, $copy or die $!;
     120    my $content = <$fh>;
     121    close $fh or die $!;
     122    $content =~ s|use strict;|use strict\;\nuse lib qw( $lib_path )\;|s;
     123    open $fh, ">$copy" or die $!;
     124    print $fh $content;
     125    close $fh or die $!;
     126    return 1;
     127}
     128
    1111291;
Note: See TracChangeset for help on using the changeset viewer.