good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Confusion with Moo's builder attribute and a file handleby mgatto (Novice) |
on Jul 22, 2013 at 22:51 UTC ( [id://1045741]=perlquestion: print w/replies, xml ) | Need Help?? |
mgatto has asked for the wisdom of the Perl Monks concerning the following question: In my moo-based class, building this attribute works fine: When dumped, as expected it returns: $VAR1 = bless( {}, 'DBI::db' ); But, this code returns just a string instead of a file handle, which fails when I try to performs ops on it:
This is what I get: $VAR2 = '..\\t\\merge_into.csv';which of course fails when wanting to pass it to Text::CSV_XS: ... Can't call method "getline" without a package or object referenceIs there some special case for handling file handles in Moo? I tried returning a ref to the filehandle instead, but no joy. It worked fine as a procedural script before I converted it into a class, so the strategy works.
Back to
Seekers of Perl Wisdom
|
|