[16099] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3511 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 29 14:10:37 2000

Date: Thu, 29 Jun 2000 11:10:26 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962302225-v9-i3511@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 29 Jun 2000     Volume: 9 Number: 3511

Today's topics:
    Re: hopdelta program? <jfrankovNOjfSPAM@pobox.com.invalid>
    Re: how can perl know what url it is using (Abigail)
    Re: How to get the PID of a process startet by system() (Rafael Garcia-Suarez)
    Re: How to get the PID of a process startet by system() <herz.s@zdf.de>
    Re: How to get the PID of a process startet by system() (Rafael Garcia-Suarez)
    Re: How to get the PID of a process startet by system() (Abigail)
    Re: How to get the PID of a process startet by system() (Colin Watson)
    Re: How to get the PID of a process startet by system() <tony_curtis32@yahoo.com>
    Re: I am looking for a local Mongers group in South Jer garymgordon@yahoo.com
    Re: I am looking for a local Mongers group in South Jer <care227@attglobal.net>
    Re: I am looking for a local Mongers group in South Jer <uri@sysarch.com>
    Re: I am looking for a local Mongers group in South Jer (Abigail)
    Re: interpreting system() returned numbers newsposter@cthulhu.demon.nl
        Load/users perl_monkey@my-deja.com
    Re: Need help with IIS configuration for Perl script su jinrai@my-deja.com
    Re: Need help with IIS configuration for Perl script su (Abigail)
        need help with timelocal <johschmi@cisco.com>
    Re: Need Help! <care227@attglobal.net>
    Re: Need Help! newsposter@cthulhu.demon.nl
    Re: Need Help! (Daniel Winsor - HESE)
    Re: Need Help! (Tad McClellan)
    Re: Need Help! <care227@attglobal.net>
    Re: Newbie: little perl script <markus.orlich@gmx.net>
    Re: Newbie: little perl script <tony_curtis32@yahoo.com>
    Re: Newbie: little perl script (Tad McClellan)
    Re: PERL & Informix <jbroz@transarc.com>
    Re: Perl Help Please! (Abigail)
        Perl Tk dynamic widget allocation (LMC)
    Re: Perl Tk dynamic widget allocation <stephen.kloder@gtri.gatech.edu>
        Perldoc and Windows98 <samay1NOsaSPAM@hotmail.com.invalid>
    Re: Please help me for win32 perl (John Murphy)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 29 Jun 2000 10:06:31 -0700
From: jfrankov <jfrankovNOjfSPAM@pobox.com.invalid>
Subject: Re: hopdelta program?
Message-Id: <020dfa84.bb255d89@usw-ex0104-026.remarq.com>

Thank you!!!


-----------------------------------------------------------

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



------------------------------

Date: 29 Jun 2000 12:14:12 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: how can perl know what url it is using
Message-Id: <slrn8lmugf.ka1.abigail@alexandra.delanet.com>

Tony Shrimpoton (ts@relson.net) wrote on MMCDXCIV September MCMXCIII in
<URL:news:8jf6pg$jp4$1@vg170.it.volvo.se>:
|| hi ,
|| 
|| i am writing an web site at the moment , and becasue it is sending user and
|| credit card info about i am running it on a 128bit ssl cert
|| 
|| my question is  , how can i get my perl cgi script to know that is is
|| running on https:// and not http:// ?? because i want the script to ent if
|| it is on a http:// cannection


Perl doesn't know, and couldn't care less. 

Now, it might be that there's an answer in the environment somewhere,
but that would make it a question for whatever environment you are
using - not a Perl question. After all, the question would be the
same if you were writing your program in TECO macros.



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


------------------------------

Date: Thu, 29 Jun 2000 15:07:08 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <slrn8lmpop.kk5.garcia_suarez@rafael.kazibao.net>

Stefan wrote in comp.lang.perl.misc:
>Hello,
>
>on Sun/Solaris i'm starting java programs with perl scripts.
>...
>system("java myprogram");
>echo "PID: ?"

You mean 'print' instead of 'echo'.

>How can i get the PID of this java process, not of the script ?

The "system" function executes the java program synchronously: it
returns when the java program has exited. Thus, the child PID does not
make sense in the perl script.

>When i do this with a bash script i can use $!.

