dd-b has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Almost certainly a module documentation issue
by ferreira (Chaplain) on Oct 13, 2017 at 23:27 UTC | |
by haukex (Archbishop) on Oct 14, 2017 at 06:50 UTC | |
|
Re: Almost certainly a module documentation issue
by haukex (Archbishop) on Oct 14, 2017 at 06:50 UTC | |
by dd-b (Pilgrim) on Oct 14, 2017 at 20:24 UTC | |
by haukex (Archbishop) on Oct 15, 2017 at 11:04 UTC | |
|
Re: Almost certainly a module documentation issue
by 1nickt (Canon) on Oct 13, 2017 at 21:46 UTC | |
by dd-b (Pilgrim) on Oct 14, 2017 at 20:18 UTC |