t's profileThomasGoddard.comPhotosBlogNetworkMore Tools Help

Blog


    September 05

    Perl:: Get input from a command line

    It's a trivial task in C# but in Perl you have to understand what's required and what to call to get the input.  After you understand what's required, it's pretty simple.

    #< -- thats a comment
    #We have to use Win32::Console instead of Term::ReadLine
    #Term::ReadLine has issues on windows systems and will fail with "SetConsoleMode failed in ReadKey"

    use Win32::Console;

    #this is used to take hash values and convert to standard strings.
    use Data::Dumper;
    use Time::HiRes qw(gettimeofday tv_interval);
    use strict;
    use warnings;

    #First we set the terminal variable to the new win32 console.
    my $term = Win32::Console->new('Geo::Coder::US');

    #Now we allocate the memory for the terminal
    $term->Alloc();
    #Now we show the display
    $term->Display();

    #This will output some text to the terminal
    print "Enter some data below\n";

    #This is where the variable cool is set to the input of the user.
    #The screen will wait for input
    my $cool = <STDIN>;
    #This will clear any new lines in the cool variable
    chomp($cool);

    #That's it we can print the variable.

    print $cool

    September 03

    Getting perl to compile things

    Well, I'm not a Perl Guru, I'll admit.  I am interested in working with it to discover some IP that is not yet out for .net.

    In my adventure down the Perl path I ran into some newbie questions and answers.  These might be some simple issues but they're important for new perl developers.

    When running the Makefile.PL that comes with any perl application by typing Makefile.PL, after  you've installed ActivePerl, you can sometimes receive warnings about  dependencies missing:
    Warning: prerequisite "your component" "Version" not found.

    Use ppm install 'your component' to install the binary of the component...