$! is related to a background job, started asynchronously.
If you want to start a job asynchronously with perl, use "fork" and
"exec".

-- 
Rafael Garcia-Suarez


------------------------------

Date: Thu, 29 Jun 2000 17:45:00 +0200
From: Stefan <herz.s@zdf.de>
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <395B6EFC.BF78366F@zdf.de>

Hello Raphael

IMHO system() is async and exec() is sync.
But how can fork() help me?

Regards
Stefan

P.S.
Yes i mean print not echo.


Rafael Garcia-Suarez wrote:

> Stefan wrote in comp.lang.perl.misc:
> >Hello,
> >
> >on Sun/Solaris i'm starting java programs with perl scripts.
> >...
> >system("java myprogram");
> >echo "PID: ?"
>
> You mean 'print' instead of 'echo'.
>
> >How can i get the PID of this java process, not of the script ?
>
> The "system" function executes the java program synchronously: it
> returns when the java program has exited. Thus, the child PID does not
> make sense in the perl script.
>
> >When i do this with a bash script i can use $!.
>
> $! is related to a background job, started asynchronously.
> If you want to start a job asynchronously with perl, use "fork" and
> "exec".
>
> --
> Rafael Garcia-Suarez



------------------------------

Date: Thu, 29 Jun 2000 16:07:07 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <slrn8lmt99.of4.garcia_suarez@rafael.kazibao.net>

Stefan wrote in comp.lang.perl.misc:
>Hello Raphael
>
>IMHO system() is async and exec() is sync.
>But how can fork() help me?

See the docs :
  perldoc -f exec
  perldoc -f system
  perldoc -f fork

To start a child process and asynchronously and get its PID:
  my $pid = fork;
  if (not $pid) {
    # We're in the child
    exec('java com.something.foo.Bar'); # Start a java program
  }
  # We're in the father
  # and $pid is the child PID

-- 
Rafael Garcia-Suarez


------------------------------

Date: 29 Jun 2000 12:16:48 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <slrn8lmulb.ka1.abigail@alexandra.delanet.com>

Stefan (herz.s@zdf.de) wrote on MMCDXCIV September MCMXCIII in
<URL:news:395B5B9F.1DAFF438@zdf.de>:
-: Hello,
-: 
-: on Sun/Solaris i'm starting java programs with perl scripts.
-: ...
-: system("java myprogram");
-: echo "PID: ?"
-: ...
-: 
-: How can i get the PID of this java process, not of the script ?
-: When i do this with a bash script i can use $!.



First of all, "echo" isn't a Perl primitive. Second, by the time your
program reaches the mythical "echo" line, whatever process that was
spawned by your system() call has already finished, so what it's pid
was isn't very relevant.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


------------------------------

Date: 29 Jun 2000 16:33:20 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <8jftog$fmv$1@riva.ucam.org>

Stefan <herz.s@zdf.de> wrote:

[Please put your new text after quoted text, not before. I've rearranged
it below.]

>Rafael Garcia-Suarez wrote:
>> Stefan wrote in comp.lang.perl.misc:
>> >on Sun/Solaris i'm starting java programs with perl scripts.
>> >...
>> >system("java myprogram");
>> >echo "PID: ?"
[...]
>> >How can i get the PID of this java process, not of the script ?
>>
>> The "system" function executes the java program synchronously: it
>> returns when the java program has exited. Thus, the child PID does not
>> make sense in the perl script.
>
>IMHO system() is async and exec() is sync.

I'm afraid your humble opinion is wrong :), unless this is simply a
confusion of terminology. Read 'perldoc -f system' and 'perldoc -f
exec'.

Since exec() replaces the process that called it, it's not entirely
obvious that either "asynchronous" or "synchronous" is a good
description of it.

>But how can fork() help me?

Intuitively, one calls fork() to split a process in two; code continues
executing in each branch from the point of the fork. The main difference
between the two branches is that in the parent fork() returns the
process ID of the child, while in the child it returns 0. Thus you can
do something like this (untested):

    $SIG{CHLD} = 'IGNORE';
    defined(my $pid = fork) or die "can't fork: $!";
    unless ($pid)
    {
        exec 'java', 'myprogram';
    }
    print "PID: $pid\n";

I use exec() here as I want the child process to terminate after
executing the Java program.

