Email::MIME multiple attachments question

2017-10-03 Thread ToddAndMargo

Hi All,

Can anyone point me to an example of how to
create multiple attachments with Email::MIME
(I know how to do one).


Many thanks,
-T


Re: Tip: hash indexing

2017-10-03 Thread ToddAndMargo

On 10/03/2017 11:56 AM, Andy Bach wrote:

Though this seems to be heading the wrong way but - TIMTOWTDI
my @SmtpIndex =
    qw[ DebugTrace smtp port username password from to Subject Text 
FileName ];


my @SmtpValues = ["1", "smtps://smtp.zoho.com ", 
"465", 'la...@zoho.com ', "NaYukYukYuk",
'la...@zoho.com ', @['cu...@zoho.com 
','m...@zoho.com '], "Stooges", 
"Certainly!", @[""] ];


my %Smtp = zip @SmtpIndex, @SmtpValues;

I guess I could imagine the values coming from a fixed order data file, 
so a loop would do the zip with a split of each line but ...


Hi Andy,

I love examples!

This started out as a brain teaser.  And has grown into an
excellent reference!

Thank you!

-T


Re: Tip: hash indexing

2017-10-03 Thread Andy Bach
Though this seems to be heading the wrong way but - TIMTOWTDI
my @SmtpIndex =
   qw[ DebugTrace smtp port username password from to Subject Text FileName
];

my @SmtpValues = ["1", "smtps://smtp.zoho.com", "465", 'la...@zoho.com',
"NaYukYukYuk",
'la...@zoho.com', @['cu...@zoho.com','m...@zoho.com'], "Stooges",
"Certainly!", @[""] ];

my %Smtp = zip @SmtpIndex, @SmtpValues;

I guess I could imagine the values coming from a fixed order data file, so
a loop would do the zip with a split of each line but ...


On Tue, Oct 3, 2017 at 1:21 PM, ToddAndMargo  wrote:

> Sweet!I added a reverse print to the pile!
>
> 
> #!/usr/bin/env perl6
>
> #`{
>   Hashes do not print in the order they are created.  it is a Perl 6 thing.
>   To overcome this, create an index of the hash.
> }
>
> my @SmtpIndex =
>qw[ DebugTrace smtp port username password from to Subject Text
> FileName ];
>
> my %Smtp =
>   [ "{ @SmtpIndex[0] }" => "1",
> "{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com",
> "{ @SmtpIndex[2] }" => "465",
> "{ @SmtpIndex[3] }" => 'la...@zoho.com',
> "{ @SmtpIndex[4] }" => "NaYukYukYuk",
> "{ @SmtpIndex[5] }" => 'la...@zoho.com',
> "{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'],
> "{ @SmtpIndex[7] }" => "Stooges",
> "{ @SmtpIndex[8] }" => "Certainly!",
> "{ @SmtpIndex[9] }" => @[""] ];
>
> sub output(%hash, @index=@SmtpIndex) {
> for @index -> $key {
> printf "%10s = %s\n", $key, %hash{$key};
> }
> print "\n";
> }
>
> sub revoutput(%hash, @index=@SmtpIndex) {
> for reverse ( @index ) -> $key {
> printf "%10s = %s\n", $key, %hash{$key};
> }
> print "\n";
> }
>
>
> my @SmtpValues = %Smtp{@SmtpIndex};
>
> my %Smtp2 = do {
> my $index = 0;
> @SmtpValues.map: { "{ @SmtpIndex[$index++] }" => $_ };
> };
>
> my %Smtp3 = gather for 0..@SmtpIndex.elems-1 {
> take @SmtpIndex[$_] => @SmtpValues[$_].Str;
> };
>
> my %Smtp4 = @SmtpIndex Z=> @SmtpValues;
>
> # These are all equivalent
> # output(%Smtp);
> # output(%Smtp2);
> # output(%Smtp3);
> output(%Smtp4);
>
> # print in reverse
> revoutput(%Smtp4);
> 
>
> $ HashIndexTest.pl6
> DebugTrace = 1
>   smtp = smtps://smtp.zoho.com
>   port = 465
>   username = la...@zoho.com
>   password = NaYukYukYuk
>   from = la...@zoho.com
> to = cu...@zoho.com m...@zoho.com
>Subject = Stooges
>   Text = Certainly!
>   FileName =
>
>   FileName =
>   Text = Certainly!
>Subject = Stooges
> to = cu...@zoho.com m...@zoho.com
>   from = la...@zoho.com
>   password = NaYukYukYuk
>   username = la...@zoho.com
>   port = 465
>   smtp = smtps://smtp.zoho.com
> DebugTrace = 1
>



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: Tip: hash indexing

2017-10-03 Thread James Ellis Osborne III
Canadian Handicrafts Guild

