Input Dialog...?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parajaganesh
    New Member
    • Aug 2007
    • 17

    #1

    Input Dialog...?

    I am a begineer for Perl. I need to get an input from the user. In general, we user <STDIN> for input. Is there any Input Dialog Box method is available in Perl....?
  • manimarank
    New Member
    • Jul 2007
    • 23

    #2
    Here is the sample code...

    [CODE=perl]
    #!/usr/local/bin/perl
    use Tk;
    use warnings;
    use strict;

    my $mw = new MainWindow;
    my $ent = $mw->Entry()->pack();
    my $button = $mw->Button(-text => "OK",-command =>\&push_button );
    $button->pack();
    MainLoop;
    sub push_button {
    $name = $ent->get();
    $mw->messageBox(-type=>"yesnocan cel",-message=>"$name ");
    }[/CODE]

    Comment

    • parajaganesh
      New Member
      • Aug 2007
      • 17

      #3
      while running the code i got the following error...

      Can't locate object method "new" via package "Tk::Config ure" at C:/Rational/Common/lib/perl5/site_perl/5.8.6/MSWin32-x86-multi-thread/Tk/Derived.pm line 122. at dialog.pl line 7

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        The code seemed to work for me after fixing one error. Need to add "my" before $name in this line:

        my $name = $ent->get();

        Comment

        • parajaganesh
          New Member
          • Aug 2007
          • 17

          #5
          I have put the my already...

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            I thought maybe you did otherwise the code would not even compile. Are you trying just the code that was posted? If so, I don't know why it is not working. If you are trying different code you need to post the code you are trying to use.

            Comment

            • numberwhun
              Recognized Expert Moderator Specialist
              • May 2007
              • 3467

              #7
              Originally posted by KevinADC
              I thought maybe you did otherwise the code would not even compile. Are you trying just the code that was posted? If so, I don't know why it is not working. If you are trying different code you need to post the code you are trying to use.
              You may want to try re-installing the Tk::Configure module and see if that works.

              Regards,

              Jeff

              Comment

              • parajaganesh
                New Member
                • Aug 2007
                • 17

                #8
                May i know how to reinstall TK:Configure... ?

                Comment

                • jcor
                  New Member
                  • Sep 2007
                  • 63

                  #9
                  One way to install a module is to get it from CPAN (Comprehensive Perl Archive Network) with the command:

                  perl -MCPAN -e "install TK::Configure"

                  good luck

                  Comment

                  Working...