How to Show Error Message pop-up window in Perl?

Posted on 2006-11-01
Medium Priority
Last Modified: 2012-06-27

I am working on ne script....that will create a .csv file as a output and copy that file to a network drive.
If the drive is not there...it mount that drive and copy that file...

I want to put something in there....that will pop-up the error message if the files are not copied due to some reason and then continue with the program.
As this script is called by another program, if I use die command it will stop there...instead I want to show error-message pop-up windiw....so user know that files are not copied...

Please advise....
Question by:nick2307
  • 2
LVL 17

Expert Comment

ID: 17850578
What OS will the script be running on?
LVL 39

Expert Comment

ID: 17850650
use strict;
use Tk;
use Tk::Dialog;

my $mw = MainWindow->new();   #Create object
$mw->withdraw();              #Don't display main window

my $response = $mw->messageBox(
 -icon => 'question',
 -message => 'Hello World!',
 -title => 'My title',
 -type => 'AbortRetryIgnore',

print "response=$response\n";
LVL 39

Expert Comment

ID: 17850663
If you will only be on Win32, there is a win32 only module.  The above will work on windows or unix.
LVL 18

Accepted Solution

Morcalavin earned 500 total points
ID: 17850944
For win32 only:

use Win32;

Win32::MsgBox("Message", 0 + MB_ICONINFORMATION, "Title");


Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question