Newbie questions

J

Jim Frapper

I was wondering what the equivalent tools were to perldoc(ri is not)
and the CPAN module (i.e. searching for and installing modules from
the command line)?

Cheers,
JF
 
D

Daniel Carrera

I haven't found any (and I've been around Ruby for over a year). I think
that Ruby could really benefit from the kind of documentation that I've
seen from Perl.

Cheers,
Daniel.
 
J

Jamis Buck

Daniel said:
I haven't found any (and I've been around Ruby for over a year). I think
that Ruby could really benefit from the kind of documentation that I've
seen from Perl.

Any volunteers? ;)
 
H

Hal Fulton

Jamis said:
Any volunteers? ;)

OK, I've heard this discussed before, but as I'm not a Perler, I don't
know what the big deal is with perldoc.

What is it, what can it do, how is it used, why is it better than ri,
etc.?

Hal
 
D

Daniel Carrera

OK, I've heard this discussed before, but as I'm not a Perler, I don't
know what the big deal is with perldoc.

What is it, what can it do, how is it used, why is it better than ri,
etc.?

Using perldoc feels much the same as using man. In fact, you can use
perldoc to make man pages.

What makes perldoc betters is not perldoc but the documentation. Perl
has an exceptional ammount of very thorough documentation in a very
accessible (ie man-page) manner. When you install a module you have a
reasonable expectation of it automatically installing a perldoc page.

The writing style of ri is different from that of man pages. It is more
of a list of methods than an actual explanation of how to use them.

Try this:

man perl -> You get a list of the standard pages that come with Perl.


man perlre
man perlvar
man perlreftut

...

Try these. You'll see that Perl comes with a garganuous ammount of
man-page-style documentation.

Compare that with :

ri Class


Notice that ri does not produce a scrollable output (yes, you can pipe
ri to less, I know), and the descriptions are fairly limited.

Also, ri seems to be limited to explaining what a class does. Perldoc
is limited only by the number of characters on your keyboard. With
perldoc you get a lot of tutorials and descriptions of how things work.

It's more of an issue of the ammount and style of documentation than of
the actual technology. Documentation one of the things I like most
about Perl and like least about Ruby.

I do think that ri should be scrollable though.

Cheers,
 
L

Luke A. Kanies

We've discussed a parallel to perldoc, but what about CPAN? I know that
we have RAA, but CPAN's recursive auto-installer is one of the really big
reasons so many non-programmers can use perl-based software. People are
much less likely to reinvent the wheel if it's easy for them to explore
existing wheels, and people are much more likely to use your ruby-based
software if they just have to type 'cran install <library>' and know it
will download, compile, and install everything.

Perl's CPAN has saved me hours and hours. It's especially nice when
you're going to new machines, for instance at new clients, because a
couple short commands and a coffee break are all that are necessary to get
the complete latest and greatest list of all the modules you normally use.
Even better, if you want you can write your own bundle that contains
everything you want to install. Then it's just one command.

I think having an equivalent to CPAN will help more than anything else,
because all things flow from access. If people can easily get software,
they're much more likely to contribute documentation to that software.

The barrier to downloading and installing ruby modules (small as it may
be) is one of the things keeping perl coders away, and I know it was the
main reason I hesitated.

Luke
 
H

Hal Fulton

Luke said:
We've discussed a parallel to perldoc, but what about CPAN? I know that
we have RAA, but CPAN's recursive auto-installer is one of the really big
reasons so many non-programmers can use perl-based software. People are
much less likely to reinvent the wheel if it's easy for them to explore
existing wheels, and people are much more likely to use your ruby-based
software if they just have to type 'cran install <library>' and know it
will download, compile, and install everything.

Perl's CPAN has saved me hours and hours. It's especially nice when
you're going to new machines, for instance at new clients, because a
couple short commands and a coffee break are all that are necessary to get
the complete latest and greatest list of all the modules you normally use.
Even better, if you want you can write your own bundle that contains
everything you want to install. Then it's just one command.

I think having an equivalent to CPAN will help more than anything else,
because all things flow from access. If people can easily get software,
they're much more likely to contribute documentation to that software.

The barrier to downloading and installing ruby modules (small as it may
be) is one of the things keeping perl coders away, and I know it was the
main reason I hesitated.