By the way, you could have found all this out for yourself quite easily
by reading 'perldoc -f fork' and 'perldoc perlipc'.

>> >When i do this with a bash script i can use $!.
>>
>> $! is related to a background job, started asynchronously.

Also note that $! means something entirely different in Perl, namely the
last value of errno or the string corresponding to it, depending on
context.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"It stands for 'Sales and Marketing', you depraved monkeys."
"A rose by any other name, Stef." - http://www.userfriendly.org/


------------------------------

Date: 29 Jun 2000 12:03:48 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to get the PID of a process startet by system()?
Message-Id: <87lmzofmh7.fsf@limey.hpcc.uh.edu>


[ dejeopardised, hopefully correctly ]

>> On Thu, 29 Jun 2000 17:45:00 +0200,
>> Stefan <herz.s@zdf.de> said:

>> Raphael:
>> The "system" function executes the java program
>> synchronously: it returns when the java program has
>> exited. Thus, the child PID does not make sense in the
>> perl script.
>> 
>> $! is related to a background job, started
>> asynchronously.  If you want to start a job
>> asynchronously with perl, use "fork" and "exec".

> Hello Raphael IMHO system() is async and exec() is sync.

Ah, but you're wrong.  system() returns when the
subprocess exits, therefore it is synchronous.

> But how can fork() help me?

perldoc perlipc

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


------------------------------

Date: Thu, 29 Jun 2000 15:34:20 GMT
From: garymgordon@yahoo.com
Subject: Re: I am looking for a local Mongers group in South Jersey.
Message-Id: <8jfq9r$dn8$1@nnrp1.deja.com>

I was also looking for your opinion on joining a Mongers group. (If
you're a member ... what do you get out of it??  Is it worth geting
involved???  Just your general thoughts?)

Thanks,
Gary



In article <395B530F.E14769C1@attglobal.net>,
  Drew Simonis <care227@attglobal.net> wrote:
> garymgordon@yahoo.com wrote:
> >
> > I am looking to join a local Mongers group in South Jersey.
> >
>
> Did you check:
> http://www.pm.org/groups/north_america.shtml
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 29 Jun 2000 11:44:28 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: I am looking for a local Mongers group in South Jersey.
Message-Id: <395B6EDC.2ED95A85@attglobal.net>

garymgordon@yahoo.com wrote:
> 
>   Drew Simonis <care227@attglobal.net> wrote:
> >
> > Did you check:
> > http://www.pm.org/groups/north_america.shtml
> >
> 
> I was also looking for your opinion on joining a Mongers group. (If
> you're a member ... what do you get out of it??  Is it worth geting
> involved???  Just your general thoughts?)
> 
> Thanks,
> Gary


The very first thing they teach you is not to post jeopardy style.

I am not a member of any group, but I am sure it is as much like any
social group as the rest of them.  You get out of it what you put into
it.


------------------------------

Date: Thu, 29 Jun 2000 15:55:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: I am looking for a local Mongers group in South Jersey.
Message-Id: <x7aeg4trap.fsf@home.sysarch.com>

>>>>> "g" == garymgordon  <garymgordon@yahoo.com> writes:

  g> I was also looking for your opinion on joining a Mongers group. (If
  g> you're a member ... what do you get out of it??  Is it worth geting
  g> involved???  Just your general thoughts?)

i joined to meet babes.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: 29 Jun 2000 12:52:59 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: I am looking for a local Mongers group in South Jersey.
Message-Id: <slrn8ln0p6.ka1.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCDXCIV September MCMXCIII in
<URL:news:x7aeg4trap.fsf@home.sysarch.com>:
// >>>>> "g" == garymgordon  <garymgordon@yahoo.com> writes:
// 
//   g> I was also looking for your opinion on joining a Mongers group. (If
//   g> you're a member ... what do you get out of it??  Is it worth geting
//   g> involved???  Just your general thoughts?)
// 
// i joined to meet babes.


Which let to the Boston.pm split off "Mars needs more women".pm.



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


------------------------------

Date: 29 Jun 2000 15:22:49 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: interpreting system() returned numbers
Message-Id: <8jfpk9$7h9$1@internal-news.uu.net>

dbottoms98@my-deja.com wrote:
> Hello,

