473,573 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

interactive mode ` ` in perl script

DGG
I have got a question arsing from my perl program.

Basically, I want to get the machine date and time, and display it on a
Tk label.

I am using ActivePerl, and running on DOS/Windows.
So I would use `date` to get the current date.

Though "date" has a silent mode. I am thinking in general, if assume
"date" only has an interactive mode. So after typing in "date", after
displaying the current date, the program also awaits an input (new date
setting or an ENTER) to complete.

As we are running inside a perl script, how can one imitate an
interactive input to feed into the program input?

Thanks guys

Jul 19 '05 #1
3 7416
In article <11************ *********@l41g2 000cwc.googlegr oups.com>, DGG
<to******@necte ch.co.uk> wrote:
I have got a question arsing from my perl program.

Basically, I want to get the machine date and time, and display it on a
Tk label.

I am using ActivePerl, and running on DOS/Windows.
So I would use `date` to get the current date.

Though "date" has a silent mode. I am thinking in general, if assume
"date" only has an interactive mode. So after typing in "date", after
displaying the current date, the program also awaits an input (new date
setting or an ENTER) to complete.

As we are running inside a perl script, how can one imitate an
interactive input to feed into the program input?


There is no need to use an external command to get the date and time.
Use the Perl function localtime and perhaps one of the many
time-manipulation modules available from CPAN (like DateTime), or the
POSIX strftime function.

FYI: this newsgroup is defunct. Try comp.lang.perl. misc in the future,
and comp.lang.perl. tk for questions about Perl/TK.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 19 '05 #2
DGG wrote:
I am using ActivePerl, and running on DOS/Windows.
So I would use `date` to get the current date.


I take it that you haven't tried using localtime() in scalar mode.
$date_as_a_stri ng = localtime;

You should learn the difference between
print localtime(),"\n ";
and
print localtime()."\n ";
Jul 19 '05 #3
DGG
Thanks. I would never know this group is defunct now

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1293
by: Steve Menard | last post by:
I have a strange problem with Python command-line interactive mode. Problem has been observed on every 2.3 version where it was tested, from 2.3 alpha to 2.3.4 Test is run on windows XP and 2000 I have written a ptyhon extension module called jpype, and run the following code D:\>python
20
2431
by: Joe | last post by:
When you run "python -i scriptname.py" after the script completes you left at the interactive command prompt. Is there a way to have this occur from a running program? In other words can I just run scriptname.py (NOT python -i scriptname.py) and inside of scriptname.py I decide that I want to fall back to the interactive prompt? I've...
2
7199
by: Matt | last post by:
I have a few ideas that I would like to implement using javascript, but I'm not sure how to go about this, perhaps some folks here could lend a hand. The first seems relatively simple. I would like to be able to have a user click anywhere on a map (say a standard US map or maybe a satellite image which would change, but the map dimensions...
3
2402
by: Pankaj | last post by:
I am facing a very basic problem as any new bie would face. I know perl and now i want to use python In perl, it is very simple , just "perl scriptname.pl" will execute the script. But i think python is worse than perl
4
2627
by: j_macaroni | last post by:
I know you can start php -a and go into interactive mode. This works well exept you have to keep putting <?php code here ; bla blah code ; Couple of problems with this. 1) Exits php when you make an error. 2) When you type a command; it displays the result but does not do an automatic CR/LF
10
2276
by: notejam | last post by:
I am trying to get started with a interactive version of Python for windows and need some help. I have played with the tutorial, and now want to write a program. In basic language, I could write something like 10 print "hello" 20 print "Jim" and if I run it I would get hello
0
1196
by: Simon Eves | last post by:
I am trying to write a Python module to embed the functionality of Maya (the 3D modelling and animation application from Autodesk, formerly Alias) for doing scripted scene manipulation and rendering processes in Python. I am aware of the CGKit project, which does this and a lot more, but it is over-complex for our needs, and also does not...
2
1455
savanm
by: savanm | last post by:
hi ... I have a problem with the PPM(Perl Package Managment utility). when i run the command PPM. i didn't get the interactive(Gui mode window) to install packages, instead it's running in the command prompt. Like this
3
1800
by: Sal | last post by:
I'm running PHP 5.2.6 on WindowsXP. When I try interactive mode with ">php -a" the slightest syntax error throws me out of the interpreter and back to the command line. This is not very useful. Isn't there a way to stay in interactive mode after a syntax error?
0
7699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7788
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3733
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2216
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1304
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1041
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.