AcePerl

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

  get_path("site-specific configuration files",\$conf_path);
  get_path("acebrowser CGI scripts",\$cgi_path);
  get_path("acebrowser HTML files and images",\$html_path);

  open F,">Ace/Browser/LocalSiteDefs.pm" or die "Ace/Browser/LocalSiteDefs.pm: $!";
  print F <<END;

# Globals for Ace::Browser::SiteDefs
# these get loaded into whatever package requires them (old style)
package Ace::Browser::LocalSiteDefs;
require Exporter;
\@ISA = qw(Exporter);
\@EXPORT   = qw();
\@EXPORT_OK = qw(\$SITE_DEFS \$CGI_PATH \$HTML_PATH);
\$SITE_DEFS = '$conf_path';
\$CGI_PATH  = '$cgi_path';
\$HTML_PATH = '$html_path';
1;
__END__
=head1 NAME

Ace::Browser::LocalSiteDefs - Master Configuration file for AceBrowser

=head1 SYNOPSIS

 use Ace::Browser::LocalSiteDefs qw($SITE_DEFS $HTML_PATH $CGI_PATH);

=head1 DESCRIPTION

This file, which is created at install time, defines three exportable
variables:

 $SITE_DEFS   Location of the directory that hold's AceBrowser's database-specific
              configuration files, e.g. /usr/local/apache/conf/ace/

 $HTML_PATH   Location of AceBrowser's HTML files and images, e.g. ~www/htdocs/ace/

 $CGI_PATH    Location of AceBrowser's CGI scripts, e.g. ~www/cgi-bin/ace/

=head1 SEE ALSO

L<Ace>

=head1 AUTHOR

Lincoln Stein <lstein\@cshl.org>

Copyright (c) 1997-1998 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  See DISCLAIMER.txt for
disclaimers of warranty.

=cut


END
  close F;

  eval <<END;
sub MY::postamble {
'
install-browser :
	util/install.pl acebrowser/htdocs $html_path
	util/install.pl acebrowser/cgi-bin $cgi_path
	util/install.pl acebrowser/conf $conf_path
	mkdir $html_path/images
	chmod go+rwx $html_path/images
';
}
END
   print qq(\n*** After "make install", run "make install-browser" to install acebrowser files. ***\n\n);
}

sub get_path {
  my ($description,$pathref) = @_;

  $$pathref = expand_twiddles(prompt("Directory for the $description (~username ok):",$$pathref));
  return if -d $$pathref;
  return if prompt("$$pathref does not exist.  Shall I create it for you?",'y') !~ /[yY]/;
  mkpath($$pathref) or warn "Couldn't create $$pathref. Please create it before installing.\n";
}

sub expand_twiddles {
  my $path = shift;
  my ($to_expand,$homedir);
  return $path unless $path =~ m!^~([^/]*)!;

  if ($to_expand = $1) {
    $homedir = (getpwnam($to_expand))[7];
  } else {
    $homedir = (getpwuid($<))[7];
  }
  return $path unless $homedir;

  $path =~ s!^~[^/]*!$homedir!;
  return $path;
}



( run in 0.580 second using v1.01-cache-2.11-cpan-ceb78f64989 )