diff --git a/lib/Mojolicious/WeBWorK.pm b/lib/Mojolicious/WeBWorK.pm index 20cac99367..3a881fee2a 100644 --- a/lib/Mojolicious/WeBWorK.pm +++ b/lib/Mojolicious/WeBWorK.pm @@ -171,7 +171,7 @@ sub startup ($app) { $app->hook( after_dispatch => sub ($c) { - $SIG{__WARN__} = $c->stash->{orig_sig_warn} if defined $c->stash->{orig_sig_warn}; + $SIG{__WARN__} = ref($c->stash->{orig_sig_warn}) eq 'CODE' ? $c->stash->{orig_sig_warn} : 'DEFAULT'; if ($c->isa('WeBWorK::ContentGenerator') && $c->ce) { $c->authen->store_session if $c->authen; diff --git a/lib/WeBWorK/Authen/LTIAdvanced.pm b/lib/WeBWorK/Authen/LTIAdvanced.pm index b7dd57027e..853040d4db 100644 --- a/lib/WeBWorK/Authen/LTIAdvanced.pm +++ b/lib/WeBWorK/Authen/LTIAdvanced.pm @@ -40,29 +40,6 @@ use WeBWorK::Authen::LTIAdvanced::Nonce; $Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A; -=head1 CONSTRUCTOR - -=over - -=item new($c) - -Instantiates a new WeBWorK::Authen object for the given WeBWorK::Controller ($c). - -=cut - -sub new { - my ($invocant, $c) = @_; - my $class = ref($invocant) || $invocant; - my $self = { c => $c, }; - #initialize - bless $self, $class; - return $self; -} - -=back - -=cut - ## this is only overridden for debug logging #sub verify { # debug("BEGIN LTIAdvanced VERIFY"); diff --git a/lib/WeBWorK/Authen/LTIAdvantage.pm b/lib/WeBWorK/Authen/LTIAdvantage.pm index 3927584e2e..0062fc0499 100644 --- a/lib/WeBWorK/Authen/LTIAdvantage.pm +++ b/lib/WeBWorK/Authen/LTIAdvantage.pm @@ -33,22 +33,6 @@ use WeBWorK::Utils::DateTime qw(formatDateTime); use WeBWorK::Utils::Instructor qw(assignSetToUser); use WeBWorK::Authen::LTIAdvantage::SubmitGrade; -=head1 CONSTRUCTOR - -=over - -=item new($c) - -Instantiates a new WeBWorK::Authen object for the given WeBWorK::Controller ($c). - -=back - -=cut - -sub new ($invocant, $c) { - return bless { c => $c }, ref($invocant) || $invocant; -} - sub request_has_data_for_this_verification_module ($self) { debug('LTIAdvantage has been called for data verification'); my $c = $self->{c}; diff --git a/lib/WeBWorK/Authz.pm b/lib/WeBWorK/Authz.pm index eed66350ed..4551e7a1e1 100644 --- a/lib/WeBWorK/Authz.pm +++ b/lib/WeBWorK/Authz.pm @@ -84,7 +84,7 @@ sub new { my ($invocant, $c) = @_; my $class = ref($invocant) || $invocant; my $self = { c => $c, }; - #weaken $self->{c}; + weaken $self->{c}; $c->{permission_retrieval_error} = 0; bless $self, $class; diff --git a/lib/WeBWorK/ContentGenerator/Home.pm b/lib/WeBWorK/ContentGenerator/Home.pm index 3cfea1c8ce..a403a334b1 100644 --- a/lib/WeBWorK/ContentGenerator/Home.pm +++ b/lib/WeBWorK/ContentGenerator/Home.pm @@ -23,7 +23,6 @@ WeBWorK::ContentGenerator::Home - display a list of courses. =cut use WeBWorK::Utils::Files qw(readFile); -use WeBWorK::Localize; sub info ($c) { my $result; diff --git a/lib/WeBWorK/DB/Schema.pm b/lib/WeBWorK/DB/Schema.pm index 5116f8069f..7dd95e2acc 100644 --- a/lib/WeBWorK/DB/Schema.pm +++ b/lib/WeBWorK/DB/Schema.pm @@ -81,6 +81,8 @@ dependent. C<$db> is provided so that schemas can query other schemas. =cut +use Scalar::Util qw(weaken); + sub new { my ($proto, $db, $driver, $table, $record, $params, $engine, $character_set) = @_; my $class = ref($proto) || $proto; @@ -103,6 +105,8 @@ sub new { character_set => $character_set, }; bless $self, $class; + weaken $self->{db}; + return $self; } diff --git a/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm b/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm index 7631e82fef..368cd4f14d 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm @@ -28,6 +28,8 @@ use warnings; use Carp qw(croak); use Iterator; use Iterator::Util; +use Scalar::Util qw(weaken); + use WeBWorK::DB::Utils::SQLAbstractIdentTrans; use WeBWorK::Debug; @@ -121,6 +123,7 @@ sub merge_init { sub sql_init { my $self = shift; + weaken $self; # Transformation function for table names. This allows us to pass the WeBWorK table names to # SQL::Abstract, and have it translate them to the SQL table names from tableOverride. diff --git a/lib/WeBWorK/DB/Schema/NewSQL/Std.pm b/lib/WeBWorK/DB/Schema/NewSQL/Std.pm index 794713200c..7869eed447 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/Std.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/Std.pm @@ -29,6 +29,8 @@ use Iterator; use Iterator::Util; use File::Temp; use String::ShellQuote; +use Scalar::Util qw(weaken); + use WeBWorK::DB::Utils::SQLAbstractIdentTrans; use WeBWorK::Debug; @@ -64,6 +66,7 @@ sub new { sub sql_init { my $self = shift; + weaken $self; # Transformation function for table names. This allows us to pass the WeBWorK table names to # SQL::Abstract, and have it translate them to the SQL table names from tableOverride.