> Does anyone know where to find info on the numbers returned from the
> system() command in Perl.  I know it says to divide by 256 but what do
> those numbers mean??  Thanks

Check the documentation of the programs you run with system. On unix
systems the manual pages seem to have some information about exit
status and what it means.

eg: from yacc's manual page:

EXIT STATUS
     The following exit values are returned:

     0         Successful completion.

     >0        An error occurred.



------------------------------

Date: Thu, 29 Jun 2000 16:05:00 GMT
From: perl_monkey@my-deja.com
Subject: Load/users
Message-Id: <8jfs2t$f7o$1@nnrp1.deja.com>

I have seen several programs in the past that present the user with a
list of hosts on their LAN, or whatever.  They usually include
information on the current load of the machine, and the number of users
that are on it, and possibly even the uptime.  The trick is that it
seems to provide this information without a login and password, since
when I use one program like this, (Exceed on the desktop) I can view the
load, # of users on a machine I don't have a username for.

How would I go about getting this information in Perl?  I'm fine with
socket programming, that's no problem.  Is there some network protocol
that delivers that information?  (something akin to RPC?) if so, what is
that protocol, and is there a CPAN module?  (There seems to be a CPAN
module for everything)

Thanks in advance


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 29 Jun 2000 15:08:44 GMT
From: jinrai@my-deja.com
Subject: Re: Need help with IIS configuration for Perl script support
Message-Id: <8jfopb$cgp$1@nnrp1.deja.com>

In article <%mI65.820$Dxe.180658688@news.telia.no>,
  "Eirik Kjølsrud" <ekjolsrud@ipares.no> wrote:
> Hi!
>
> I have to use an old perl-script to manage japanese e-mails on a
commercial
> site I administer. I don't have any experience with perl, but
fortunately,
> at this point, all I have to do is set up IIS to support
perl-scripts.
> What I have done is :
>
> - downloaded and installed a perl-interpreter (perl ver 5.001, perl
for
> Win32 build 107)
>
> - executed the script via the interpreter, which worked fine
>
> - tried to enable perl-scripts in IIS, without luck. I followed the
steps in
> a tutorial and made a virtual directory containing the script. The
directory
> is enabled for execution of scripts. In the application setting I
mapped the
> .pl extension with the perl.exe file and made it a 'script engine'. I
have
> checked that users have NTFS-permissions to execute the script. What
happens
> when I try to launch the script in a browser is that the page starts
> loading, but nothing ever happens and eventually it gives an error
message
> explaining that the page cannot be displayed.
>
> If anyone knows what I might try or what I have done wrong or any
other
> method of supporting perl-scripts in IIS it would be of great help!!
>
> Eirik Kjølsrud
>
>
I tried running your script but i dont have the mail program so of
course i got an error, but im not sure if this is the error you got,
the error was:
Sending message
The name specified is not recognized as an internal or external
command, operable program or batch file.
im not sure how you configured your IIS to run scripts but i open the
internet service manager, go to the properties page of your site, home
directory, click configuration, click add, as extention put .pl or cgi,
and add the path to you perl program as the executable i keep mind in
c:\perl, so for me its..C:\perl\bin\perl.exe %s %s
you may have to restart the server.  if the error you got is the same
as mine then something else is wrong.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: 29 Jun 2000 12:28:44 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Need help with IIS configuration for Perl script support
Message-Id: <slrn8lmvbn.ka1.abigail@alexandra.delanet.com>

Eirik Kjølsrud (ekjolsrud@ipares.no) wrote on MMCDXCIV September MCMXCIII
in <URL:news:%mI65.820$Dxe.180658688@news.telia.no>:
--
-- - downloaded and installed a perl-interpreter (perl ver 5.001, perl for
-- Win32 build 107)

Maybe you don't want to use a version of Perl that's 5 years old, 5
major versions behind, and known to have security holes.



Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54" and s/<<EOT/<<EOT/e and print;
Just another Perl Hacker
EOT


------------------------------

Date: Thu, 29 Jun 2000 11:26:13 -0700
From: John Schmidt <johschmi@cisco.com>
Subject: need help with timelocal
Message-Id: <395B94C5.B0B98809@cisco.com>

Perl script below gives me the following error. What do I need to change
to fix it? I have tried many syntax varations but mostly the one
uncommented below.