On Oct 3, 2017 11:22 AM, "ToddAndMargo"  wrote:

> Sweet!I added a reverse print to the pile!
>
> 
> #!/usr/bin/env perl6
>
> #`{
>   Hashes do not print in the order they are created.  it is a Perl 6 thing.
>   To overcome this, create an index of the hash.
> }
>
> my @SmtpIndex =
>qw[ DebugTrace smtp port username password from to Subject Text
> FileName ];
>
> my %Smtp =
>   [ "{ @SmtpIndex[0] }" => "1",
> "{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com",
> "{ @SmtpIndex[2] }" => "465",
> "{ @SmtpIndex[3] }" => 'la...@zoho.com',
> "{ @SmtpIndex[4] }" => "NaYukYukYuk",
> "{ @SmtpIndex[5] }" => 'la...@zoho.com',
> "{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'],
> "{ @SmtpIndex[7] }" => "Stooges",
> "{ @SmtpIndex[8] }" => "Certainly!",
> "{ @SmtpIndex[9] }" => @[""] ];
>
> sub output(%hash, @index=@SmtpIndex) {
> for @index -> $key {
> printf "%10s = %s\n", $key, %hash{$key};
> }
> print "\n";
> }
>
> sub revoutput(%hash, @index=@SmtpIndex) {
> for reverse ( @index ) -> $key {
> printf "%10s = %s\n", $key, %hash{$key};
> }
> print "\n";
> }
>
>
> my @SmtpValues = %Smtp{@SmtpIndex};
>
> my %Smtp2 = do {
> my $index = 0;
> @SmtpValues.map: { "{ @SmtpIndex[$index++] }" => $_ };
> };
>
> my %Smtp3 = gather for 0..@SmtpIndex.elems-1 {
> take @SmtpIndex[$_] => @SmtpValues[$_].Str;
> };
>
> my %Smtp4 = @SmtpIndex Z=> @SmtpValues;
>
> # These are all equivalent
> # output(%Smtp);
> # output(%Smtp2);
> # output(%Smtp3);
> output(%Smtp4);
>
> # print in reverse
> revoutput(%Smtp4);
> 
>
> $ HashIndexTest.pl6
> DebugTrace = 1
>   smtp = smtps://smtp.zoho.com
>   port = 465
>   username = la...@zoho.com
>   password = NaYukYukYuk
>   from = la...@zoho.com
> to = cu...@zoho.com m...@zoho.com
>Subject = Stooges
>   Text = Certainly!
>   FileName =
>
>   FileName =
>   Text = Certainly!
>Subject = Stooges
> to = cu...@zoho.com m...@zoho.com
>   from = la...@zoho.com
>   password = NaYukYukYuk
>   username = la...@zoho.com
>   port = 465
>   smtp = smtps://smtp.zoho.com
> DebugTrace = 1
>


Re: Tip: hash indexing

2017-10-03 Thread ToddAndMargo

Sweet!I added a reverse print to the pile!


#!/usr/bin/env perl6

#`{
  Hashes do not print in the order they are created.  it is a Perl 6 thing.
  To overcome this, create an index of the hash.
}

my @SmtpIndex =
   qw[ DebugTrace smtp port username password from to Subject Text 
FileName ];


my %Smtp =
  [ "{ @SmtpIndex[0] }" => "1",
"{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com",
"{ @SmtpIndex[2] }" => "465",
"{ @SmtpIndex[3] }" => 'la...@zoho.com',
"{ @SmtpIndex[4] }" => "NaYukYukYuk",
"{ @SmtpIndex[5] }" => 'la...@zoho.com',
"{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'],
"{ @SmtpIndex[7] }" => "Stooges",
"{ @SmtpIndex[8] }" => "Certainly!",
"{ @SmtpIndex[9] }" => @[""] ];

sub output(%hash, @index=@SmtpIndex) {
for @index -> $key {
printf "%10s = %s\n", $key, %hash{$key};
}
print "\n";
}

sub revoutput(%hash, @index=@SmtpIndex) {
for reverse ( @index ) -> $key {
printf "%10s = %s\n", $key, %hash{$key};
}
print "\n";
}


my @SmtpValues = %Smtp{@SmtpIndex};

my %Smtp2 = do {
my $index = 0;
@SmtpValues.map: { "{ @SmtpIndex[$index++] }" => $_ };
};

my %Smtp3 = gather for 0..@SmtpIndex.elems-1 {
take @SmtpIndex[$_] => @SmtpValues[$_].Str;
};

my %Smtp4 = @SmtpIndex Z=> @SmtpValues;

# These are all equivalent
# output(%Smtp);
# output(%Smtp2);
# output(%Smtp3);
output(%Smtp4);

# print in reverse
revoutput(%Smtp4);


