Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Any idea to let Perl form data and scalar work in same page?by tobyink (Canon) |
on Mar 19, 2013 at 14:57 UTC ( [id://1024318]=note: print w/replies, xml ) | Need Help?? |
Well, kinda. The OP's problem is that CGI.pm is exhausting STDIN, and it's impossible to seek back to the start of STDIN. The modern interface for Perl web apps is PSGI (implemented by Plack). The equivalent of reading from STDIN in PSGI is to read from $env->{"psgi.input"}. This is a filehandle that is usually seekable (depending on what handler you're using).
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|