[Purdue-pm] help!

Bradley Andersen bradley.d.andersen at gmail.com
Wed May 16 10:27:33 PDT 2012


Yeah, in the end I don't care if it is clever or not, so long as the code
works and it is readable :)



On Wed, May 16, 2012 at 1:25 PM, Joe Kline <gizmo at purdue.edu> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 05/16/2012 01:20 PM, Bradley Andersen wrote:
> > ok, i just fixed it, but i'd like to still figure out why it worked
> > then stopped.  there must be something wrong with the earlier
> > logic.  for reference, here's what i did:
> >
> > i replaced: 1999             #####open(FH,
> > "$base/helping$full.html") || die "\n\nCould not READ
> > $base/helping$full.html: [$!]\n\n"; 2000
> > #####$tpl->param("m$full" => do { local $/; while (<FH>) { my $next
> > = <FH>; } });
> >
> > with: 2001 2002             my $contents; 2003             { 2004
> > local $/; 2005                 open(FH, "$base/helping$full.html")
> > || die "\n\nCould not READ $base/helping$full.html: [$!]\n\n"; 2006
> > $contents = <FH>; 2007                 close(FH); 2008
> > } 2009             $tpl->param("m$full" => $contents);
> >
> > Can you see immediately why the first one would be no good? It
> > almost seems like the tpl->param is not being set as a string.
> > That is, clearly it reads it, but it is not assigning the result
> > properly as a string.  All I got were undefs in the log for the
> > earlier logic.  I am 199% sure this worked using the earlier logic
> > yesterday.
> >
>
> Brad,
>
> I don't see much of a reason why the file slurping wasn't
> working...maybe that bit to strip the first line out was a bit too much?
>
> It took me a bit to figure out why that slurp line looked familiar but
> odd:
>
> http://www.modernperlbooks.com/mt/2009/08/a-one-line-slurp-in-perl-5.html
>
> I guess just an example where the less clever option worked out better.
>
> joe
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk+z4xwACgkQb0mzA2gRTpkaZwCghpbMGF2dWaw0kiEXaEjWf0Uy
> hQsAn2YFkhpY5WPmVPe9BsMTTSC7gphi
> =uVn0
> -----END PGP SIGNATURE-----
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> http://mail.pm.org/mailman/listinfo/purdue-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/purdue-pm/attachments/20120516/08a81f8b/attachment.html>


More information about the Purdue-pm mailing list