The Email::Sender::Transport::Print module has very sparse documentation. It does say you can pass a file-handle object in as the attribute "fh". Looking at other Email::Sender::Transport implementations, it appears to me that passing a hash to new with the attributes as name/value pairs is the way it's done (there's a rather startlingly complete shortage of examples of Email::Sender::Transport::Print usage on the web).

The code is:

open (my $sm, '>> :encoding(UTF-8)', 'out.txt') or die "Failed to open out.txt: $!"; $transport = Email::Sender::Transport::Print->new({ fh => $sm, });

($transport is declared outside the bit quoted, but it is declared.)

When I do that, I get the error "isa check for "fh" failed: GLOB(0x806897840) is not blessed". This seems to imply that it noticed that I was in fact passing something as attribute fh, at least!

In the debugger, it seems to me that $sm, the thing passed in as the value of attribute fh, is in fact blessed.

DB<3> x $sm 0 GLOB(0x806897840) -> *main::$sm FileHandle({*main::$sm}) => fileno(7) DB<4> n isa check for "fh" failed: GLOB(0x806897840) is not blessed at (eval 7 +8)[/home/ddb/perl5/lib/perl5/Sub/Quote.pm:3] line 59, <$if> line 2. eval {...} called at (eval 78)[/home/ddb/perl5/lib/perl5/Sub/Quote +.pm:3] line 58 Email::Sender::Transport::Print::new("Email::Sender::Transport::Pr +int", HASH(0x80213c8e8)) called at /home/ddb/smbshare/Documents/Fando +m/Minicon/Mc53/mc53_pr1_001.pl line 178M

I am now wondering WTF. A preliminary attempt to look at the source code of the module foundered; it appears there is none, it's generated on-the-fly using moo or something? Which I'm not familiar with, and while in theory I could study it up and then figure out for sure what's expected, that's starting to look like a large amount of work.

Ideas?


In reply to Almost certainly a module documentation issue by dd-b

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.