syntax error in file /users/johschmi/bin/epoch.pl at line 6, next 2
tokens "timelocal ("
Execution of /users/johschmi/bin/epoch.pl aborted due to compilation
errors.


####### Script starts here###########

#!/router/bin/perl

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($^T);

#$time = timelocal
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
$time = timelocal ($sec,$min,$hour,$mday,$mon,$year);
print $time,"\n";









------------------------------

Date: Thu, 29 Jun 2000 11:07:19 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Need Help!
Message-Id: <395B6627.9D67909E@attglobal.net>

tia_miller@my-deja.com wrote:
> 
> bonus, 100% health/dental benefits.  Very casual environment (Shorts).
>                                                               ^^^^^^

When I work from home I wear my undies till 2.  Can I do that at your 
establishment?  (not work from home, but wear undies anyway.)


------------------------------

Date: 29 Jun 2000 15:26:06 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: Need Help!
Message-Id: <8jfpqe$7h9$2@internal-news.uu.net>

Drew Simonis <care227@attglobal.net> wrote:
> tia_miller@my-deja.com wrote:
>> 
>> bonus, 100% health/dental benefits.  Very casual environment (Shorts).
>>                                                               ^^^^^^

> When I work from home I wear my undies till 2.  Can I do that at your 
> establishment?  (not work from home, but wear undies anyway.)

If you do not wear a very short skirt I think you can get away
with not wearing any underwear ;)

Erik



------------------------------

Date: 29 Jun 2000 15:23:01 GMT
From: dwinsor@Eng.Sun.COM (Daniel Winsor - HESE)
Subject: Re: Need Help!
Message-Id: <8jfpkl$h4j$3@eastnews1.east.sun.com>

In article 9D67909E@attglobal.net, Drew Simonis <care227@attglobal.net> writes:
>When I work from home I wear my undies till 2.  Can I do that at your 
>establishment?  (not work from home, but wear undies anyway.)

That depends (no pun intended).  1 - Are they clean?  2 - Are they gender
appropriate (i.e. men's underwear if you're a man, women's for a woman)?
3 - Are they age appropriate?  I mean, Batman Underoos are certainly cool, 
but NOT appropriate in an office setting.
---
Dan Winsor



------------------------------

Date: Thu, 29 Jun 2000 10:56:45 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need Help!
Message-Id: <slrn8lmotd.42g.tadmc@magna.metronet.com>

On Thu, 29 Jun 2000 11:07:19 -0400, Drew Simonis <care227@attglobal.net> wrote:
>tia_miller@my-deja.com wrote:
>> 
>> bonus, 100% health/dental benefits.  Very casual environment (Shorts).
>>                                                               ^^^^^^
>
>When I work from home I wear my undies till 2.  


And after 2 you become yet more provocative?   :-)


>Can I do that at your 
>establishment?  (not work from home, but wear undies anyway.)


I think you are allowed (expected, even) to wear undies
even at places that require ties.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 29 Jun 2000 11:53:31 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Need Help!
Message-Id: <395B70FB.C87C3AC9@attglobal.net>

Tad McClellan wrote:
> 
> >When I work from home I wear my undies till 2.
> 
> And after 2 you become yet more provocative?   :-)
> 

Oh my.  

> >Can I do that at your
> >establishment?  (not work from home, but wear undies anyway.)
> 
> I think you are allowed (expected, even) to wear undies
> even at places that require ties.

They may require it, but can they be _sure_ I am compliant?!


------------------------------

Date: 29 Jun 2000 15:10:19 GMT
From: "Markus Orlich" <markus.orlich@gmx.net>
Subject: Re: Newbie: little perl script
Message-Id: <8jfosr$8p8$1@vita.orlich.de>

Sebastien FERRANDEZ <sferrandez@wineandco.com> wrote:
> 
> I have to learn perl today because I'm planning to schedule a cron job
> under Solaris in which one of the arguments must look like :
> YearMonthDay (ex : today 20000629)


- #! /usr/bin/perl
- use Date::Calc qw(:all);

- ( $year, $month, $day ) = Today();

- if ( $month =~ /[1-9]/ ) {
-    $month = "0" . $month;
- }
- $mpo = $year . $month . $day;

- print "$mpo\n";

I hope, that's what you want.


mpo


------------------------------

