Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

No excuses about not using

by merlyn (Sage)
on May 03, 2001 at 18:57 UTC ( [id://77669] : note . print w/replies, xml ) Need Help??

in reply to variables not posting?

Before anyone rips me for not using CGI, I want to let it be known that I am unable to use CGI for this application due to the server I will be using it on.
I don't buy that one. Sorry.

If it's a recent usable version of Perl, then came with it.

Even if it's not, is a single file. Download it, extract it from the distribution, and place it in the "current directory", likely the same place as your script, or add a use lib... directive to point to its location.

Even if that option is not available, because they've said "your application must fit in a single file" (a ludicrous requirement, but work with me on this one), you can edit your single file as follows:

BEGIN { ... insert contents of here, stopping just before the __END__ t +oken } BEGIN { CGI->import(":all"); } ... your code goes here ... my $foo = param("bar"); ... more of your code goes here ...
There. No excuses. Use

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: No excuses about not using
by boo_radley (Parson) on May 03, 2001 at 19:09 UTC
    As a reinforcement to merlyn's message, you don't appear to be checking some parameters when your script starts. Going directly to your script produces the output attached below. I don't know what it means, but I bet you don't want the world to peek freely at this information.
    On the other hand, the weather script you've got is quite nice.
    0 0 GENERAL COMMENTS: Several times this week, and last loose t-bars were + found 1 all of which were the new style. I dont think that 1 they work and should do some testing before spending more 1 money than necessary on them...rjy 1 1 OXIDE POLISHERS: 1 ====================================================================== +========== 1 Westech401 - 1 Westech402 - *****SHUTDOWN-NOT IN PRODUCTION***** 1 Westech403 - *****SHUTDOWN-NOT IN PRODUCTION***** 1 Westech404 - *****SHUTDOWN-NOT IN PRODUCTION***** 1 Westech409 - 1 Westech410 - 1 Westech411 - 1 Westech412 - 1 Westech413 - 1 Westech414 -failing for range, t-bar was loose as a goose, tightene +d 1 down and requaled, mesh style screen was also clogged.. +.dwh 1 1 Westech415 - 1 Westech416 - 1 Westech417 - 1 Westech418 - 1 Westech419 -failing for qual, running conditons...rjy 1 Westech420 -failing range all day, recalibrated the back pressure, 1 rebuilt carreir, replaced the pad, and ened up placing the golden 1 carrier on and the qual 1 1 Also found the screen was very clogged, had to take 1 it off to get it cleaned out. dwh 1 ***WESTECH421 IS A GOLDEN TOOL-PLEASE MONITOR CAREFULLY AND FOLLOW DY +C PLAN*** 1 Westech421 -failing for qual, rebuilt the carrier, refailing for 1 qual, changed the pad and running conditons...rjy 1 1 Westech423 - failing qual for range, checked and reinstalled t-bar 1 and it passed but failed tw for range an hour later. 1 Found drive plate was sticking to the t-bar, changed 1 it and it passed. dwh 1 1 0 0 Westech405 - 1 Westech406 - 1 Westech407 - 1 Westech408 - 1 Westech422 -adjusted the wafer sensor map for load cass...rjy 1 Westech426 - 1 1
Re: No excuses about not using
by grinder (Bishop) on May 03, 2001 at 19:45 UTC

    Furthermore, if you don't like looking at all that scary stuff at the beginning of your script, you can place those BEGIN { } code blocks at the end of your script. Won't make a whiff of difference, it'll run just the same.

    Randal is right, heed his advice.

    g r i n d e r
      Not quite. The import can import prototypes, which need to sucked in before the rest of the code is compiled. Maybe not true for in particular, but I like to show a general template that can be copied for other problems without fear.

      -- Randal L. Schwartz, Perl hacker

        Actually in general I consider avoiding unexpected prototype conversion a good thing. In which case having a good way to silently ignore unwanted prototypes (and trust me, I rarely want them) is a good thing!
Re: No excuses about not using
by stuffy (Monk) on May 05, 2001 at 14:20 UTC
    Thank you for the post. I never knew that modules could be run in a script. That is good information to have. I tried to install it in my directory, but that for some reason didn't work. I also didn't know that all you have to do is place the file in the directory. I thought that the install program had to be run. I will modify my script to use when I have time to work on it again.


Re: No excuses about not using
by Anonymous Monk on Aug 11, 2002 at 02:54 UTC
    Some people (I for one) like to learn how things work instead of using a module to do the work for them (Others I can't vouch for :P). I'm currently writing an IRC bot in perl and I *could* have used Net::IRC but I wanted to be able to write my own code and my own functions and frankly, I just wanted to learn how IRC worked on a client to server basis (After reading rfc2812). Not saying using modules is bad, but some people might like to learn how stuff works before having a module do it for them. -stormgard
      Comments should be directed towards stormgard since I was the one who wrote the above (I forgot I wasn't logged in).
        So, is this an excuse to not use No, it is not. Just because one uses a module does not necessarily mean that one does not understand how 'things' work - period. One uses a module because they want to get stuff done. I find nothing wrong with the desire to learn things, i find nothing wrong with reinventing wheels to further your own education. What i do find wrong is the attitude that using CPAN modules is a 'cop-out'.

        Here is a scenario, you have 1 day to write an IRC bot. What do you do? You use Net::IRC and keep your job. That's what we are talking about here.

        "Some people ... like to learn how things work instead of using a module to do the work for them..."

        No one said you can't do both, some people like to use the module and THEN figure out how they work, if only because the person who wrote that module has more experience and can offer a tried and tested road to explore. perldoc -m is your friend. :)


        (the triplet paradiddle with high-hat)