aboutsummaryrefslogtreecommitdiffstats
path: root/Perl
diff options
context:
space:
mode:
authorBas Zoetekouw <bas>2008-09-29 22:07:43 +0000
committerBas Zoetekouw <bas>2008-09-29 22:07:43 +0000
commit4ff4e8753a5bac08a6297a73cc45501e534eec75 (patch)
tree962542fbadeda904c835f452eeb5ef636eaac690 /Perl
parent66a51dddc77c209a007ea987d5402e2e1b707300 (diff)
Fix importing from Local::VCS_*
(still need a proper solution to detect git) CVS version numbers Perl/Local/VCS.pm: 1.1 -> 1.2
Diffstat (limited to 'Perl')
-rw-r--r--Perl/Local/VCS.pm53
1 files changed, 42 insertions, 11 deletions
diff --git a/Perl/Local/VCS.pm b/Perl/Local/VCS.pm
index 05a5400a972..e45c00ec06f 100644
--- a/Perl/Local/VCS.pm
+++ b/Perl/Local/VCS.pm
@@ -1,16 +1,47 @@
-#!/usr/bin/perl
+## Wrapper around the various Local::VCS_* modules
+##
+## Copyright (C) 2008 Bas Zoetekouw <bas@debian.org>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of version 2 of the GNU General Public License as
+## published by the Free Software Foundation.
-package VCS;
-use vars qw(@ISA);
+package Local::VCS;
-if (-d 'CVS') {
- # CVS directory is in every subdirectory, so this is a save call
- require Local::VCS_CVS;
- @ISA = qw(Local::VCS_CVS);
-} else {
- # we don't want to move up to look for a .git directory ...
- require Local::VCS_Git;
- @ISA = qw(Local::VCS_Git);
+use Carp;
+use Exporter;
+
+use strict;
+use warnings;
+
+our @ISA = qw(Exporter);
+
+# this is the import routine that is called when this is "used" by a program
+# We implement it ourselves here to export the symbols from the
+# correct module to the main program
+sub import
+{
+ # the first argument is "Local::VCS";
+ # shift it away, we'll specify it manually below
+ shift @_;
+
+ # import the symbols from the module we need...
+ if ( -d 'CVS' )
+ {
+ require Local::VCS_CVS;
+ Local::VCS_CVS->export_to_level(1, 'Local::VCS_CVS', @_);
+ }
+ # TODO: this probably won't suffice, as git only puts a .git directory
+ # in the top directory
+ elsif ( -d '.git' )
+ {
+ require Local::VCS_git;
+ Local::VCS_git->export_to_level(1, 'Local::VCS_git', @_);
+ }
+ else
+ {
+ croak "No VCS found --- only CVS and git are supported\n";
+ }
}
42;

© 2014-2024 Faster IT GmbH | imprint | privacy policy