r63674 - in /branches/upstream/libapp-options-perl/current: CHANGES META.yml lib/App/Options.pm

jotamjr-guest at users.alioth.debian.org jotamjr-guest at users.alioth.debian.org
Wed Oct 13 13:52:31 UTC 2010


Author: jotamjr-guest
Date: Wed Oct 13 13:52:03 2010
New Revision: 63674

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=63674
Log:
[svn-upgrade] new version libapp-options-perl (1.12)

Modified:
    branches/upstream/libapp-options-perl/current/CHANGES
    branches/upstream/libapp-options-perl/current/META.yml
    branches/upstream/libapp-options-perl/current/lib/App/Options.pm

Modified: branches/upstream/libapp-options-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-options-perl/current/CHANGES?rev=63674&op=diff
==============================================================================
--- branches/upstream/libapp-options-perl/current/CHANGES (original)
+++ branches/upstream/libapp-options-perl/current/CHANGES Wed Oct 13 13:52:03 2010
@@ -1,6 +1,13 @@
 #############################################################################
 # CHANGE LOG
 #############################################################################
+
+VERSION 1.12
+ x Added a copyright statement at the request of a Debian administrator.
+   https://rt.cpan.org/Public/Bug/Display.html?id=62017
+
+VERSION 1.11
+ x Added prefixadmin to the MANIFEST
 
 VERSION 1.1
  x Supports the "secure" option attribute. (Also, all options which end in "pass" or "password"

Modified: branches/upstream/libapp-options-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-options-perl/current/META.yml?rev=63674&op=diff
==============================================================================
--- branches/upstream/libapp-options-perl/current/META.yml (original)
+++ branches/upstream/libapp-options-perl/current/META.yml Wed Oct 13 13:52:03 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               App-Options
-version:            1.11
+version:            1.12
 abstract:           ~
 author:  []
 license:            unknown

Modified: branches/upstream/libapp-options-perl/current/lib/App/Options.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-options-perl/current/lib/App/Options.pm?rev=63674&op=diff
==============================================================================
--- branches/upstream/libapp-options-perl/current/lib/App/Options.pm (original)
+++ branches/upstream/libapp-options-perl/current/lib/App/Options.pm Wed Oct 13 13:52:03 2010
@@ -1,6 +1,6 @@
 
 #############################################################################
-## $Id: Options.pm 14348 2010-08-28 21:37:13Z spadkins $
+## $Id: Options.pm 14478 2010-10-12 15:49:12Z spadkins $
 #############################################################################
 
 package App::Options;
@@ -14,7 +14,7 @@
 use File::Spec;
 use Config;
 
-$VERSION = "1.11";
+$VERSION = "1.12";
 
 =head1 NAME
 
@@ -532,7 +532,6 @@
     my $prefix_origin = "command line";
 
     # it can be set in environment.
-    # This is the preferred way for Registry and PerlRun webapps.
     if (!$prefix && $ENV{PREFIX}) {
         $prefix = $ENV{PREFIX};
         $prefix_origin = "environment";
@@ -572,28 +571,7 @@
     my $app = $values->{app};
     my $app_origin = "command line";
     if (!$app) {
-        my $path_info = $ENV{PATH_INFO} || "";
-        $path_info =~ s!/+$!!;    # strip off trailing slashes ("/")
-        if ($path_info && $path_info =~ m!^/([^/]+)!) {
-            my $path_info_app = $1;  # first part of PATH_INFO (without slashes)
-            if ($ENV{HOME} && -f "$ENV{HOME}/.app/$path_info_app.conf") {
-                $app = $path_info_app;
-                $app_origin = "PATH_INFO=$path_info matches $ENV{HOME}/.app/$path_info_app.conf";
-            }
-            elsif (-f "$prog_dir/$path_info_app.conf") {
-                $app = $path_info_app;
-                $app_origin = "PATH_INFO=$path_info matches $prog_dir/$path_info_app.conf";
-            }
-            elsif (-f "$prefix/etc/app/$path_info_app.conf") {
-                $app = $path_info_app;
-                $app_origin = "PATH_INFO=$path_info matches $prefix/etc/app/$path_info_app.conf";
-            }
-        }
-        if (!$app) {
-            $app = $prog_file;    # start with the full program name
-            $app =~ s/\.[^.]+$//; # strip off trailing file type (i.e. ".pl")
-            $app_origin = "program name ($0)";
-        }
+        ($app, $app_origin) = App::Options->determine_app($prefix, $prog_dir, $prog_file, $ENV{PATH_INFO}, $ENV{HOME});
         $values->{app} = $app;
     }
     print STDERR "4. Set app variable. app=[$app] origin=[$app_origin]\n" if ($debug_options);
@@ -966,6 +944,40 @@
             App::Options->print_usage($values, $init_args);
         }
         exit($exit_status);
+    }
+}
+
+# ($app, $app_origin) = App::Options->determine_app($prefix, $prog_dir, $prog_file, $ENV{PATH_INFO}, $ENV{HOME});
+sub determine_app {
+    my ($class, $prefix, $prog_dir, $prog_file, $path_info, $home_dir) = @_;
+    my ($app, $app_origin);
+    $path_info ||= "";
+    $path_info =~ s!/+$!!;    # strip off trailing slashes ("/")
+    if ($path_info && $path_info =~ m!^/([^/]+)!) {
+        my $path_info_app = $1;  # first part of PATH_INFO (without slashes)
+        if ($home_dir && -f "$home_dir/.app/$path_info_app.conf") {
+            $app = $path_info_app;
+            $app_origin = "PATH_INFO=$path_info matches $home_dir/.app/$path_info_app.conf";
+        }
+        elsif (-f "$prog_dir/$path_info_app.conf") {
+            $app = $path_info_app;
+            $app_origin = "PATH_INFO=$path_info matches $prog_dir/$path_info_app.conf";
+        }
+        elsif (-f "$prefix/etc/app/$path_info_app.conf") {
+            $app = $path_info_app;
+            $app_origin = "PATH_INFO=$path_info matches $prefix/etc/app/$path_info_app.conf";
+        }
+    }
+    if (!$app) {
+        $app = $prog_file;    # start with the full program name
+        $app =~ s/\.[^.]+$//; # strip off trailing file type (i.e. ".pl")
+        $app_origin = "program name ($0)";
+    }
+    if (wantarray) {
+        return($app, $app_origin);
+    }
+    else {
+        return($app);
     }
 }
 
@@ -1782,7 +1794,7 @@
 
  #!/usr/bin/perl
  BEGIN {
-   $VERSION = do { my @r=(q$Revision: 14348 $=~/\d+/g); sprintf "%d."."%02d"x$#r, at r};
+   $VERSION = do { my @r=(q$Revision: 14478 $=~/\d+/g); sprintf "%d."."%02d"x$#r, at r};
  }
  use App::Options;
 
@@ -2176,6 +2188,7 @@
 
 =head1 ACKNOWLEDGEMENTS
 
+ * (c) 2010 Stephen Adkins
  * Author:  Stephen Adkins <spadkins at gmail.com>
  * License: This is free software. It is licensed under the same terms as Perl itself.
 




More information about the Pkg-perl-cvs-commits mailing list