$ HashIndexTest.pl6
DebugTrace = 1
  smtp = smtps://smtp.zoho.com
  port = 465
  username = la...@zoho.com
  password = NaYukYukYuk
  from = la...@zoho.com
to = cu...@zoho.com m...@zoho.com
   Subject = Stooges
  Text = Certainly!
  FileName =

  FileName =
  Text = Certainly!
   Subject = Stooges
to = cu...@zoho.com m...@zoho.com
  from = la...@zoho.com
  password = NaYukYukYuk
  username = la...@zoho.com
  port = 465
  smtp = smtps://smtp.zoho.com
DebugTrace = 1


Re: Tip: hash indexing

2017-10-03 Thread Bennett Todd
I'd like to note that Hash tables don't preserve the order they're created, and 
that this isn't a perl6 thing, this is intrinsic to the definition of hash 
tables.

On October 3, 2017 9:06:47 AM EDT, Andrew Kirkpatrick  
wrote:
>Thanks, your script enticed me to explore different ways of
>constructing a hash table. I dimly recall something about map having
>access to an index variable, but couldn't find it documented so maybe
>I was dreaming. The process of figuring out these approaches
>highlighted that so much perl6 documentation on the web is outdated. I
>guess what the perl6.org site needs is more examples. Rosettacode was
>also useful.
>
>#!/usr/bin/env perl6
>
>#`{
>Hashes do not print in the order they are created.  it is a Perl 6
>thing.
>  To overcome this, create an index of the hash.
>}
>
>my @SmtpIndex =
>qw[ DebugTrace smtp port username password from to Subject Text
>FileName ];
>
>my %Smtp =
>  [ "{ @SmtpIndex[0] }" => "1",
>"{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com",
>"{ @SmtpIndex[2] }" => "465",
>"{ @SmtpIndex[3] }" => 'la...@zoho.com',
>"{ @SmtpIndex[4] }" => "NaYukYukYuk",
>"{ @SmtpIndex[5] }" => 'la...@zoho.com',
>"{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'],
>"{ @SmtpIndex[7] }" => "Stooges",
>"{ @SmtpIndex[8] }" => "Certainly!",
>"{ @SmtpIndex[9] }" => @[""] ];
>
>sub output(%hash, @index=@SmtpIndex) {
>for @index -> $key {
>printf "%10s = %s\n", $key, %hash{$key};
>}
>}
>
>my @SmtpValues = %Smtp{@SmtpIndex};
>
>my %Smtp2 = do {
>my $index = 0;
>@SmtpValues.map: { "{ @SmtpIndex[$index++] }" => $_ };
>};
>
>my %Smtp3 = gather for 0..@SmtpIndex.elems-1 {
>take @SmtpIndex[$_] => @SmtpValues[$_].Str;
>};
>
>my %Smtp4 = @SmtpIndex Z=> @SmtpValues;
>
># These are all equivalent
># output(%Smtp);
># output(%Smtp2);
># output(%Smtp3);
>output(%Smtp4);
>
>
>On 3 October 2017 at 07:23, ToddAndMargo  wrote:
>> Hi All,
>>
>> I created a keeper not on hash indexing.  I though
>> maybe you guys would find it interesting, if for nothing
>> else, for the syntax used
>>
>> -T
>>
>>
>> Perl6: Indexing a hash:
>>
>> 
>> #!/usr/bin/env perl6
>>
>> #`{
>>   Hashes do not print in the order they are created.  it is a Perl 6
>thing.
>>   To overcome this, create an index of the hash.
>> }
>>
>> my @SmtpIndex =
>>qw[ DebugTrace smtp port username password from to Subject Text
>FileName
>> ];
>>
>> my %Smtp =
>>   [ "{ @SmtpIndex[0] }" => "1",
>> "{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com",
>> "{ @SmtpIndex[2] }" => "465",
>> "{ @SmtpIndex[3] }" => 'la...@zoho.com',
>> "{ @SmtpIndex[4] }" => "NaYukYukYuk",
>> "{ @SmtpIndex[5] }" => 'la...@zoho.com',
>> "{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'],
>> "{ @SmtpIndex[7] }" => "Stooges",
>> "{ @SmtpIndex[8] }" => "Certainly!",
>> "{ @SmtpIndex[9] }" => @[""] ];
>>
>> for @SmtpIndex -> $key { printf "%10s = %s\n", "$key", "%Smtp{$key}";
>}
>> 
>>
>>
>> $ HashIndexTest.pl6
>> DebugTrace = 1
>>   smtp = smtps://smtp.zoho.com
>>   port = 465
>>   username = la...@zoho.com
>>   password = NaYukYukYuk
>>   from = la...@zoho.com
>> to = cu...@zoho.com m...@zoho.com
>>Subject = Stooges
>>   Text = Certainly!
>>   FileName =