Deib has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, before I start with my issue please allow me to introduce myself. Oh, before that, just so you keep in mind, I'm totally new to Perl and to The Monastery. Also, since English is not my native language, some of my writing may seem incoherent. So please bare with me, ok? Well then, I'm mexican, 21 years old, I'm studying the early stages of a programmer carrer. I have some mild knowledge on JAVA, C++ and HTML. I recently got a "professional experience" job for a company called todito.com. More precisely in a division called toditocard.com.

So, that's my background. Oh, I want to apologize for any inconvenience this post may cause due to its absolute newbieness and I would appreciate if you, great temples of Perl knowledge, could omit the flames and the RTFMs(unless you point to a particular section of a particular manual).

So, here's the deal:
I was entitled with the responsability to develop a program for the site toditocard.com that would scan the links in the page to identify broken links, page's not displayed and to keep track of webspeed server errors(basically white and yellow pages). This would eventually include the storing of the information into a database and possibly the formulation of graphical reports as well as immediate e-mail notifications when status is critical.

The good news: Most of the program will be written in Perl :)
The bad news: I've never used Perl before. :(

So, I've been researching Perl this last few days. The syntax seems clear to me, nothing I can't understand with just some time of study since it's fairly standard. But the issues are somewhere else:

Well, I'm running on Windows 98 2nd Ed and I downloaded the most recent ActivePerl version. I downloaded Perl verification scripts to use as a reference. (Link Checker version 1.4 web version Created by Aaron Anderson to be precise) I would like to strain that I'm just using it as a study reference and I will not make any unethical use of its code.

Now, my problem right now is: I have the file check.pl, which is the main program. But, my problem is, that I don't know how to run the program. Mainly, what happens is that if I run the *.pl file, it runs on the ActivePerl console, and all it does is display some HTML code before closing itself. Same thing I noticed with different software I downloaded. If I try to open the file directly from a web server the same thing happens. So, what I would like to know, if any kind Monk out there hear's my pleas, is how can I manage to open that file with explorer in HTML format, it is important that I understand how that is done so I can start doing my own code.

There's another thing I don't quite understand. Some veryfication programs I've seen seem to use the LWP-UserAgent and the LWP-Simple modules. However, I don't understand if those modules are included or how to download them, since all I can find are variants.

That are my main doubts. Thanks a lot for taking the time to read my post and I would deeply appreciate any help I could get with this little confusion of mine. If this post reeks of absolute newbieness, and you already hate me for it, please allow the moderators to let me know in a civlized manner and avoid the unnecessary flaming.
  • Comment on Begginer: Need help on implementing web Perl code on Windows

Replies are listed 'Best First'.
Re: Begginer: Need help on implementing web Perl code on Windows
by Joost (Canon) on Dec 22, 2004 at 22:17 UTC
    Just some answers in random order:

    For activeperl you can use the (command-line) ppm command to install perl modules - and I don't think LWP is installed by default with activeperl (though I might be wrong about that - I haven't used activeperl in a while)

    If you've got activeperl installed correctly, clicking on a *.pl file would start the program. You can also run programs directly from the command line by typing

    perl path/to/perlfile.pl
    on the command prompt (DOS window). Win98 might not be the best OS to develop on, though - windows XP or NT seems to be better - or use a UNIX derivate like linux of freebsd if you've got some experience with UNIX or can afford the time to learn.

    The programs that output HTML code are probably meant to be run as CGI programs, so you would need a web-server configured to run CGI scripts - I don't think win98 has one, though IIS is installed distributed with some/most/all NT and XP installes. You can also try XAMPP - which has perl, the apache webserver (and PHP) in one package.

    Also, if you want a perl module that can do webscraping you might like WWW::Mechanize - it's probably available via ppm.

    Another hint: running "perldoc ModuleName" from the commandline should give you the docs for that module - though activeperl also installs some nice looking HTML versions of those docs. "perldoc perldoc" should give you more info.

      Agreed, agreed.
      I have a comment on the Win98SE question. Please don't -- me; I'm not recommending it, just trying to help.
      I've spent a bit of time working with Win98SE, Linux, BSD and MAC OS (MacPerl) platforms, and I have used perl CGI scripts on all of them, and moved them from one to another with almost no changes required. Portability, thy name is Perl.
      On Win98SE it's a matter of adding the Personal Web Server, and doing some things to get it to do CGI. The security is, as far as I can tell, nonexistent, but it's an okay platform for goofing around and learning a bit about CGI. I would NOT open it to the Internet, and I wouldn't use it for a production server, by any means. (For production, Apache, mod_perl... others can make much better recommendations than I can.)
      Here's a page which google gave me... which describes how to get PWS to run Perl scripts as CGI programs. It involves registry editing, so take care. Having said that, if you're careful, it's not rocket science.

      http://www.taltech.com/TALtech_web/support/bcax/Installing%20Perl%20Scripting.html

      Personally, I hope you can use a different platform, but anyway, I hope this note helps.