The nascent RubyGems project is a big step toward dealing with this
issue.

Hal
 
R

Rasputin

Luke said:
We've discussed a parallel to perldoc, but what about CPAN? I know that
we have RAA, but CPAN's recursive auto-installer is one of the really big
reasons so many non-programmers can use perl-based software. People are
much less likely to reinvent the wheel if it's easy for them to explore
existing wheels, and people are much more likely to use your ruby-based
software if they just have to type 'cpan install <library>' and know it
will download, compile, and install everything.

In my experience it always tries to update Perl itself, which is a bit
cheeky if you just wanted HTML-Parser...

Its better than what we have, but as I've said before, there are better
models than CPAN to emulate (BSD ports/package tree and Debian apt-get
spring to mind).
 
L

Luke A. Kanies

In my experience it always tries to update Perl itself, which is a bit
cheeky if you just wanted HTML-Parser...

There was a bug in the version of CPAN shipped with 5.6.0, I believe,
which caused this. It's long since fixed, and I think it was only one
subrelease of CPAN.
Its better than what we have, but as I've said before, there are better
models than CPAN to emulate (BSD ports/package tree and Debian apt-get
spring to mind).

Frankly, it doesn't matter to me which one, as long as there's something.
I'm already starting to feel like a crack addict without a pipe or
lighter. I wrote a small amount in perl yesterday for the first time in
about a month, and it was, um, horrible. I left out all the semicolons
and parens and dollar signs, just like in ruby, and it didn't work. :(
Unfortunately, perl has a very mature selection of modules which I've come
to depend on, with Net::LDAP being at the top of the list for me (I'm a
sysadmin, and I store lotsa stuff in LDAP), because it's all perl and
includes SSL support. I expect as I use ruby more I'll delve into helping
out on the ldap module.

So my basic point is, I definitely don't want to go back to using perl
(wow, that was fast) but there are definitely some things I miss about it,
and I'd like to do what I can to support bringing those features to ruby,
especially if ruby doesn't replicate perl's mistakes.

Luke
 
G

Gavin Sinclair

# I was wondering what the equivalent tools were to perldoc(ri is not)
# and the CPAN module (i.e. searching for and installing modules from
# the command line)?
#

Forgive me if this has been covered somewhere else in this thread (big
thread), but the CPAN-ish thing is being worked on and is called RubyGems.
Recursive download/installation currently works. You can get more info at
http://rubygems.rubyforge.org.

Furthermore, RDoc is the perldoc semi-equivalent, and the new
generation of RDoc (in the works) adds the following benefits:
- viewable via command-line (ri)
- installable to system-wide location for easy reference

RubyGems also enables the "installation" of generated documentation.

So it's all starting to come together.

Gavin
 
L

Luke A. Kanies

Furthermore, RDoc is the perldoc semi-equivalent, and the new
generation of RDoc (in the works) adds the following benefits:
- viewable via command-line (ri)
- installable to system-wide location for easy reference

RubyGems also enables the "installation" of generated documentation.

So it's all starting to come together.

This is definitely good to hear. I've seen mentions of most of it, but
I'd not seen it clearly discussed in one place. Could this all be placed
in the FAQ? There's already a comparison to python in there; this would
fit well under a comparison with perl, even though it's a comparison of
things that lie outside of the language itself.

Luke
 
D

Daniel Carrera

Furthermore, RDoc is the perldoc semi-equivalent, and the new
generation of RDoc (in the works) adds the following benefits:
- viewable via command-line (ri)
- installable to system-wide location for easy reference

Perldoc IS viewable via command-line. How else would you use it?

As for ri, I still think it shouldn't just dump the whole documentation
on the terminal, but it should let you scroll. Like man pages and
perldoc.
 
L

Luke A. Kanies

Perldoc IS viewable via command-line. How else would you use it?

As for ri, I still think it shouldn't just dump the whole documentation
on the terminal, but it should let you scroll. Like man pages and
perldoc.

Shouldn't it just use the PAGER or READER environment variable? I don't
really know what the difference is between the two, since they're always
set the same for me, but I know perldoc uses one of them, and ri should do
the same, at least on Unix. That's what they're for, and it certainly
provides a more consistent interface (consistent with man, that is).

