Hi All,

I am stumped.  This only screws up in the for loop.

This is only the chopped up version

<code>
#!/usr/bin/env perl6

my $SmtpIniFileName = $?FILE ~ ".ini";
my %SmtpIni = [ 'DebugTrace' => "",      #   1 | 0  (-vvv)
                'smtp'       => "",      #   smtp.zoho.com
'port' => "", # 465 (ssl), 587 (tls), 25, 80, 3535 etc. 'username' => "", # Typically the sender's eMail address, but not always. # Blank will default tothe sender's eMail address;
                'password'   => "",      #   User's ($username) password
                'from'       => "",      #   The sender's eMail address;
'to' => @[""], # qw [ la...@zoho.com cur...@gmail.com ]; # This is an array, not a string; delimit with a space
                'Subject'    => "",      #   Subject of the eMail
                'Text'       => "",      #   Body (verbage) of the eMail
'FileName' => @[""] ]; # attachment path and name. Leave blank for no attachment


sub PrintRed ( $Str ) { print color('bold'), color('red'), "$Str", color('reset'); } sub PrintGreen ( $Str ) { print color('bold'), color('green'), "$Str", color('reset'); } sub PrintBlue ( $Str ) { print color('bold'), color('blue'), "$Str", color('reset'); } sub PrintRedErr ( $Str ) { $*ERR.print: color('bold'), color('red'), "$Str", color('reset'); }

sub CreateSmtpIni () {
my $SmtpHandle = open( $SmtpIniFileName, :rw ); # Read/write, create if does not exist
        chmod 0o400, $SmtpIniFileName;                   # Read//write to root 
only
        RunNoShell ( "chown root.root $SmtpIniFileName" );

        $SmtpHandle.print( "# SmtpIni file for for $IAm\n" );
$SmtpHandle.print( "# This file must be owned by root.root and have a permission of 400\n" );
        $SmtpHandle.print( "#    Do not use a space after the = sign.  \n" );
        $SmtpHandle.print( "#\n" );

        for %SmtpIni.kv -> $key, $value {
                PrintGreen ( "key = <$key>  value =<$value>\n" );
if ( $key eq "to" ) { $SmtpHandle.print( "$key= #delimiter is a comma\n" ); } elsif ( $key eq "FileName" ) { $SmtpHandle.print( "$key= #delimiter is a comma\n" ); }
       else { $SmtpHandle.print( "$key=\n" ); }
    close ( $SmtpHandle ); }

PrintRedErr ( "$SmtpIniFileName was not found. Recreating a blank template.\n" ); PrintRedErr ( "Please edit this template and try again. Cowardly existing. Bummer dude.\n\n" );
    exit 2;
}

CreateSmtpIni();

</code>

# CheckRaid.pl6
key = <Subject>  value =<>
key = <port>  value =<>
write bytes requires an object with REPR MVMOSHandle (got VMNull with REPR Null)
  in sub CreateSmtpIni at ./CheckRaid.pl6 line 52
  in sub GetSmtpIni at ./CheckRaid.pl6 line 62
  in block <unit> at ./CheckRaid.pl6 line 143

Line 52 is
    else { $SmtpHandle.print( "$key=\n" ); }

# cat CheckRaid.pl6.ini
# SmtpIni file for for CheckRaid.pl6
#    This file must be owned by root.root and have a permission of 400
#    Do not use a space after the = sign.
#
Subject=

Reply via email to