[Rt-commit] rt branch, 4.4/dropbox-warnings, created. rt-4.2.12-363-ge34f8f8

Shawn Moore shawn at bestpractical.com
Thu Oct 29 15:14:45 EDT 2015


The branch, 4.4/dropbox-warnings has been created
        at  e34f8f8ffe44ad224f7d5578f577e5885df8937f (commit)

- Log -----------------------------------------------------------------
commit e34f8f8ffe44ad224f7d5578f577e5885df8937f
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Oct 29 19:13:44 2015 +0000

    Suppress given/when warnings from File::Dropbox
    
        See https://rt.cpan.org/Ticket/Display.html?id=108107
    
        Fixes: I#31309

diff --git a/lib/RT/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
index ea9691a..832390f 100644
--- a/lib/RT/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -70,12 +70,25 @@ sub AccessToken {
 sub Init {
     my $self = shift;
 
-    if (not File::Dropbox->require) {
-        RT->Logger->error("Required module File::Dropbox is not installed");
-        return;
-    } elsif (not $self->AccessToken) {
-        RT->Logger->error("Required option 'AccessToken' not provided for Dropbox external storage. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
-        return;
+    {
+        # suppress given/warn is experimental warnings from File::Dropbox 0.6
+        # https://rt.cpan.org/Ticket/Display.html?id=108107
+
+        my $original_warn_handler = $SIG{__WARN__};
+        local $SIG{__WARN__} = sub {
+            return if $_[0] =~ /(given|when) is experimental/;
+
+            # Avoid reporting this anonymous call frame as the source of the warning.
+            goto &$original_warn_handler;
+        };
+
+        if (not File::Dropbox->require) {
+            RT->Logger->error("Required module File::Dropbox is not installed");
+            return;
+        } elsif (not $self->AccessToken) {
+            RT->Logger->error("Required option 'AccessToken' not provided for Dropbox external storage. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
+            return;
+        }
     }
 
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list