Re: Begginer: Need help on implementing web Perl code on Windows
by davido (Cardinal) on Dec 22, 2004 at 22:20 UTC

    I guess the first thing to do is to determine if the script you're trying to use is meant to be a command line script, a GUI script (unlikely in this case), or a CGI script. If it's a command-line script, open a DOS console window and run it from the command line. If it's dumping a bunch of HTML, it may be a CGI script, in which case you'll need to let a webserver run it. For that, you'll need... a webserver (such as Apache), or you'll need to put it online with an ISP that allows you to install CGI scripts to run on its webserver.

    Regarding modules, if you're using ActiveState's Perl, you probably also have the PPM utility, which can be used to install modules on your local system. For installing on your ISP's system, you'll need to know what OS you're using, and will need to use the makefile that comes with the module's distribution from CPAN. There are also Tutorials here at the Monastery for how to install modules. Read them, they're very helpful.

    And as for which modules to use, I think you'll find that WWW::Mechanize is very helpful.


    Dave

Re: Begginer: Need help on implementing web Perl code on Windows
by punkish (Priest) on Dec 23, 2004 at 03:43 UTC
    Well, I'm running on Windows 98 2nd Ed and I downloaded the most recent ActivePerl version.

    If possible, upgrade to Win 2000 or Win XP. Win 98 is just simply too iffy to do anything reliably, let alone run a web server.

    Now, my problem right now is: I have the file check.pl, which is the main program. But, my problem is, that I don't know how to run the program. Mainly, what happens is that if I run the *.pl file,
    How do you "run" the *.pl file? Please explain.
    it runs on the ActivePerl console, and all it does is display some HTML code before closing itself
    There is no such thing as "ActivePerl console." I assuming you mean the DOS window. Which, in turn means, that you are typing check.pl at the command line. In which case, it is doing the correct thing -- running in the console. On the other hand, if you see the DOS window flash open when you try to go to check.pl from your web browser, then your script is not sending the correct headers to the web server so it can display the results in a web page. I am assuming you are using PWS since you are on Windows 98. Look at the docs for configuring it correctly, and look at the script to make sure it is sending the correct headers.

    As others said, use PPM to install modules such as LWP and others. But, you are likely a few steps away from that if you still have to configure your web server and scripts to work well together.

    Welcome to Perl and this site. For better answers, please provide more and exact details on what you are doing.

Re: Begginer: Need help on implementing web Perl code on Windows
by BravoTwoZero (Scribe) on Dec 23, 2004 at 14:06 UTC

    Your english is better than I could ever hope for my Spanish!

    Joost's suggestion of XAMPP to easily get a working Apache install is probably your best bet.

    But, if you will be using Windows 98, it includes Personal Web Server, and there are ways for it to use Perl. This might be useful: http://www.danchan.com/feature/2000/10/16/cgiwin/cgiwin.htm

    This also helped a lot in my Perl on Win32 quest: http://www.northbound-train.com/perlwin32.html

    I have not run Apache or Personal Web Server on Windows 98 in a very long time, so the best I can offer is the link and my best wishes for your success!



    --
    Amatuers discuss tactics. Professionals discuss logistics. And... my cat's breath smells like cat food.
      One more thought re servers: if you are truly stuck on W98.2, I would (personal experience: anecdotal, non evidentiary) commend (first) Apache or (second) Xitami. And -- not merely anecdotal -- clean and defrag your registry. I'm of the school that holds that occurances of BSODs increase rapidly as W98 reg becomes more complex.

      If you're working on your own machine, you'll have a great deal more freedom to create a useful environment than is likely if you're in thrall to the self-annointed "high priests" who reign in too many IT departments. If so, and your CS background gave you any Linux knowledge, then prior recommendations to use it should be considered. Takes a lot less oomph in the hardware department to do equivalent tasks!

      welcome aboard!
