Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] Upgr 3.14 -> 4.04 -- Problem with GlobalSubs



******    message to minivend-users from Randy Moore <ramoore@atlantech.net>     ******

Hi all,

I'm trying to upgrade a store from MV 3.14 to 4.04 and have almost 
everything working now.  But I'm stuck on one point.  My GlobalSubs seem to 
be being processed by Safe.  I understand that this should be the case for 
subroutines defined in catalog.cfg, but not for those defined (or included 
from the usertag directory).

This globalsub worked fine in MV 3.14.

Any suggestions would be appreciated.

Details follow.


Here is the error message I find in my catalog level error.log:

host2.axion-it.com TGsTUTp7:axion-it.com - [26/April/2000:21:46:25 -0400] 
order /cgi-bin/order/process.html Safe: Can't locate object method "new" 
via package "Mail::Sender" at (eval 12) line 12.
 >
 >
 >       mail_message_n_attachments(
 >           q{},
 > q{ramoore@axion-it.net},
 >           q{},
 > q{Thank you for your order 000010!},
 > q{MedOptions Inc. Customer Service <ramoore@axion-it.net>},
 > q{
 > Dear MedOptions Inc. customer,

Here is the GlobalSub definition (from file in my usertag directory).  This 
subroutine sends an email with multiple binary attachments:


GlobalSub <<EndOfSub
sub mail_message_n_attachments {
     my($smtpsrvr,$to,$fromaddr,$subject,$reply,$body,$filebasedir,$filelist 
my($smtpsrvr,$to,$fromaddr,$subject,$reply,$body,$filebasedir,$filelist) = @_;
     my($sender, $exp);

     use Mail::Sender;
     $Mail::Sender::NO_X_MAILER  = 1;

     $subject = '<no subject>' unless defined $subject && $subject;
     $reply = '' unless defined $reply;

     # Open email message structure
     goto LOGERROR unless (ref ($sender = new Mail::Sender({     from => 
$fromaddr,
                                                                 smtp => 
$smtpsrvr,
                                                                 reply => 
$reply })));
     $sender->OpenMultipart({    to => $to,
                                 subject => $subject,});
     $sender->Body;
     $sender->SendLine($body);

     # Find which files are to be sent.
     $filebasedir =~ s/\/$//;                    # Strip trailing '/'
     foreach (split(/,/, $filelist)) {           # Expand filelist with 
base dir
         s/^\s*(.*?)\s*$/$1/;                    # Strip spaces
         next if /^$/;
         $exp = /^\// ? "$_" : "$filebasedir/$_";
         if (-r $exp) {
                 $sender->SendFile({ ctype => 'application/octet-stream',
                                     encoding => 'Base64',
                                     disposition => "attachment; 
filename=\"$_\";",
                                     file => $exp });
         }
         else {
                     $sender->Body;
                     $sender->SendLine(
                          "\n\nWARNING: You were supposed to recieve a 
document\n" .
                          "named $_, but it is not currently available on 
our\n" .
                          "server.  Please contact customer support for 
assistance\n"
                         );
         }
     }

     $sender->Close;

     goto LOGERROR if ($sender->{error});
     return(1);

LOGERROR:
      print("Unable to send mail using $smtpsrvr\n" .
             "Error: $Mail::Sender::Error\n" .
             "To '$to'\n" .
             "With subject '$subject'\n" .
             "With reply-to '$reply'\n" .
             "With filelist '$filelist'\n");
#            "And body:\n$body");
     return(0);
}
EndOfSub


And finally, here is how I call this routine in my receipt.html page:
[perl arg=sub interpolate=1]
         mail_message_n_attachments(
             q{__SMTPSRVR__},
             q{[value email]},
             q{__FROMADDR__},
             q{Thank you for your order [value mv_order_number]!},
             q{__COMPANY__ Customer Service <__ORDERS_TO__>},
             q{[scratch receipt_text]},
             "/homea/medoptionslegal/files",
             q{[item-list][item-code].rtf,[/item-list]},
         );

[/perl]


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: