in reply to catch die from say

$courrielclient="5555555555\msg.telus.com";

This looks like a silly blunder to me; with warnings enabled you'll see: Unrecognized escape \m passed through

Presumably you meant to write:

$courrielclient='5555555555\msg.telus.com';

To avoid wasting time chasing these sorts of coding gaffes always start your scripts with:

use strict; use warnings;

For (much) more detail on this topic see : use strict and warnings References

👁️🍾👍🦟

Replies are listed 'Best First'.
Re^2: catch die from say
by jdporter (Paladin) on Apr 01, 2024 at 13:17 UTC
    Presumably you meant ...

    Hm. I presume they meant:

    "5555555555\@msg.telus.com"

    Good catch, though!

Re^2: catch die from say
by PierreForget (Acolyte) on Apr 01, 2024 at 18:01 UTC
    Sorry, I made a typo when copying the code. It should have read:
    $courrielclient='5555555555\@msg.telus.com';
    The original code was correct, but I didn't want the real phone number on the Internet.
      Hi Monks and thank you for all the replies. Just to make sure, the following code is working perfectly and returns me to the menu page, until Telus blocks me after a certain number of tries per day. Then I get "Internal Server error" in the web page. I would like to catch the error (not FataltoBrowser, because I already have it in the logs) and make the Perl code continue and do the END part, so that I am redirected to the main menu page. Phone and domain are dummies for the example.
      #! /usr/bin/perl $email_message="test de Pierre"; $email_subject="test4"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@chirotest.ca"; open( my $mail, "| mailx -r $from -s $email_subject $recipient" ); say $mail $email_message; close $mail; END { my $redirect = "/cgi-bin/chiro/menuprincipal.pl"; print "Location:$redirect\n\n"; }
        Hi Monks, I changed the way of doing it and the following code seems to work perfectly, even in the case of an error generated by Telus. The culprit was the pipe "|" which sends to a bash script and do not return. Thanks for all the effort. And I removed the "\n", which got the variables unrecognized by mailx.
        #! /usr/bin/perl $email_message="test de Pierre"; $email_file ="/httpd/bureau.testchiro.ca/temp/sms"; $email_subject="test9"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@testchiro.ca"; system ("mailx -q $email_file -r $from -s $email_subject $recipient"); END { my $redirect = "http://192.168.0.10/index.html"; print "Location:$redirect\n\n"; }
        As soon as it's possible, may take a few days..., I will try the "q" option in mailx. Here is the code I will try:
        #! /usr/bin/perl $email_message="test de Pierre"; $email_subject="test4"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@chirotest.ca"; open( my $mail, "mailx -q /usr/pierre/bin/smstext.txt -r $from -s $ema +il_subject $recipient" ); say $mail $email_message; close $mail; END { my $redirect = "/cgi-bin/chiro/menuprincipal.pl"; print "Location:$redirect\n\n"; }