Re: Begginer: Need help on implementing web Perl code on Windows
by wolfger (Deacon) on Dec 23, 2004 at 12:36 UTC
    I see others are already helping you, so I'll make the obligatory social post. :-)
    Hello monks, before I start with my issue please allow me to introduce myself. Oh, before that, just so you keep in mind, I'm totally new to Perl and to The Monastery.
    Welcome to the monastary, and welcome to Perl! I hope you stick with both. They are good places to be.
    Also, since English is not my native language, some of my writing may seem incoherent.
    Your English is very good. Better than a fair number of Americans...
    So please bare with me, ok?
    Well, with one exception, maybe... ;-)
    "Bare" is to remove coverings. "So please get naked with me"... LOL!
    "Bear" is the spelling you want in this case. "So please put up with me".
    Just one mistake that made me smile... You really are very well spoken. Again, welcome to the Monastary!

    --
    Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
    perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'
Re: Begginer: Need help on implementing web Perl code on Windows
by mkirank (Chaplain) on Dec 23, 2004 at 12:49 UTC

    If you want to run it from a browser , you must Install a web server and configure it to execute the perl scripts
    if you want to run it through command line
    open the command prompt(start->run->command) , navigate to the directory where the script is located (cd c:\somedir)
    execute the script by typing
    perl scriptname
    If it gives error saying perl command not found then you have to set the PATH variable where the perl.exe is located

    Once you do the above then
    Check this link for installing modules and also you can check which modules are Installed PPM

    This should get you started
My advice...
by tphyahoo (Vicar) on Dec 23, 2004 at 14:08 UTC
    Others said

    -- Upgrade to WinXP, or at least 2000 -- definitely agree.

    -- Install XAMPP -- yes, this is the most painless way to go for apache. XAMPP apache also has a perl addon. Install that as well.

    To this I add the following.

    1) After you have perl apache and the other usual suspects up, working, and configured, back yourself up. Use two partitions, and back up your system partition using Norton Ghost. Then if something funky happens later down the line, you can revert back to your nice installation without spending hours and hours figuring out which module you needed to install to accomplish what.

    Here is tutorial for creating a sample app using perl and mysql. I found it helpful.

    I was in almost the same situation as you a couple of months ago, and I am really glad I took some time to learn perl. It's incredibly powerful. Good luck!

    thomas.

Re: Begginer: Need help on implementing web Perl code on Windows
by Plotinus (Sexton) on Dec 23, 2004 at 16:04 UTC
    Deib, I also am a newbie (didn't even have your programming background) and use activeperl. I can't answer all your questions but here are some tips I've picked up.

    To add new modules in ActivePerl open a command box and type ppm at the prompt. 'help' will give you the options available.  ppm install package::name works on my system.

    On Perlmonks please avail yourself of the tutorials available (they really are excellent). Become familiar with the PERL debugger.

    ALWAYS use strict; use warnings; (and if necessary) use diagnostics;

    And welcome.

    Plotinus

Re: Begginer: Need help on implementing web Perl code on Windows
by robot_tourist (Hermit) on Dec 24, 2004 at 12:06 UTC

    Hola!

    1. Looks like you are using CGI. I was in a similar position 2 years ago for my year of professional experience out of university. I was adding some reports to my team's Bugzilla server. Fortunately it ran on Mandrake Linux, so I used Exceed and KATE for development and never had to install any new modules. Unfortunately, Bugzilla has it's own 'non-standard' CGI framework, so...
    2. Ovid's CGI tutorial: http://users.easystreet.com/ovid/cgi_course/
    3. You also need to get your web server sorted. I assume your desktop Win98 box is for development purposes only and I'm guessing that since you are the student, you have the spare PC that could not be upgraded, 2 of my student friends had the spare Win95 PCs when they worked here :( I can only say search the Windows PWS help files and have a look at ActivePerl's HTML documentation, sorry.
    4. Stop apologising!
    5. ???
    6. Profit!
    7. Oh wait... This isn't /.
    8. $my{XP} > $my{Perl}{skill}, so I would suggest you read the license of the sample scripts you have downloaded and ask your manager/mentor if you can just plug them straight in. If (s)he says OK, then you have a pretty good tool that you just need to glue together. If this is meant to be learning exercise then have some fun and do it your way.
    9. Check Perl's GD::Graph for your reports, or output your numbers to Excel format and use VB to do your graphs
    Buenas nachos :)

    How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
    Robot Tourist, by Ten Benson