|
Prev: Boolean Regexp with perlre
Next: Taint and memory usage
From: xhoster on 13 Sep 2006 14:41 "danparker276(a)yahoo.com" <danparker276(a)yahoo.com> wrote: > > > > Check the documentation for the function you're using. In this case, > > that's open: > > perldoc -f open > > [snip] > > File handles can be opened to "in memory" files held > > in Perl scalars via: > > > > open($fh, '>', \$variable) || .. > > This just opens a file called SCALAR(0x8a09e30) what does perl -V give? If your Perl is too old to support this, see IO::Scalar Xho -- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GB
From: Brian McCauley on 13 Sep 2006 14:48 danparker276(a)yahoo.com wrote: > Paul Lalli wrote: > > Check the documentation for the function you're using. In this case, > > that's open: > > perldoc -f open We really mean this! > > [snip] > > File handles can be opened to "in memory" files held > > in Perl scalars via: > > > > open($fh, '>', \$variable) || .. > > This just opens a file called SCALAR(0x8a09e30) Did you check the documentation for the function you're using? Note: the function you are using is open() in the version of Perl that you are using. This is evidently not as recent as the one Paul is using and the feature you are looking for only became built-in [1] very recently. [1] Actually it's not completely built-in, behind the curtain open() actually loads a module IIRC. But please ignore the man behind the curtain. :-)
From: danparker276@yahoo.com on 13 Sep 2006 17:41 Brian McCauley wrote: > danparker276(a)yahoo.com wrote: > > Paul Lalli wrote: > > > Check the documentation for the function you're using. In this case, > > > that's open: > > > perldoc -f open > > We really mean this! > > > > [snip] > > > File handles can be opened to "in memory" files held > > > in Perl scalars via: > > > > > > open($fh, '>', \$variable) || .. > > > > This just opens a file called SCALAR(0x8a09e30) > > Did you check the documentation for the function you're using? Note: > the function you are using is open() in the version of Perl that you > are using. This is evidently not as recent as the one Paul is using and > the feature you are looking for only became built-in [1] very recently. > Yeah, the version on the machine is old, 5.6. I read the docs and couldn't find anything. I'm more of a .net or java person. This code just needs to be supported for the next year until it is replaced. > [1] Actually it's not completely built-in, behind the curtain open() > actually loads a module IIRC. But please ignore the man behind the > curtain. :-)
From: Tad McClellan on 13 Sep 2006 14:31 danparker276(a)yahoo.com <danparker276(a)yahoo.com> wrote: > Paul Lalli wrote: >> danparker276(a)yahoo.com wrote: >> > I have to connect to this module, and I usually send it a file handle, >> > or stdout. But I want to write it to a string. Is there a string >> > buffer or something I can use? >> Check the documentation for the function you're using. Did you do that? (obviously not...) >> In this case, >> that's open: >> perldoc -f open >> [snip] >> File handles can be opened to "in memory" files held >> in Perl scalars via: >> >> open($fh, '>', \$variable) || .. Did _your_ docs say what was quoted above? If not, then the quote does not apply to the version of perl that you have. > This just opens a file called SCALAR(0x8a09e30) Upgrade to a modern perl. -- Tad McClellan SGML consulting tadmc(a)augustmail.com Perl programming Fort Worth, Texas
From: danparker276@yahoo.com on 13 Sep 2006 18:31
Tad, " open($fh, '>', \$variable)" This would work perfect, just not the right version of perl. I'm just gonna rewrite the other module to use a string, it's not worth the trouble of finding another solution. And your quote: "> Did you do that? > > (obviously not...)" Makes me want to punch you in the face. Why do you have to be such a smart a**? I guess with a name like Tad, you're used to being picked on. Why does everyone have to always say "read the docs". This is something simple I thought someone knew off the top of their head. Maybe I don't have to use the open function. Oh yeah, and I top-posted on purpose. Everyone on this group is so stuck up. .NET 2.0 blows everything away anyway. At least on their formus, people from microsoft will answer questions instead of "Look at the docs" Tad McClellan wrote: > danparker276(a)yahoo.com <danparker276(a)yahoo.com> wrote: > > Paul Lalli wrote: > >> danparker276(a)yahoo.com wrote: > >> > I have to connect to this module, and I usually send it a file handle, > >> > or stdout. But I want to write it to a string. Is there a string > >> > buffer or something I can use? > > > >> Check the documentation for the function you're using. > > > Did you do that? > > (obviously not...) > > > >> In this case, > >> that's open: > >> perldoc -f open > >> [snip] > >> File handles can be opened to "in memory" files held > >> in Perl scalars via: > >> > >> open($fh, '>', \$variable) || .. > > > Did _your_ docs say what was quoted above? > > If not, then the quote does not apply to the version of perl that you have. > > > > This just opens a file called SCALAR(0x8a09e30) > > > Upgrade to a modern perl. > > > -- > Tad McClellan SGML consulting > tadmc(a)augustmail.com Perl programming > Fort Worth, Texas |