Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Small Victories for Perl

by dws (Chancellor)
on Jan 25, 2002 at 08:53 UTC ( #141425=perlmeditation: print w/replies, xml ) Need Help??

Today's Small Victory: I'm working in a shop that is, at best, Perl neutral. A few folks are downright Perl hostile. The occasional win helps chip away at some of that hostility.

The problem: We use proprietary software that requires a license server, which runs on a Unix box. Each copy of this proprietary beast eats up one floating license. Developers often find it convenient to run multiple copies. We often see a "Hey, I can't get a license!" email, followed by a cubicle-by-cubicle search. It's possible to telnet in to the Unix and issue a set of commands to get a list of license holders, but few people have accounts. Wouldn't it be great if there was a web page that listed floating licenses?

By policy, the license server box doesn't run a web server. But it does have Perl installed. I have a web server running on my desktop... {Idea!} Grab the Perl Cookbook, borrow a few lines of IO::Socket-based TCP server code, and arrange for it to run the commands to report on licenses and pump the results out the socket. Then make a CGI by borrowing a few lines of TCP client code, pointing it at my tiny server on the license manager machine, and wrapping the results in simple HTML. Now people can hit a page on my server and instantly see who holds licenses.

Total code: 32 lines.
Elapsed time: 12 minutes.
Response from the Perl haters: Cool!

What "small victories" have you had with Perl lately?

Replies are listed 'Best First'.
Re: Small Victories for Perl
by patgas (Friar) on Jan 25, 2002 at 10:36 UTC

    I was going to post something like this a few days ago too. A couple weeks ago, my company had a dire need to FTP a few thousand EPS images off one of our in-house Mac servers while checking our store database to see if they're needed, rename them, throw them through Photoshop (we already had a VB app to run Photoshop actions) that created a couple different sized JPEGs, and then FTP them out to our store server and update the database there. Simple enough, right? It was with Perl. In fact, when my boss and the other developer decided to give this to me, they did it knowing full well I'd use Perl (I'm the only one in the company). As soon as the other developer started telling me about it, I started jotting down pseudo-Perl, to which he replied, "Oh, I knew you had to use Perl for this." When I described the process I was using to my boss, he said, "Oh, I figured you'd use Perl for this." Needless to say, there were some problems with getting the files from the Mac, and I ended up writing another quick script to run on the Mac server to fix some filenames so Windows could get them properly. The Mac admin? "You'll have to show me how you did that, so I can start using that stuff more often." When the whole thing was over, my boss once again told me: "I'm glad somebody's using Perl again." After all that, I promptly went to ThinkGeek and bought the #!/usr/bin/perl sticker for my monitor as a trophy. Another small victory...

    "We're experiencing some Godzilla-related turbulence..."

Re: Small Victories for Perl
by Biker (Priest) on Jan 25, 2002 at 16:12 UTC

    I'm not by far a Perl expert, but I'm the guy pushing for Perl in our shop. I'm also the guy doing a lot of Perl development here.

    In my latest performance review, which occured yesterday, my Perl knowledge was for the first time considered an asset. In fact, an important asset.

    Perl is slowly getting "politically correct" here...

    "Livet är hårt" sa bonden.
    "Grymt" sa grisen...

Re: Small Victories for Perl
by mexnix (Pilgrim) on Jan 25, 2002 at 19:34 UTC
    A while after having my current job, my boss decided to bestow upon me the great task of printing out all of our DNS entries (300 or so - a hosting company). Of course he told me that there was no "easy" way, and to just print them page by page (BACKGROUND: we use a colbat qube for our DNS, so this was done via a pretty web GUI). 300 entries later, I was done, but now he wanted the whois report for every one! ugh! I wasn't going to take this on up the butt. I got the dns entries from the box (the actually files from /etc/named), and made a list with them using perl (Victory 1). Then I needed to do a whois on everyone and print it out.
    Boss: I know of this ASP whois program that would work good for this a +nd it only costs $40! Me: Funk that. We use perl.
    So I decided to get tricky. I went to CPAN, and found a few Whois modules (I ended up on Net::Whois::Raw, hehe, this is before I knew about the unix whois command though :/ ), then I found out our OkiData printer had a print server with an open TCP/IP port! Yay! A little bit of help from IO::Socket (/me drools), cacharbe, and OkiData's support site, I had a script that printed out 300 whois' in one nite! w00t! He normally asks me first before considering asp now :)


    s mmgfbs nf, nfyojy m,tr yb-zya-zy,s zfzphz,print;

    Edit by tye to change PRE around long lines to CODE

Re: Small Victories for Perl
by MungeMeister (Scribe) on Jan 25, 2002 at 22:03 UTC
    On a previous contract, I was the only one in the group that knew Perl. Much to most people's aggrevation, I started integrating my Perl programs into the system (a very large data conversion project). No one thought much of it, as long as I kept it working.

    One of our biggest problems was that building the 50 - 100 C programs (with Oracle Pro*C) was becoming a problem. We had HP/UX for development and initial testing (including testing the build), and Sequent for integrated test, test cycles, and production run. Managing the differences between the C compiler, Pro*C precompiler and make all made things incredibly challenging.

    So, along comes a late requirement to read data from multiple tables, summarize and munge, and load into another table. The estimate given to to develop the C/Pro*C code, test, and get the stupid thing to reliably compile was 1 - 2 weeks.

    Perl: 4 hours. Worked no matter what machine you ran it on. Victory.

Re: Small Victories for Perl
by shadox (Priest) on Jan 25, 2002 at 22:41 UTC
    One small victory for me was a few days ago, a Visual Basic based customer wanted a program to fetch some files from some SCO servers and then insert the data from the files in a MS/SqlServer, so i told him "Hey, i can do that with just a few lines using perl", and he told me, "Perl?, what is that garbage, use VB".
    I didn't say a think and started with the program, about 40 minutes and 30 code lines later it was ready and working just perfect, the customer saw the source code and said, "That thing you call Perl is amazing", now he is learning about Perl, he got a copy of the Llama and Camel Books, and i am almost sure that saw a Perl stick in his car.

    Another small victory was in college, when i used Perl for some projects, and when people saw
    the code, they opened their minds and could look far away from the Visual Something wall.
    Dreams they just disapear into the shadows,
    then they become true....

Re: Small Victories for Perl
by perrin (Chancellor) on Jan 25, 2002 at 22:36 UTC
    One of our DBAs was all in a huff about some SQL scripts that were developed for us by consultants. The indexes and constraints were declared in the table creation statements, and he wanted them in separate tablespaces. He also wanted to change the use of older Oracle data types to the newer versions. He said he would have to go through all the scripts by hand and it would take a week. According to him it could not be automated.

    I wrote a perl script in an afternoon that parsed the SQL scripts and corrected all the problems.

Re: Small Victories for Perl
by FoxtrotUniform (Prior) on Jan 25, 2002 at 21:55 UTC

    My most memorable "small victory", in terms of maximum enjoyment:effort ratio, is this one.

    I've had plenty of others, though. A thirty-line script to search through a filesystem and convert documents from an obsolete format to a new one (the conversion script was already written, and is probably not one of my finest works, but it does work), for instance.

    It seems like most of my projects lately are in the 200 to 300-line range; nice manageable one-person work, and the sort of "easy job" that Perl makes enjoyable. I suppose that is a significant "small victory".


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://141425]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2023-10-04 09:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found