Newbie questions

Discussion in 'Ruby' started by Jim Frapper, Dec 16, 2003.

  1. Jim Frapper

    Jim Frapper Guest

    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
     
    Jim Frapper, Dec 16, 2003
    #1
    1. Advertising

  2. 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.

    On Wed, Dec 17, 2003 at 03:01:58AM +0900, Jim Frapper wrote:
    > 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


    --
    Daniel Carrera | "Software is like sex. It's better when it's free".
    PhD student. |
    Math Dept. UMD | -- Linus Torvalds
     
    Daniel Carrera, Dec 16, 2003
    #2
    1. Advertising

  3. Jim Frapper

    Jamis Buck Guest

    Daniel Carrera wrote:

    >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? ;)

    --
    Jamis Buck


    ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'
     
    Jamis Buck, Dec 16, 2003
    #3
  4. Jim Frapper

    Hal Fulton Guest

    Jamis Buck wrote:
    > Daniel Carrera wrote:
    >
    >> 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? ;)
    >


    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
     
    Hal Fulton, Dec 16, 2003
    #4
  5. > 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,
    --
    Daniel Carrera | "Software is like sex. It's better when it's free".
    PhD student. |
    Math Dept. UMD | -- Linus Torvalds
     
    Daniel Carrera, Dec 16, 2003
    #5
  6. 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

    --
    Once...in the wilds of Afghanistan, I lost my corkscrew, and we were
    forced to live on nothing but food and water for days. -- W. C. Fields
     
    Luke A. Kanies, Dec 16, 2003
    #6
  7. Jim Frapper

    Hal Fulton Guest

    Luke A. Kanies wrote:
    > 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
     
    Hal Fulton, Dec 16, 2003
    #7
  8. Jim Frapper

    Rasputin Guest

    Luke A. Kanies wrote:
    > 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).


    --
    Rasputin :: Jack of All Trades - Master of Nuns
     
    Rasputin, Dec 16, 2003
    #8
  9. On Wed, 17 Dec 2003, Rasputin wrote:

    > Luke A. Kanies wrote:
    > > 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...


    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

    --
    The death rate on Earth is: .... (computing) .... One per person.
     
    Luke A. Kanies, Dec 16, 2003
    #9
  10. On Wednesday, December 17, 2003, 8:10:19 AM, Chad wrote:

    > On Wed, 17 Dec 2003, Jim Frapper wrote:


    > # 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
     
    Gavin Sinclair, Dec 16, 2003
    #10
  11. On Wed, 17 Dec 2003, Gavin Sinclair wrote:

    > On Wednesday, December 17, 2003, 8:10:19 AM, Chad wrote:
    >
    > > 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.


    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

    --
    "But these [serious NT security flaws] are not inherent flaws in the
    operating system -- they don't happen by accident. They are the result
    of deliberate and well-thought-out efforts." --Mike Nash, Microsoft.
    The _flaws_ are deliberate?
     
    Luke A. Kanies, Dec 16, 2003
    #11
  12. >
    > 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.
     
    Daniel Carrera, Dec 16, 2003
    #12
  13. On Wed, 17 Dec 2003, Daniel Carrera wrote:

    > 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

    --
    We're not surrounded, we're in a target-rich environment!
     
    Luke A. Kanies, Dec 16, 2003
    #13
  14. On Wed, Dec 17, 2003 at 07:07:45AM +0900, Luke A. Kanies wrote:
    > On Wed, 17 Dec 2003, Daniel Carrera wrote:
    >
    > > 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).



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

    --
    Daniel Carrera | "Software is like sex. It's better when it's free".
    PhD student. |
    Math Dept. UMD | -- Linus Torvalds
     
    Daniel Carrera, Dec 16, 2003
    #14
  15. Jim Frapper

    Hal Fulton Guest

    Daniel Carrera wrote:
    >>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?


    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
     
    Hal Fulton, Dec 16, 2003
    #15
  16. "Luke A. Kanies" wrote:

    >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
     
    Daniel Berger, Dec 16, 2003
    #16
  17. > >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?


    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.
     
    Daniel Carrera, Dec 16, 2003
    #17
  18. On Wed, 17 Dec 2003, Daniel Carrera wrote:

    > On Wed, Dec 17, 2003 at 07:07:45AM +0900, Luke A. Kanies wrote:
    > >
    > > 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?


    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
     
    Luke A. Kanies, Dec 16, 2003
    #18
  19. On Wed, 17 Dec 2003, Daniel Berger wrote:

    > "Luke A. Kanies" wrote:
    >
    > >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.


    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

    --
    Computers are not intelligent. They only think they are.
     
    Luke A. Kanies, Dec 16, 2003
    #19
  20. > > 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.
     
    Daniel Carrera, Dec 16, 2003
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ali Syed
    Replies:
    3
    Views:
    562
    Mark McIntyre
    Oct 13, 2004
  2. pkirk25
    Replies:
    50
    Views:
    1,121
    Bill Pursell
    Oct 4, 2006
  3. Replies:
    10
    Views:
    556
  4. JohnE

    newbie with newbie questions

    JohnE, Aug 17, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    512
    Gregory A. Beamer
    Aug 17, 2009
  5. Vijay
    Replies:
    2
    Views:
    595
    Öö Tiib
    May 7, 2010
Loading...

Share This Page