Date: 29 Jun 2000 10:16:56 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Newbie: little perl script
Message-Id: <87og4kfrfb.fsf@limey.hpcc.uh.edu>

>> On Thu, 29 Jun 2000 15:43:01 +0200,
>> Sebastien FERRANDEZ <sferrandez@wineandco.com> said:

> /usr/local/bin/my_program -log_date 20000629

> My software vendor gave me the following script :

> #!/usr/local/bin/perl

> $now = time; @now = localtime($now); printf
> "%02d-%02d-%02d\n",$now[5]%100,$now[4],$now[3];

> I get 00-05-29 on stdout !!! Today I'd expect 00-06-29

$ perldoc -f localtime

          and $mon is the month itself, in the range `0..11'
          with 0 indicating January and 11 indicating
          December. 

> but I'd like to have 20000629 all concatenated
> together...  I looked at stuff with localtime() and
> gmtime() but I have troubles understanding quickly the
> way they work ;)

Then take some time!

    use POSIX;
    my $datestr = strftime('%Y%m%d', localtime);

$ perldoc POSIX => strftime

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


------------------------------

Date: Thu, 29 Jun 2000 10:52:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie: little perl script
Message-Id: <slrn8lmokg.42g.tadmc@magna.metronet.com>

On Thu, 29 Jun 2000 17:02:39 +0200, Sebastien FERRANDEZ <sferrandez@wineandco.com> wrote:
>
>
>Tom Briles wrote:
>
>> Sebastien FERRANDEZ wrote:
>> 1) Use proper Subject lines.
>
>Sorry, I admit being a bit in a rush with this.


The Frequent Answerers are also in a rush (there are lots and
lots of posts here each day).

Not putting the subject in the Subject wastes their time,
and makes it likely that they will ignore your article
altogether.

If you rush with the Subject, you may end up with nobody
reading your article. Rushing has high potential to waste
yet more of your (*and* our) time, when you already have
no time to spare.

Rushing your Subject is counterproductive...


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 29 Jun 2000 16:47:48 +0100
From: "Joe_Broz@transarc.com" <jbroz@transarc.com>
Subject: Re: PERL & Informix
Message-Id: <395B6FA4.614B0D80@transarc.com>

Bogdan Pitulac wrote:
> 
> Hi everybody,
> 
> I have a question:
> 
>  How can I use sql-Statemens in a PERL (V5.00) -Script to get some data
> out a Informix (V7.30) database? Or where can I read something about
> these things?
> 

Investigate the perl DBI and DBD::Informix module. A search will turn up
many references. Find them on CPAN


------------------------------

Date: 29 Jun 2000 12:08:34 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Help Please!
Message-Id: <slrn8lmu5s.ka1.abigail@alexandra.delanet.com>

Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCDXCIV September
MCMXCIII in <URL:news:m1aeg4o9yy.fsf@halfdome.holdit.com>:
## >>>>> "Magic" == Magic  <Magic@mattnet.freeserve.co.uk> writes:
## 
## Magic> If I call it using
## Magic> "myscript.cgi?WORD=CHEESE&PAGE=page3.html"
## 
## Magic> then it will send page3.html to the browser replacing all occurrences
## Magic> of "!THE_WORD!" with "CHEESE".
## 
## Magic> Does anyone have a script like that which I could look at?
## 
## Just be very careful that the script doesn't permit
## 
##         myscript?WORD=CHEESE&PAGE=../../../../etc/passwd
## 
## Amazing how many of them do. :)


Oh, it's not up the program to check for sillyness like that.

One would hope one is smart enough to have the server chroot() to
a sandbox before spawning any subprocesses.


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


------------------------------

Date: Thu, 29 Jun 2000 12:17:38 -0400
From: "Francois Eric (LMC)" <lmcfrer@lmc.ericsson.se>
Subject: Perl Tk dynamic widget allocation
Message-Id: <395B76A2.4971548B@lmc.ericsson.se>

Hello,

In the GUI I am creating, I have an array that has info on users :
@user_info[$i]. Its a two dimensionnal array: first dimension being the
user and second dimension the info.  Now I fetch that information from a
file (user and info on user) so the number of users is not determined in
advance.  That is why I have did the following code. $number_users gives
the number of users found in the file and $T is a text widget.

My problem is that when I run the program, I have no problem seeing all
the users ($user_info[$i][0]) but when I click on one of these users in
the GUI, no info is printed out by disp_user_info() because the argument
received is always 21.  This 21 comes from the fact that there are 21
users in the file. In other words, I specify in the tag: sub
{&disp_user_info($i)}, but once the function is called by "MainLoop" it
takes the value $i as it is at that time (which is 21 of course since
the MainLoop is outside of the "for" loop).

How can I give an argument to my tag that is dynamic, so that I don't
have to hardcode the whole thing?

thank you very much

Francois

 ...
for ($i=0;$i<$number_users;$i++)
{
  $tmp_tag = "a" . $i;

  $T->tag(qw/bind $tmp_tag <1>/ => sub {&disp_user_info($i)});
  $T->insert('end', "\t$user_info[$i][0]\n", [qw/demo $tmp_tag/]);
}

MainLoop;


sub disp_user_info
{
  my $a = $_[0];

  print "argument received: $a\n\n";
  print "Nom:       $user_info[$a][0]\n";
  print "Position:  $user_info[$a][1]\n";
  print "E-mail:    $user_info[$a][2]\n";
  print "Tel1er:    $user_info[$a][3]\n";
  print "Telsecond: $user_info[$a][4]\n\n";
}




------------------------------

Date: Thu, 29 Jun 2000 12:35:33 -0400
From: Stephen Kloder <stephen.kloder@gtri.gatech.edu>
Subject: Re: Perl Tk dynamic widget allocation
Message-Id: <395B7AD3.D73FA026@gtri.gatech.edu>

"Francois Eric (LMC)" wrote:

> Hello,
>
> My problem is that when I run the program, I have no problem seeing all
> the users ($user_info[$i][0]) but when I click on one of these users in
> the GUI, no info is printed out by disp_user_info() because the argument
> received is always 21.  This 21 comes from the fact that there are 21
> users in the file. In other words, I specify in the tag: sub
> {&disp_user_info($i)}, but once the function is called by "MainLoop" it
> takes the value $i as it is at that time (which is 21 of course since
> the MainLoop is outside of the "for" loop).
>
> How can I give an argument to my tag that is dynamic, so that I don't
> have to hardcode the whole thing?
>
>

>   $T->tag(qw/bind $tmp_tag <1>/ => sub {&disp_user_info($i)});

Change this to:
  $T->tag(qw/bind $tmp_tag <1>/ => [\&disp_user_info, $i])});





------------------------------

Date: Thu, 29 Jun 2000 09:24:03 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Perldoc and Windows98
Message-Id: <01552fc0.69c4cb43@usw-ex0104-033.remarq.com>

Hi, I have installed ActiveState Perl on my windows98 machine.
whenever I type 'Perldoc something' on command line it freezes.
If something is indeed a word identified by perldoc, this
problem doesn't show up..


Any similar experiences and solutions?




-----------------------------------------------------------

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



------------------------------

Date: Thu, 29 Jun 2000 18:01:09 GMT
From: jcmurphy@dircon.co.uk (John Murphy)
Subject: Re: Please help me for win32 perl
Message-Id: <slrn8lmq7q.8r.jcmurphy@funk.net>

In article <8jdlbt$r8e$1@nnrp1.deja.com>,
    yau818@yahoo.com wrote:

> How can I capture the return message (& error message) when I run below
> script?
> 
> use Win32::Process;
> 
> Win32::Process::Create($ProcessObj,
>                       "d:/appl/evprob.exe",
>                       "evprob -h esmilabea6",
>                       0,
>                       NORMAL_PRIORITY_CLASS,
>                       ".");
> 
> Any suggestion is appreciate.

1)  perldoc Win32::Process

2)  #!/usr/local/bin/perl -w

    use strict;
    use Win32::Process;

    my($ProcessObj, $ExitCode);

    Win32::Process::Create($ProcessObj,
                          "d:/appl/evprob.exe",
                          "evprob -h esmilabea6",
                          0, NORMAL_PRIORITY_CLASS,
                          ".") || die "$^E";

    ...

    $ProcessObj->GetExitCode($ExitCode);


$ExitCode == 259 means the process is still running.  (This
should really have been defined in the module.)



------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3511
**************************************


home help back first fref pref prev next nref lref last post