Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bestpractical/rt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Vincent <jesse@bestpractical.com>2003-02-17 11:07:57 +0300
committerJesse Vincent <jesse@bestpractical.com>2003-02-17 11:07:57 +0300
commitba8cb62d6d5da33cd6a4320a6276bdab4787b97a (patch)
treeaf1e85632becee62786174259d9324c4bfad6140
parent69889121ae86a11ad0d0ad26f91343e6cf87b52c (diff)
Working on better Encode::Guessing; fixing error reporting on scrip failure; fixed a missing require ofrt-2.1.72
File::Temp; hopefully better catching of missing modules
-rwxr-xr-xMakefile2
-rw-r--r--TODO18
-rwxr-xr-xlib/RT/ACE.pm4
-rwxr-xr-xlib/RT/ACL.pm4
-rwxr-xr-xlib/RT/Action/CreateTickets.pm2
-rwxr-xr-xlib/RT/Action/SendEmail.pm16
-rwxr-xr-xlib/RT/Attachment.pm4
-rwxr-xr-xlib/RT/Attachments.pm4
-rwxr-xr-xlib/RT/CachedGroupMember.pm4
-rwxr-xr-xlib/RT/CachedGroupMembers.pm4
-rwxr-xr-xlib/RT/CustomField.pm4
-rwxr-xr-xlib/RT/CustomFieldValue.pm4
-rwxr-xr-xlib/RT/CustomFieldValues.pm4
-rwxr-xr-xlib/RT/CustomFields.pm4
-rwxr-xr-xlib/RT/Group.pm4
-rwxr-xr-xlib/RT/GroupMember.pm4
-rwxr-xr-xlib/RT/GroupMembers.pm4
-rwxr-xr-xlib/RT/Groups.pm4
-rwxr-xr-xlib/RT/I18N.pm142
-rwxr-xr-xlib/RT/Interface/Email/Auth/MailFrom.pm16
-rwxr-xr-xlib/RT/Link.pm4
-rwxr-xr-xlib/RT/Links.pm4
-rwxr-xr-xlib/RT/Principal.pm4
-rwxr-xr-xlib/RT/Principals.pm4
-rwxr-xr-xlib/RT/Queue.pm4
-rwxr-xr-xlib/RT/Queues.pm4
-rwxr-xr-xlib/RT/Scrip.pm4
-rwxr-xr-xlib/RT/ScripAction.pm4
-rwxr-xr-xlib/RT/ScripActions.pm4
-rwxr-xr-xlib/RT/ScripCondition.pm4
-rwxr-xr-xlib/RT/ScripConditions.pm4
-rwxr-xr-xlib/RT/Scrip_Overlay.pm18
-rwxr-xr-xlib/RT/Scrips.pm4
-rwxr-xr-xlib/RT/Template.pm4
-rwxr-xr-xlib/RT/Template_Overlay.pm2
-rwxr-xr-xlib/RT/Templates.pm4
-rwxr-xr-xlib/RT/Ticket.pm4
-rwxr-xr-xlib/RT/TicketCustomFieldValue.pm4
-rwxr-xr-xlib/RT/TicketCustomFieldValues.pm4
-rwxr-xr-xlib/RT/Tickets.pm4
-rwxr-xr-xlib/RT/Transaction.pm4
-rwxr-xr-xlib/RT/Transactions.pm4
-rwxr-xr-xlib/RT/User.pm4
-rwxr-xr-xlib/RT/Users.pm4
-rwxr-xr-xsbin/factory8
45 files changed, 181 insertions, 187 deletions
diff --git a/Makefile b/Makefile
index 637f3e3d9b..b80de6d46e 100755
--- a/Makefile
+++ b/Makefile
@@ -22,8 +22,6 @@
#
#
# END LICENSE BLOCK
-
-
#
# DO NOT HAND-EDIT the file named 'Makefile'. This file is autogenerated.
# Have a look at "configure" and "Makefile.in" instead
diff --git a/TODO b/TODO
deleted file mode 100644
index 6070fbba88..0000000000
--- a/TODO
+++ /dev/null
@@ -1,18 +0,0 @@
-A rough sketch of what's coming for 2.2. to be fleshed out later.
-
-likely it will be "saveable preferences, saveable searches,
- easier upgrades, freeform custom fields, integrated cvs, enhanced
- mailgate, wapRT and templated responses. oh. and some
- reporting.
-
----
-
-Errata for RT 2.x can be found at http://fsck.com/rt2/NoAuth/Errata.html
-
-A list of all open issues, including those which haven't been added
-to the official Errata lists, can be found at
-http://fsck.com/rt2/NoAuth/Buglist.html
-
-If you want to look at bugs in more detail, you may need to login as guest with a password of 'guest'
-
-
diff --git a/lib/RT/ACE.pm b/lib/RT/ACE.pm
index fb8b9d933d..39aeed7cc4 100755
--- a/lib/RT/ACE.pm
+++ b/lib/RT/ACE.pm
@@ -266,12 +266,12 @@ sub _ClassAccessible {
eval "require RT::ACE_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ACE_Overlay.pm}) {
die $@;
};
eval "require RT::ACE_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ACE_Local.pm}) {
die $@;
};
diff --git a/lib/RT/ACL.pm b/lib/RT/ACL.pm
index fd2bac5eda..3198ae0928 100755
--- a/lib/RT/ACL.pm
+++ b/lib/RT/ACL.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::ACL_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ACL_Overlay.pm}) {
die $@;
};
eval "require RT::ACL_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ACL_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Action/CreateTickets.pm b/lib/RT/Action/CreateTickets.pm
index e0383977c5..673417035d 100755
--- a/lib/RT/Action/CreateTickets.pm
+++ b/lib/RT/Action/CreateTickets.pm
@@ -225,7 +225,7 @@ my $approvals =
my $groups = RT::Groups->new($RT::SystemUser);
$groups->LimitToUserDefinedGroups();
$groups->Limit(FIELD => "Name", OPERATOR => "=", VALUE => "$name");
- $groups->WithMember($TransactionObj->CreatorObj->Id);
+ $groups->WithMember($Transaction->CreatorObj->Id);
my $groupid = $groups->First->Id;
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 4374efc0da..79b3f1d1b7 100755
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -1,26 +1,26 @@
# BEGIN LICENSE BLOCK
-#
+#
# Copyright (c) 1996-2002 Jesse Vincent <jesse@bestpractical.com>
-#
+#
# (Except where explictly superceded by other copyright notices)
-#
+#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
# been provided with this software, but in any event can be snarfed
# from www.gnu.org
-#
+#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
-#
+#
+#
# Unless otherwise specified, all modifications, corrections or
# extensions to this work which alter its source code become the
# property of Best Practical Solutions, LLC when submitted for
# inclusion in the work.
-#
-#
+#
+#
# END LICENSE BLOCK
# Portions Copyright 2000 Tobias Brox <tobix@cpan.org>
diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 644a068ad8..8c92905afd 100755
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -334,12 +334,12 @@ sub _ClassAccessible {
eval "require RT::Attachment_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Attachment_Overlay.pm}) {
die $@;
};
eval "require RT::Attachment_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Attachment_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Attachments.pm b/lib/RT/Attachments.pm
index 36912495da..411bf7dd26 100755
--- a/lib/RT/Attachments.pm
+++ b/lib/RT/Attachments.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Attachments_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Attachments_Overlay.pm}) {
die $@;
};
eval "require RT::Attachments_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Attachments_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CachedGroupMember.pm b/lib/RT/CachedGroupMember.pm
index 343693d3c6..2e485a88ce 100755
--- a/lib/RT/CachedGroupMember.pm
+++ b/lib/RT/CachedGroupMember.pm
@@ -220,12 +220,12 @@ sub _ClassAccessible {
eval "require RT::CachedGroupMember_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CachedGroupMember_Overlay.pm}) {
die $@;
};
eval "require RT::CachedGroupMember_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CachedGroupMember_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CachedGroupMembers.pm b/lib/RT/CachedGroupMembers.pm
index 06573fcbfc..cdbdfa683e 100755
--- a/lib/RT/CachedGroupMembers.pm
+++ b/lib/RT/CachedGroupMembers.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::CachedGroupMembers_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CachedGroupMembers_Overlay.pm}) {
die $@;
};
eval "require RT::CachedGroupMembers_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CachedGroupMembers_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index d39ce70249..3727f150ee 100755
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -302,12 +302,12 @@ sub _ClassAccessible {
eval "require RT::CustomField_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomField_Overlay.pm}) {
die $@;
};
eval "require RT::CustomField_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomField_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CustomFieldValue.pm b/lib/RT/CustomFieldValue.pm
index 5352dc52b6..a0afd9afd0 100755
--- a/lib/RT/CustomFieldValue.pm
+++ b/lib/RT/CustomFieldValue.pm
@@ -256,12 +256,12 @@ sub _ClassAccessible {
eval "require RT::CustomFieldValue_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFieldValue_Overlay.pm}) {
die $@;
};
eval "require RT::CustomFieldValue_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFieldValue_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CustomFieldValues.pm b/lib/RT/CustomFieldValues.pm
index 0e7fdfe493..5025efea11 100755
--- a/lib/RT/CustomFieldValues.pm
+++ b/lib/RT/CustomFieldValues.pm
@@ -83,12 +83,12 @@ sub NewItem {
}
eval "require RT::CustomFieldValues_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFieldValues_Overlay.pm}) {
die $@;
};
eval "require RT::CustomFieldValues_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFieldValues_Local.pm}) {
die $@;
};
diff --git a/lib/RT/CustomFields.pm b/lib/RT/CustomFields.pm
index 3716dec2dd..bf945c9f10 100755
--- a/lib/RT/CustomFields.pm
+++ b/lib/RT/CustomFields.pm
@@ -83,12 +83,12 @@ sub NewItem {
}
eval "require RT::CustomFields_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFields_Overlay.pm}) {
die $@;
};
eval "require RT::CustomFields_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/CustomFields_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Group.pm b/lib/RT/Group.pm
index 6d737f1db9..59e19e8a3b 100755
--- a/lib/RT/Group.pm
+++ b/lib/RT/Group.pm
@@ -220,12 +220,12 @@ sub _ClassAccessible {
eval "require RT::Group_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Group_Overlay.pm}) {
die $@;
};
eval "require RT::Group_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Group_Local.pm}) {
die $@;
};
diff --git a/lib/RT/GroupMember.pm b/lib/RT/GroupMember.pm
index f5e635de0e..413c5c8b36 100755
--- a/lib/RT/GroupMember.pm
+++ b/lib/RT/GroupMember.pm
@@ -151,12 +151,12 @@ sub _ClassAccessible {
eval "require RT::GroupMember_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/GroupMember_Overlay.pm}) {
die $@;
};
eval "require RT::GroupMember_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/GroupMember_Local.pm}) {
die $@;
};
diff --git a/lib/RT/GroupMembers.pm b/lib/RT/GroupMembers.pm
index efc25205ca..abb3b63d04 100755
--- a/lib/RT/GroupMembers.pm
+++ b/lib/RT/GroupMembers.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::GroupMembers_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/GroupMembers_Overlay.pm}) {
die $@;
};
eval "require RT::GroupMembers_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/GroupMembers_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Groups.pm b/lib/RT/Groups.pm
index f8e2e703d8..31a005df94 100755
--- a/lib/RT/Groups.pm
+++ b/lib/RT/Groups.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Groups_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Groups_Overlay.pm}) {
die $@;
};
eval "require RT::Groups_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Groups_Local.pm}) {
die $@;
};
diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index af061f6076..e890a34c34 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -221,72 +221,84 @@ This method doesn't return anything meaningful.
=cut
sub SetMIMEEntityToEncoding {
- my ($entity, $enc) = (shift, shift);
-
- if ($entity->is_multipart) {
- RT::I18N::SetMIMEEntityToEncoding($_, $enc) foreach $entity->parts;
- } else {
- my ($head, $body) = ($entity->head, $entity->bodyhandle);
- my ($mime_type, $charset) =
- ($head->mime_type, $head->mime_attr("content-type.charset") || "");
-
- # the entity is not text, nothing to do with it.
- return unless ($mime_type eq 'text/plain');
-
- # the entity is text and has charset setting, try convert
- # message body into $enc
- my @lines = $body->as_lines or return;
-
- if (!$charset) {
- if ( @RT::EmailInputEncodings and eval { require Encode::Guess; 1 } ) {
- Encode::Guess->set_suspects(@RT::EmailInputEncodings);
- my $decoder = Encode::Guess->guess($body->as_string);
-
- if (ref $decoder) {
- $charset = $decoder->name;
- $RT::Logger->debug("Guessed encoding: $charset");
- }
- else {
- $charset = 'utf-8';
- $RT::Logger->warning("Cannot Encode::Guess: $decoder; fallback to utf-8");
- }
- }
- else {
- $charset = 'utf-8';
- }
- }
-
- # one and only normalization
- $charset = 'utf-8' if $charset eq 'utf8';
- $enc = 'utf-8' if $enc eq 'utf8';
-
- if ($enc ne $charset) {
- eval {
-
- $RT::Logger->debug("Converting '$charset' to '$enc'");
-
- # NOTE:: see the comments at the end of the sub.
- Encode::_utf8_off($lines[$_]) foreach (0 .. $#lines);
+ my ( $entity, $enc ) = ( shift, shift );
- if ($enc eq 'utf-8') {
- $lines[$_] = Encode::decode($charset, $lines[$_]) foreach (0 .. $#lines);
- }
- else {
- Encode::from_to($lines[$_], $charset => $enc) foreach (0 .. $#lines);
- }
- };
- if ($@) {
- $RT::Logger->error("Encoding error: ".$@);
- }
- }
- elsif ($enc eq 'utf-8') {
- Encode::_utf8_on($lines[$_]) foreach (0 .. $#lines);
- }
-
- my $new_body = MIME::Body::InCore->new(\@lines);
- # set up the new entity
- $head->mime_attr("content-type.charset" => $enc);
- $entity->bodyhandle($new_body);
+ if ( $entity->is_multipart ) {
+ RT::I18N::SetMIMEEntityToEncoding( $_, $enc ) foreach $entity->parts;
+ }
+ else {
+ my ( $head, $body ) = ( $entity->head, $entity->bodyhandle );
+ my ( $mime_type, $charset ) =
+ ( $head->mime_type, $head->mime_attr("content-type.charset") || "" );
+
+ # the entity is not text, nothing to do with it.
+ # TODO: should we be converting ANY text/ type? autrijus?
+ return unless ( $mime_type =~ /^text\/plain$/ );
+
+ # the entity is text and has charset setting, try convert
+ # message body into $enc
+ my @lines = $body->as_lines or return;
+
+ if ( !$charset ) {
+ if ( @RT::EmailInputEncodings
+ and eval { require Encode::Guess; 1 } ) {
+ Encode::Guess->set_suspects(@RT::EmailInputEncodings);
+ my $decoder = Encode::Guess->guess( $body->as_string );
+
+ if ( ref $decoder ) {
+ $charset = $decoder->name;
+ $RT::Logger->debug("Guessed encoding: $charset");
+ }
+ else {
+ $charset = 'utf-8';
+ $RT::Logger->warning( "Cannot Encode::Guess: $decoder; fallback to utf-8");
+ }
+ }
+ else {
+ $charset = 'utf-8';
+ }
+ }
+
+ # one and only normalization
+ $charset = 'utf-8' if $charset eq 'utf8';
+ $enc = 'utf-8' if $enc eq 'utf8';
+
+ if ( $enc ne $charset ) {
+ eval {
+
+ $RT::Logger->debug("Converting '$charset' to '$enc'");
+
+ # NOTE:: see the comments at the end of the sub.
+ Encode::_utf8_off( $lines[$_] ) foreach ( 0 .. $#lines );
+
+ if ( $enc eq 'utf-8' ) {
+ $lines[$_] = Encode::decode( $charset, $lines[$_] ) foreach ( 0 .. $#lines );
+ }
+ else {
+ Encode::from_to( $lines[$_], $charset => $enc ) foreach ( 0 .. $#lines );
+ }
+ };
+ if ($@) {
+ $RT::Logger->error( "Encoding error: " . $@ . " defaulting to ISO-8859-1 -> UTF-8");
+ eval {
+
+ Encode::from_to( $lines[$_], 'iso-8859-1' => $enc ) foreach ( 0 .. $#lines );
+
+ };
+ if ($@) {
+ $RT::Logger->crit( "Totally failed to convert to utf-8: ".$@. " I give up");
+ }
+ }
+ }
+ elsif ( $enc eq 'utf-8' ) {
+ Encode::_utf8_on( $lines[$_] ) foreach ( 0 .. $#lines );
+ }
+
+ my $new_body = MIME::Body::InCore->new( \@lines );
+
+ # set up the new entity
+ $head->mime_attr( "content-type.charset" => $enc );
+ $entity->bodyhandle($new_body);
}
}
diff --git a/lib/RT/Interface/Email/Auth/MailFrom.pm b/lib/RT/Interface/Email/Auth/MailFrom.pm
index 7a97588f9d..b69e281fcc 100755
--- a/lib/RT/Interface/Email/Auth/MailFrom.pm
+++ b/lib/RT/Interface/Email/Auth/MailFrom.pm
@@ -1,26 +1,26 @@
# BEGIN LICENSE BLOCK
-#
+#
# Copyright (c) 1996-2002 Jesse Vincent <jesse@bestpractical.com>
-#
+#
# (Except where explictly superceded by other copyright notices)
-#
+#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
# been provided with this software, but in any event can be snarfed
# from www.gnu.org
-#
+#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
-#
+#
+#
# Unless otherwise specified, all modifications, corrections or
# extensions to this work which alter its source code become the
# property of Best Practical Solutions, LLC when submitted for
# inclusion in the work.
-#
-#
+#
+#
# END LICENSE BLOCK
package RT::Interface::Email::Auth::MailFrom;
use RT::Interface::Email qw(ParseSenderAddressFromHead CreateUser);
diff --git a/lib/RT/Link.pm b/lib/RT/Link.pm
index 13ed90e486..b3b62f305e 100755
--- a/lib/RT/Link.pm
+++ b/lib/RT/Link.pm
@@ -264,12 +264,12 @@ sub _ClassAccessible {
eval "require RT::Link_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Link_Overlay.pm}) {
die $@;
};
eval "require RT::Link_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Link_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Links.pm b/lib/RT/Links.pm
index 3832461dbe..2c38a53255 100755
--- a/lib/RT/Links.pm
+++ b/lib/RT/Links.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Links_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Links_Overlay.pm}) {
die $@;
};
eval "require RT::Links_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Links_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Principal.pm b/lib/RT/Principal.pm
index f2b1371060..c9993e68c1 100755
--- a/lib/RT/Principal.pm
+++ b/lib/RT/Principal.pm
@@ -174,12 +174,12 @@ sub _ClassAccessible {
eval "require RT::Principal_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Principal_Overlay.pm}) {
die $@;
};
eval "require RT::Principal_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Principal_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Principals.pm b/lib/RT/Principals.pm
index 16b3eebaad..1d5bd1f944 100755
--- a/lib/RT/Principals.pm
+++ b/lib/RT/Principals.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Principals_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Principals_Overlay.pm}) {
die $@;
};
eval "require RT::Principals_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Principals_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 74d1b3b20f..d54447c008 100755
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -333,12 +333,12 @@ sub _ClassAccessible {
eval "require RT::Queue_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Queue_Overlay.pm}) {
die $@;
};
eval "require RT::Queue_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Queue_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Queues.pm b/lib/RT/Queues.pm
index a01b23ebd3..1334cbabfa 100755
--- a/lib/RT/Queues.pm
+++ b/lib/RT/Queues.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Queues_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Queues_Overlay.pm}) {
die $@;
};
eval "require RT::Queues_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Queues_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Scrip.pm b/lib/RT/Scrip.pm
index 8740cdc8aa..345971afe9 100755
--- a/lib/RT/Scrip.pm
+++ b/lib/RT/Scrip.pm
@@ -462,12 +462,12 @@ sub _ClassAccessible {
eval "require RT::Scrip_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Scrip_Overlay.pm}) {
die $@;
};
eval "require RT::Scrip_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Scrip_Local.pm}) {
die $@;
};
diff --git a/lib/RT/ScripAction.pm b/lib/RT/ScripAction.pm
index 6a3ddbcf49..03eb98a325 100755
--- a/lib/RT/ScripAction.pm
+++ b/lib/RT/ScripAction.pm
@@ -241,12 +241,12 @@ sub _ClassAccessible {
eval "require RT::ScripAction_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripAction_Overlay.pm}) {
die $@;
};
eval "require RT::ScripAction_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripAction_Local.pm}) {
die $@;
};
diff --git a/lib/RT/ScripActions.pm b/lib/RT/ScripActions.pm
index 2e54256eba..df340e232a 100755
--- a/lib/RT/ScripActions.pm
+++ b/lib/RT/ScripActions.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::ScripActions_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripActions_Overlay.pm}) {
die $@;
};
eval "require RT::ScripActions_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripActions_Local.pm}) {
die $@;
};
diff --git a/lib/RT/ScripCondition.pm b/lib/RT/ScripCondition.pm
index 3719c210f2..aad88daf55 100755
--- a/lib/RT/ScripCondition.pm
+++ b/lib/RT/ScripCondition.pm
@@ -264,12 +264,12 @@ sub _ClassAccessible {
eval "require RT::ScripCondition_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripCondition_Overlay.pm}) {
die $@;
};
eval "require RT::ScripCondition_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripCondition_Local.pm}) {
die $@;
};
diff --git a/lib/RT/ScripConditions.pm b/lib/RT/ScripConditions.pm
index 052406bdeb..84fd49dcdd 100755
--- a/lib/RT/ScripConditions.pm
+++ b/lib/RT/ScripConditions.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::ScripConditions_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripConditions_Overlay.pm}) {
die $@;
};
eval "require RT::ScripConditions_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/ScripConditions_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Scrip_Overlay.pm b/lib/RT/Scrip_Overlay.pm
index 700d6faeea..868f17a8b2 100755
--- a/lib/RT/Scrip_Overlay.pm
+++ b/lib/RT/Scrip_Overlay.pm
@@ -312,17 +312,10 @@ sub Apply {
my %args = ( TicketObj => undef,
TransactionObj => undef,
@_ );
- eval {
- # We want to make sure that if a scrip dies, we don't get
- # hurt
- local $SIG{__DIE__} = sub {
- $RT::Logger->error( $_[0] );
- $self->ActionObj->DESTROY();
- $self->ConditionObj->DESTROY();
- return (undef);
-
- };
+ # We want to make sure that if a scrip dies, we don't get
+ # hurt
+ eval {
#Load the scrip's Condition object
$self->ConditionObj->LoadCondition(
@@ -337,7 +330,7 @@ sub Apply {
}
#If it's applicable, prepare and commit it
- $self->ActionObj->LoadAction( ScripObj => $self,
+ $self->ActionObj->LoadAction( ScripObj => $self,
TicketObj => $args{'TicketObj'},
TransactionObj => $args{'TransactionObj'},
);
@@ -363,6 +356,9 @@ sub Apply {
$self->ConditionObj->DESTROY();
return (1);
};
+ if ($@) {
+ $RT::Logger->error( "Scrip " . $self->Id . " died. - " . $@ );
+ }
}
# }}}
diff --git a/lib/RT/Scrips.pm b/lib/RT/Scrips.pm
index 2b1675433a..e3bb4ae142 100755
--- a/lib/RT/Scrips.pm
+++ b/lib/RT/Scrips.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Scrips_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Scrips_Overlay.pm}) {
die $@;
};
eval "require RT::Scrips_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Scrips_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Template.pm b/lib/RT/Template.pm
index 3dcff4173a..fb374d2a70 100755
--- a/lib/RT/Template.pm
+++ b/lib/RT/Template.pm
@@ -325,12 +325,12 @@ sub _ClassAccessible {
eval "require RT::Template_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Template_Overlay.pm}) {
die $@;
};
eval "require RT::Template_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Template_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 7f4f233a03..ea0a54a876 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -51,6 +51,8 @@ no warnings qw(redefine);
use Text::Template;
use MIME::Entity;
use MIME::Parser;
+use File::Temp qw /tempdir/;
+
# {{{ sub _Accessible
diff --git a/lib/RT/Templates.pm b/lib/RT/Templates.pm
index 9c44f3b1ac..7940609782 100755
--- a/lib/RT/Templates.pm
+++ b/lib/RT/Templates.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Templates_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Templates_Overlay.pm}) {
die $@;
};
eval "require RT::Templates_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Templates_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 9d6f16e643..5fa457e16d 100755
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -624,12 +624,12 @@ sub _ClassAccessible {
eval "require RT::Ticket_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Ticket_Overlay.pm}) {
die $@;
};
eval "require RT::Ticket_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Ticket_Local.pm}) {
die $@;
};
diff --git a/lib/RT/TicketCustomFieldValue.pm b/lib/RT/TicketCustomFieldValue.pm
index 66e8836588..bbc0976e91 100755
--- a/lib/RT/TicketCustomFieldValue.pm
+++ b/lib/RT/TicketCustomFieldValue.pm
@@ -248,12 +248,12 @@ sub _ClassAccessible {
eval "require RT::TicketCustomFieldValue_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/TicketCustomFieldValue_Overlay.pm}) {
die $@;
};
eval "require RT::TicketCustomFieldValue_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/TicketCustomFieldValue_Local.pm}) {
die $@;
};
diff --git a/lib/RT/TicketCustomFieldValues.pm b/lib/RT/TicketCustomFieldValues.pm
index 9ae58da5c1..4a534d57e5 100755
--- a/lib/RT/TicketCustomFieldValues.pm
+++ b/lib/RT/TicketCustomFieldValues.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::TicketCustomFieldValues_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/TicketCustomFieldValues_Overlay.pm}) {
die $@;
};
eval "require RT::TicketCustomFieldValues_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/TicketCustomFieldValues_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 72bec029f6..2f68b5f9e6 100755
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Tickets_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Tickets_Overlay.pm}) {
die $@;
};
eval "require RT::Tickets_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Tickets_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 278070c329..4283560dbe 100755
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -326,12 +326,12 @@ sub _ClassAccessible {
eval "require RT::Transaction_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Transaction_Overlay.pm}) {
die $@;
};
eval "require RT::Transaction_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Transaction_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Transactions.pm b/lib/RT/Transactions.pm
index c0509ff4b8..3b8062a733 100755
--- a/lib/RT/Transactions.pm
+++ b/lib/RT/Transactions.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Transactions_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Transactions_Overlay.pm}) {
die $@;
};
eval "require RT::Transactions_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Transactions_Local.pm}) {
die $@;
};
diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index c9b86e8dd3..4624444a6d 100755
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -816,12 +816,12 @@ sub _ClassAccessible {
eval "require RT::User_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/User_Overlay.pm}) {
die $@;
};
eval "require RT::User_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/User_Local.pm}) {
die $@;
};
diff --git a/lib/RT/Users.pm b/lib/RT/Users.pm
index 9fe1a73742..62cc275e1b 100755
--- a/lib/RT/Users.pm
+++ b/lib/RT/Users.pm
@@ -77,12 +77,12 @@ sub NewItem {
}
eval "require RT::Users_Overlay";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Users_Overlay.pm}) {
die $@;
};
eval "require RT::Users_Local";
- if ($@ && $@ !~ /^Can't locate/) {
+ if ($@ && $@ !~ qr{^Can't locate RT/Users_Local.pm}) {
die $@;
};
diff --git a/sbin/factory b/sbin/factory
index bdc539831b..88a21c7f33 100755
--- a/sbin/factory
+++ b/sbin/factory
@@ -353,14 +353,18 @@ sub MagicImport {
#if (exists \$warnings::{unimport}) {
# no warnings qw(redefine);
+ my $path = $class;
+ $path =~ s#::#/#gi;
+
+
my $content = "
eval \"require @{[$class]}_Overlay\";
- if (\$@ && \$@ !~ /^Can't locate/) {
+ if (\$@ && \$@ !~ qr{^Can't locate ".$path."_Overlay.pm}) {
die \$@;
};
eval \"require @{[$class]}_Local\";
- if (\$@ && \$@ !~ /^Can't locate/) {
+ if (\$@ && \$@ !~ qr{^Can't locate ".$path."_Local.pm}) {
die \$@;
};