Luke
 
D

Daniel Carrera

Shouldn't it just use the PAGER or READER environment variable? I don't
really know what the difference is between the two, since they're always
set the same for me, but I know perldoc uses one of them, and ri should do
the same, at least on Unix. That's what they're for, and it certainly
provides a more consistent interface (consistent with man, that is).


I didn't know about those variables. How do they work?
 
H

Hal Fulton

Daniel said:
Perldoc IS viewable via command-line. How else would you use it?

I think he meant this benefit was added to rdoc.
As for ri, I still think it shouldn't just dump the whole documentation
on the terminal, but it should let you scroll. Like man pages and
perldoc.

I see no reason why this wouldn't be a good thing. If you're
writing to the console, invoke a pager.

Dave?


Hal
 
D

Daniel Berger

Luke A. Kanies said:
Frankly, it doesn't matter to me which one, as long as there's something.
I'm already starting to feel like a crack addict without a pipe or
lighter. I wrote a small amount in perl yesterday for the first time in
about a month, and it was, um, horrible. I left out all the semicolons
and parens and dollar signs, just like in ruby, and it didn't work. :(
Unfortunately, perl has a very mature selection of modules which I've come
to depend on, with Net::LDAP being at the top of the list for me (I'm a
sysadmin, and I store lotsa stuff in LDAP), because it's all perl and
includes SSL support. I expect as I use ruby more I'll delve into helping
out on the ldap module.

See ruby-ldap on the RAA. Dunno about ssl support.

Regards,

Dan
 
D

Daniel Carrera

As for ri, I still think it shouldn't just dump the whole documentation
I see no reason why this wouldn't be a good thing. If you're
writing to the console, invoke a pager.

Dave?

Well... I'm thinking of man pages here. A typical man page is a lot
longer than the vertical size of a terminal, so sending the output to
stdout is not, on itself, very useful. Something that scrolls would
make more sense. The only good thing about stdout is that you can
redirect the output and pipe it through grep, but you can already do
that. You can pipe and redirect man pages already as it is.

I guess that the way it is now makes sense for short documents, that fit
within the span of a termial. But I'm hoping that will change in the
future.

Cheers,
Daniel.
 
L

Luke A. Kanies

I didn't know about those variables. How do they work?

They're just the standard variables to set to change your pager. The man
command is the main thing that uses them, but anything that supports
paging should use the PAGER variable. I only know about them because I
always reset mine to 'less' instead of 'more'.

I haven't yet used ri, but it should definitely be coded to use that
variable by default (which means it doesn't use it if it's connected to a
pipe instead of a terminal, for instance).

I've also written some scripts which use these variables. It's pretty
easy.

Luke

--
The hypothalamus is one of the most important parts of the brain,
involved in many kinds of motivation, among other functions. The
hypothalamus controls the "Four F's": 1. fighting; 2. fleeing;
3. feeding; and 4. mating.
-- Psychology professor in neuropsychology intro course
 
L

Luke A. Kanies

See ruby-ldap on the RAA. Dunno about ssl support.

Yeah, I'm using it (and getting segfaults :), but it has to be compiled
against C libraries, whereas Net::LDAP is entirely in perl, depending
(almost) entirely on other perl libraries. This makes portability a
heckuva lot easier, and also reduces the amount you have to distribute to
get ldap working everywhere. I use LDAP a heckuva lot, and I generally do
ldap operations on all of my hosts sometimes, which means I need this
everywhere, and the easier that is for me, the happier I am.

As to SSL, ruby-ldap does not yet support it. I don't know if I'm up to
helping provide it, either; most of my experience is in perl and shell,
and I'd like to continue my streak of successfully avoiding programming in
C. :)

Luke
 
D

Daniel Carrera

I didn't know about those variables. How do they work?
They're just the standard variables to set to change your pager. The man
command is the main thing that uses them, but anything that supports
paging should use the PAGER variable. I only know about them because I
always reset mine to 'less' instead of 'more'.


I didn't know you could change that. That's awesome!

I hate "more" and I've been really frustrated ever since I started using
this Solaris box. The fact that, by default, "man" uses "more" under
Solaris was one of the anoyances I've had.

I just changed it.

Thanks!

Daniel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top