Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

RE: Stock Quotes

by KM (Priest)
on May 24, 2000 at 20:57 UTC ( #14602=note: print w/replies, xml ) Need Help??

in reply to Stock Quotes

This wheel has already been invented, very well in fact. Look at Finance::YahooQuote and Finance::QuoteHist and Finance::Quote.


Replies are listed 'Best First'.
by scribe (Initiate) on May 24, 2000 at 22:44 UTC
    I'm hesitant to use too many non-standard modules.
    This may be because I am new to this.

    Is it common practice to use all the modules you
    can? I worry about it's portability then - what if the
    system doesn't have the module installed and the
    admins are slow/reluctant to install it?


    plus I had fun ;)
      It is good to have fun and learn. And, have fun learning. One of the reasons I have done Perl all these years is that I always have fun with it, unlike other languages where I didn't find it fun to be using and writing.

      Anyways, don't be hesitant to use modules that aren't part of the distrobution. There is a lot of useful modules out there that will save you time and headaches. To learn, it is always good to read the modules POD and source to see what makes it tick.

      Unless you are using a module which is specific to Win32, or *nix specific, then don't worry about portability. Many modules work fine on many platforms. If you have a reluctant sysadmin, you can still install modules under your home directory. Then you can change @INC to look there, or PERL5LIB.

      In order to allow users to install their own modules I have sometimes aliased 'perl' with 'perl -I/path/to/their/modules' which has worked nicely.

      Hope this helps.


        KM says: If you have a reluctant sysadmin, you can still install modules under your home directory. Then you can change @INC to look there, or PERL5LIB.

        I am sorry this question is begging for an RTFM answer, but please be gentle with me! I have been looking for the right M to FR for many months!

        Pretty please, can someone explain what KM said in simpler words? Or tell me where to find a real newbie's guide to installing modules?

        Firstly, what does "home directory" mean? Is this cgi-bin or the directory which contains it?

        Secondly, what does "change @INC to look there" mean. What is @INC and how do I change it? And will I still be able to use the sysadmin's modules?

        I am using Perl remotely on my webhost's server.
      I wholeheartedly agree with KM. Just for the sake of completeness, I will mention some arguments against using non-standard modules:
      • Learning how to do something yourself may be a worthwhile learning experience.
      • The module that does what you need may include a lot of extra functionality that you are not going to use. In those cases, sometimes it's good to peek under the hood and only extract the functionality you need (giving proper credit, and ideally asking for permission from the author) and putting it directly in your program
      Of course, this only applies to modules that do relatively simple things. If you need to do database access or write a CGI script. By all means, please, use the modules. There's no need to reinvent the wheel, particularly when it's a complex wheel.


        I agree with the first part of your argument, you can learn some excellent stuff by looking at what has already been done in other modules.

        However for anything other than learning, and your own pet projects, I would certainly recommend using non-standard modules (non-standard meaning modules not distributed with perl). I am not saying this because you might reinvent the wheel, but there is a huge part of good programming that people here seem to never think about: maintenance! If you copy and paste code from a module into your own code then you are stuck maintaining that code forever. So not only do you have to maintain the code specific to your project, but also the code that is general in purpose. Say there were actual bugs in the code you copied over, then instead of fixing the bug your self, you just use the CPAN module and grab the latest release (letting someone else fix the bugs for you).

        But of course there are some problems using the module approach, if the author decides to change the API from one version to the next then you have to modify your code to use the new version. But that is why I would not recommend for production code using modules with lower version numbers or ones that in the documentation say they are 'alpha' or 'beta' modules. Other than that, include what ever you think might be handy.

        Of course I recognize there are exceptions to every rule, like critical speed performance. But for most large applications, I just wanted to mention that I think maintenance should be a significant consideration. We may leave a project, but our code lives on forever!
        Something to think about anyway.

        Update: Anyone what to bother telling me why this node is a negative reputation? If you have a counter argument let me hear it, otherwise I still think the advise is pretty sound.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://14602]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-06-19 05:03 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.