[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Sebastian Hungerecker

11/4/2007 10:44:00 AM

Terry Poulin wrote:
> I'm clueless as to why I'm getting what looks to me like an Errno::ENOENT
> exception that references the 'PATH' we Net::FTP#chdir'd to four lines ago.
> When all it is doing is calling gets.

If you specify a command line parameter, Kernel#gets treats that as a file
name and tries to read from that file instead of stdin. If you don't want
that, use STDIN.gets instead of Kernel#gets.

HTH,
Sebastian
--
Jabber: sepp2k@jabber.org
ICQ: 205544826

4 Answers

Robert Klemme

11/4/2007 11:35:00 AM

0

On 04.11.2007 11:43, sepp2k@googlemail.com wrote:
> Terry Poulin wrote:
>> I'm clueless as to why I'm getting what looks to me like an Errno::ENOENT
>> exception that references the 'PATH' we Net::FTP#chdir'd to four lines ago.
>> When all it is doing is calling gets.
>
> If you specify a command line parameter, Kernel#gets treats that as a file
> name and tries to read from that file instead of stdin. If you don't want
> that, use STDIN.gets instead of Kernel#gets.

I am sorry, but this is plain wrong.

http://ruby-doc.org/core/classes/Kernel.ht...

robert

Sebastian Hungerecker

11/4/2007 12:09:00 PM

0

Robert Klemme wrote:
> On 04.11.2007 11:43, sepp2k@googlemail.com wrote:
> > If you specify a command line parameter, Kernel#gets treats that as a
> > file name and tries to read from that file instead of stdin.
>
> I am sorry, but this is plain wrong.
>
> http://ruby-doc.org/core/classes/Kernel.ht...

I'm sorry, maybe I'm a little slow, but isn't "Returns (and assigns to $_) the
next line from the list of files in ARGV (or $*), or from standard input if
no files are present on the command line." basically what I said?
Or are you refering to the fact that my phrasing made it sound as if gets only
cared about the first command line parameter?


--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Robert Klemme

11/4/2007 2:50:00 PM

0

On 04.11.2007 13:08, sepp2k@googlemail.com wrote:
> Robert Klemme wrote:
>> On 04.11.2007 11:43, sepp2k@googlemail.com wrote:
>>> If you specify a command line parameter, Kernel#gets treats that as a
>>> file name and tries to read from that file instead of stdin.
>> I am sorry, but this is plain wrong.
>>
>> http://ruby-doc.org/core/classes/Kernel.ht...
>
> I'm sorry, maybe I'm a little slow, but isn't "Returns (and assigns to $_) the
> next line from the list of files in ARGV (or $*), or from standard input if
> no files are present on the command line." basically what I said?
> Or are you refering to the fact that my phrasing made it sound as if gets only
> cared about the first command line parameter?

I read your statement to mean that an argument to gets is treated as a
file name. As is obvious now you were referring to the script's
arguments and not gets's arguments. My apologies.

Kind regards

robert

Terry Poulin

11/4/2007 5:14:00 PM

0

Robert Klemme wrote:
> On 04.11.2007 13:08, sepp2k@googlemail.com wrote:
>
> If you specify a command line parameter, Kernel#gets treats that as a file
> name and tries to read from that file instead of stdin. If you don't want
> that, use STDIN.gets instead of Kernel#gets.
>
> HTH,
> Sebastian
> --
> Jabber: sepp2k@jabber.org
> ICQ: 205544826
>
>

Works perfectly! I never realized there was a Kernel#gets as well, only knew
about IO#gets. If I did know about it I would've just RTFM... Sorry =/


Thanks !

And thanks everyone for not flaming me for forgetting the subject line...


TerryP.

>> Robert Klemme wrote:
>>> On 04.11.2007 11:43, sepp2k@googlemail.com wrote:
>>>> If you specify a command line parameter, Kernel#gets treats that as a
>>>> file name and tries to read from that file instead of stdin.
>>> I am sorry, but this is plain wrong.
>>>
>>> http://ruby-doc.org/core/classes/Kernel.ht...
>>
>> I'm sorry, maybe I'm a little slow, but isn't "Returns (and assigns to $_)
>> the
>> next line from the list of files in ARGV (or $*), or from standard input if
>> no files are present on the command line." basically what I said?
>> Or are you refering to the fact that my phrasing made it sound as if gets
>> only
>> cared about the first command line parameter?
>
> I read your statement to mean that an argument to gets is treated as a
> file name. As is obvious now you were referring to the script's
> arguments and not gets's arguments. My apologies.
>
> Kind regards
>
> robert
>
>



--

Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ip...