From ae4bb8da9e1dd41abf5d564b471c68de7b2acdb8 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 1 Mar 2012 18:23:57 +0100 Subject: conditional module import --- videoadd.pl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/videoadd.pl b/videoadd.pl index fadc7f1..bf1a224 100755 --- a/videoadd.pl +++ b/videoadd.pl @@ -90,7 +90,7 @@ of the database. If matching entries are found, then the user is prompted to choose for an entry to update, or to ignore these entries. In the former case, the -above file hierachy remains unchanged and the database is merely updated +above file hierarchy remains unchanged and the database is merely updated with the new retrieved data. In the later case, B acts as below. @@ -121,12 +121,14 @@ in the database) =item B<--ignore-db> Do not connect to the database, hence do not update it with the new -movie. Note that it may break the sanity of your collection. +movie, but only move it to the right place in the file hierarchy. Note +that it may break the sanity of your collection. =item B<--dont-move> Do not put the new movie in I, with a -symlink I -> I<../DIRECTORS/director/movie>. +symlink I -> I<../DIRECTORS/director/movie>, but only +update the database. Note that it may break the sanity of your collection. =item B<--force> @@ -248,7 +250,8 @@ pod2usage(2) if $#ARGV != 0; my $dbh; unless ( defined $ignoredb_flag ) { - use DBI; + require DBI; + import DBI; # Connect to database my $dsn = "DBI:$config{driver}:database=$config{database};host=$config{hostname}"; @@ -274,7 +277,8 @@ my %new = ( owner_id => $config{userid} if ( defined ($imdb{crit}) and &runIMDb() ) { # Look up the title/ID on IMDb - use IMDB::Film; + require IMDB::Film; + import IMDB::Film; my $single; my $movie; @@ -523,7 +527,7 @@ unless ( defined $ignoredb_flag ) { ################################################################################ -# Move the file in the collection +# Move the file to the right place in the hierarchy if ( defined ($file) and defined ($move_flag) ) { if (defined $new{director}) { -- cgit v1.2.3