in reply to Re^4: STDERR Restore after redirect
in thread STDERR Restore after redirect

see BLOCKS

SEND: is just an optional LABEL to make the block more visible. The block {} restricts the scope of the local().

poj

Replies are listed 'Best First'.
Re^6: STDERR Restore after redirect
by tultalk (Monk) on Apr 28, 2018 at 23:47 UTC

    Hi. Thanks all. Moving on to the STARTTLS mode.

    If I should start new topic, warn me.

    AUTH PLAIN failed: 554 Security failure
    Server said: 554 Security failure
    

    MIME::Base64 encode/decode

    my $encodedString = "AUTH PLAIN " . encode_base64(join("\0", $auth->{user}, $auth->{ +user}, $auth->{password}), $CRLF); my $decodedString = decode_base64($encodedString) +; warn("decodedString '$decodedString'");

    Encode produces:

    AUTH PLAIN d2VibWFzdGVyXEBid21qY20udXMAd2VibWFzdGVyXEBid21qY20udXMAd21 +ANDA5MTNXTQ==

    Decode produces:

    D<5ݕѕqݵݕѕqݵݵ ]4

    I thought the decoded string would be that same as the input string.No?

      Why would prepending  "AUTH PLAIN " to the encoded string leave the encoding unchanged so that decoding would remain symmetric?

      c:\@Work\Perl\monks>perl -wMstrict -le "use MIME::Base64; ;; use Data::Dump qw(pp); ;; my $encoded = encode_base64('Aladdin:open sesame'); ;; my $decoded = decode_base64($encoded); print qq{A: '$decoded'}; ;; $encoded = 'AUTH PLAIN ' . $encoded; $decoded = decode_base64($encoded); print 'B: ', pp $decoded; " A: 'Aladdin:open sesame' B: pack("H*","0144c73cb0083505b1859191a5b8e9bdc195b881cd95cd85b594")

      Update: And yes, this does look like a bit of a new topic...


      Give a man a fish:  <%-{-{-{-<

        Hi. Thanks.

        Why would prepending "AUTH PLAIN " to the encoded string leave the encoding unchanged so that decoding would remain symmetric?

        Because I was not paying attention. Fixed