[22772] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4993 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 16 09:05:46 2003

Date: Fri, 16 May 2003 06:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 16 May 2003     Volume: 10 Number: 4993

Today's topics:
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <abigail@abigail.nl>
    Re: [The/My] trouble with Perl <abigail@abigail.nl>
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl (Helgi Briem)
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: compile error for Time-HoRes-1.47 using perl 5.8.0 (Eric)
    Re: concise code competition (Anno Siegel)
    Re: concise code competition <ubl@schaffhausen.de>
    Re: HELP: module installation without root password <nospam@nospam.com>
        InitiateSystemShutdown Power Off (KieranK)
    Re: MYSQL images <nobull@mail.com>
    Re: newbie need help <peng.zhao@epfl.ch>
    Re: newbie need help (Anno Siegel)
    Re: No data entering @array from open(DATA...) (Anno Siegel)
    Re: novice programmer <nospam4me@yahoohoo.com>
        parse response from system query - too many ways to do  <flavell@mail.cern.ch>
    Re: Problem with flock <see.signature@for.email.address.invalid>
    Re: Question about Net::SMTP <coutu@snowy-owl.com>
    Re: removing spaces in a string (Anno Siegel)
    Re: removing spaces in a string <nospam4me@yahoohoo.com>
        SendMessage with WM_GETTEXT return blank string (derek chen)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 16 May 2003 10:21:53 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4bb61.3094192523@news.cis.dfn.de>

On Fri, 16 May 2003 11:49:18 +0200, Henk van Bree
<geenspam@geenspam.biz> wrote:

>Villy Kruse wrote:
>
>> That pretty much rules out Perl as an option, doesn't it, along with
>> any other scripting languages.
>
>No, while Perl can't be installed on the client machine, at least not a 
>development version, the application can be compiled and deployed. Some 
>support files are OK, as long as there are no option for the user to 
>execute unautorised code on the dataset.

Well, then use PAR.  Or any of the myriad of
solutions to packaging Perl programs, perl2exe,
PerlApp or whatever.  This has nothing to
do with Tk or GD::Graph which can be
packaged in the same way and work fine
out of the box.
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 10:23:56 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4bbd1.3094304694@news.cis.dfn.de>

On Thu, 15 May 2003 20:21:10 +0200, Henk van Bree
<geenspam@geenspam.biz> wrote:

>Darren Dunham wrote:
>
>> What's wrong with Tk?  
>
>Don't get me started... ;-)
>
>There's nothing inherently wrong with Tk, apart from the
>trouble that I'm having installing it (see other post).

Gack.  What's hard?

ppm install Tk

Voila.

>I think it doesn't look too great, but if Tk is my only
>option I'll gladly use it, even if I find the way you have
>to code for it a bit 'noisy'.

GUI code is always a bit noisy.  Tk is one of the
easiest and least noisy GUI building methods I have seen.

>Henk
>Still, I think adding native GUI features to Perl would
>make the world a better place.

No, it wouldn't.  Tk IS the de facto native Perl GUI.
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 10:24:53 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4bc51.3094432939@news.cis.dfn.de>

On Thu, 15 May 2003 21:07:09 +0200, Henk van Bree
<geenspam@geenspam.biz> wrote:

>I think it does. Suppose Perl would have a widget set *built-in*,
>then every platform that runs Perl has the same, consistent, way
>to code a gui. No matter which underlying OS you use, there is
>no hassle with interdependent modules and libs, it just works.

It does.  Perl/Tk apps work identically on Unix, Mac and
Windows and probably on other platforms if need be.

-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 10:26:23 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4bca7.3094519183@news.cis.dfn.de>

On Fri, 16 May 2003 08:51:06 +0100, Simon Andrews
<simon.andrews@bbsrc.ac.uk> wrote:

>PS If you want a reason to not use Perl/Tk, then try interacting nicely 
>with windows print queues - but that's another thread :-)

What on earth does interacting with print queues have
to do with Tk???  
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 14:35:56 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4cd17$0$49104$e4fe514c@news.xs4all.nl>

Helgi Briem wrote:

> Well, then use PAR.  Or any of the myriad of
> solutions to packaging Perl programs, perl2exe,
> PerlApp or whatever.  This has nothing to
> do with Tk or GD::Graph which can be
> packaged in the same way and work fine
> out of the box.

A big part of my problem was getting GD actually
compiled/installed without getting cought in a
maze of twisty little dependencies.

You are obviously further in your understanding of
all the details involved in deploying a large Perl/GUI
project. If can spare the time (I know, hard to ask
of anyone these days) would you consider writing up a
step-by-step instruction on how to do it and put it
somewhere on the 'net?

I'm sure I would not be the only one to benefit from
having access to that information.

Henk



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

Date: Fri, 16 May 2003 14:37:55 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4cd8d$0$49104$e4fe514c@news.xs4all.nl>

Helgi Briem wrote:

>>I think it does. Suppose Perl would have a widget set *built-in*,
>>then every platform that runs Perl has the same, consistent, way
>>to code a gui. No matter which underlying OS you use, there is
>>no hassle with interdependent modules and libs, it just works.
> 
> It does.  Perl/Tk apps work identically on Unix, Mac and
> Windows and probably on other platforms if need be.

It didn't for me. I couldn't get GD to even compile without
severe problems, as outlined in my original post. It isn't
all as obvious as you may think it is.

Henk



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

Date: Fri, 16 May 2003 14:43:25 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4ced8$0$49116$e4fe514c@news.xs4all.nl>

Helgi Briem wrote:

>>There's nothing inherently wrong with Tk, apart from the
>>trouble that I'm having installing it (see other post).
> 
> Gack.  What's hard?
> 
> ppm install Tk

And what platform did you try this on? It doesn't work
for me.

>>Still, I think adding native GUI features to Perl would
>>make the world a better place.
> 
> No, it wouldn't.  Tk IS the de facto native Perl GUI.

*If* that is true, then the integration into Perl is 
horrendous, if you don't mind my saying so. Maybe I'm
too dense to understand, but I really think mucking about
with interdepent modules, libraries and such is sucky 
at best. Maybe TIMTOWTDI, but there seems to be no 
elegant WTDI...

Henk (nothing personal, I just strongly disagree with you)




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

Date: 16 May 2003 11:46:34 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: [The/My] trouble with Perl
Message-Id: <slrnbc9jsq.mth.abigail@alexandra.abigail.nl>

Henk van Bree (geenspam@geenspam.biz) wrote on MMMDXLV September MCMXCIII
in <URL:news:3ec4a5d9$0$49108$e4fe514c@news.xs4all.nl>:
##  Abigail wrote:
##  
## > Henk van Bree (geenspam@geenspam.biz) wrote on MMMDXLIV September
## > MCMXCIII in <URL:news:3ec3e567$0$49104$e4fe514c@news.xs4all.nl>:
## > :)  Abigail wrote:
## > :) > I'm confused. You make an application, and as part of the application
## > :) > it's ok to include Tk, which has a buttload of files, but it's not ok
## > :) > to roll out Perl, which is also just a buttload of files?
## > :)
## > :)  That's the short version of it, yes. The application will be deployed
## > :)  in several financial institutions (banking and insurance) and one of
## > :)  the requirements is that there can be no (as in none whatsoever)
## > :)  development tools on the client machines. Combined with other rather
## > :)  stringent security measures this will ensure no-one tampers with
## > :)  the programs and datasets.
## > 
## > Well, can Perl be on the client machine? If it can, you can deploy it
## > as part of the application. If it cannot, this entire exercise is
## > academic, isn't?
##  
##  No, Perl can't be installed on the client machine, at least not a 
##  development version.

What do you mean by "development version"? A Perl from the 5.9.x series?
I'm not at all suggesting that. Just use 5.6.1 or 5.8.0, whatever you
think is most convenient.

##                       That was never meant to be, as the application can be 
##  compiled and deployed. Some support files are OK, as long as there are no 
##  option for the user to execute unautorised code on the dataset.

I'm still confused. Is the application you are deploying a Perl program or not?


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 16 May 2003 11:50:27 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: [The/My] trouble with Perl
Message-Id: <slrnbc9k43.mth.abigail@alexandra.abigail.nl>

Henk van Bree (geenspam@geenspam.biz) wrote on MMMDXLV September MCMXCIII
in <URL:news:3ec4a4c2$0$49108$e4fe514c@news.xs4all.nl>:
""  Janek Schleicher wrote:
""  
"" >>         **Let Perl 7 have a native GUI widget set!**
"" >> 
"" >> So far I've tried to get Qt, WxWindows, Gtk and/or Tk to work, with
"" >> several degrees of succes but it just doesn't work everytime.
"" > 
"" > These are all native GUI widget sets.
"" > The Perl modules are mostly only wrappers around the native parts.
""  
""  Ah, miscommunication. I meant native to Perl. As in, built in to the
""  language. This would avoid having to muck around with incompatible widgets 
""  sets on different platforms and would help general portability a great 
""  deal.

You could give an example of such an incompatible widget? Could you give
a piece of code that works under Windows, and not Linux, or the other
way around? Now it's just you saying it's incompatible and other saying
it's not.



Abigail
-- 
# Perl 5.6.0 broke this.
%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: Fri, 16 May 2003 12:20:13 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4d5cd.3100957731@news.cis.dfn.de>

On Fri, 16 May 2003 14:35:56 +0200, Henk van Bree
<geenspam@geenspam.biz> wrote:

>Helgi Briem wrote:
>
>> Well, then use PAR.  Or any of the myriad of
>> solutions to packaging Perl programs, perl2exe,
>> PerlApp or whatever.  This has nothing to
>> do with Tk or GD::Graph which can be
>> packaged in the same way and work fine
>> out of the box.
>
>A big part of my problem was getting GD actually
>compiled/installed without getting cought in a
>maze of twisty little dependencies.
>
Hmm.  

ppm install GD worked for me.

So did  perl -e MCPAN 'install GD'.

Actually, downloading the tarball,
running gunzip, tar, make, make test
and make install worked fine too.

I tried all three just now with no problems under
Win2K and Linux.

>You are obviously further in your understanding of
>all the details involved in deploying a large Perl/GUI
>project. If can spare the time (I know, hard to ask
>of anyone these days) would you consider writing up a
>step-by-step instruction on how to do it and put it
>somewhere on the 'net?

What details?  

I mean, I just used ppm to install Tk, then wrote
the code as per examples and instructions from
perldoc Tk.  In some cases, I used perl2exe to package
the final result, but if I were doing it today I would use 
PAR.

>I'm sure I would not be the only one to benefit from
>having access to that information.

It's all in the standard documentation.
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 15:21:39 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4d7ce$0$49109$e4fe514c@news.xs4all.nl>

Abigail wrote:

> This would avoid having to muck around with incompatible
> widgets sets on different platforms and would help 
> general portability a great deal.
> 
> You could give an example of such an incompatible widget? 

I meant that widget sets are incompatible with each other, not
incompatible with itself on a different platform. If I am
unclear at times, please bear with me, this is not my native
language.

That aside, I've made good progress with Tk, it works as
needed.

Henk




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

Date: Fri, 16 May 2003 12:22:16 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4d78e.3101406116@news.cis.dfn.de>

On Fri, 16 May 2003 14:43:25 +0200, Henk van Bree
<geenspam@geenspam.biz> wrote:

>Helgi Briem wrote:
>
>>>There's nothing inherently wrong with Tk, apart from the
>>>trouble that I'm having installing it (see other post).
>> 
>> Gack.  What's hard?
>> 
>> ppm install Tk
>
>And what platform did you try this on? It doesn't work
>for me.

Win2K and Activeperl.
Linux and Activeperl.

I have also done it by hand quite a few times
and using the CPAN module, but PPM is easiest
and solves the interdependencies quickest.

99% of the failures with PPM are because people
don't read the docs (perldoc PPM) and miss the
bit about setting a proxy server.
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

Date: Fri, 16 May 2003 15:24:50 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4d88d$0$49109$e4fe514c@news.xs4all.nl>

Abigail wrote:

> ##  No, Perl can't be installed on the client machine, at least not a
> ##  development version.
> 
> What do you mean by "development version"? A Perl from the 5.9.x series?
> I'm not at all suggesting that. Just use 5.6.1 or 5.8.0, whatever you
> think is most convenient.

I tried to make a distinction between having all of ActiveState's Perl
on the machine and just runtime support for a compiled Perl application.

> I'm still confused. Is the application you are deploying a Perl program or
> not?

It is. It will be deployed as a compiled executable.

Henk



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

Date: Fri, 16 May 2003 15:34:15 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4dac2$0$49109$e4fe514c@news.xs4all.nl>

Helgi Briem wrote:

> ppm install GD worked for me.

It doesn't for me, but I've now succeeded to
build it from the tarfile so that problem is
gone.

> I mean, I just used ppm to install Tk, then wrote
> the code as per examples and instructions from
> perldoc Tk.  In some cases, I used perl2exe to package
> the final result, but if I were doing it today I would use
> PAR.

That should work, but it starts to get very ugly if
things *don't* work for whatever reason.

If "perl -e MCPAN 'install GD'" gets you nowhere but
pages and pages of errors it is not trivial to know
how to fix things. Not for me, at least.

> It's all in the standard documentation.

You made me smile, Helgi, you really did! ;-)

Henk






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

Date: 16 May 2003 03:40:13 -0700
From: eric.chin@pinnacle.co.uk (Eric)
Subject: Re: compile error for Time-HoRes-1.47 using perl 5.8.0
Message-Id: <d8c847cd.0305160240.769deba1@posting.google.com>

Download perl 5.8.0 from CPAN and compiled it on RH 9.0. Recompile
Time-HiRes-1.47 and the compilation was sucessfull. It seems to
suggest perl 5.8.0-88, RH 9.0 distribution not generating the Makefile
correctly. Looking at the Makefile generated by perl 5.8.0, RH 9
distribution, it either mis quoted some string or missing bits and
peices of directories assingned to variable.

Any patch to fix this ?

Eric

eric.chin@pinnacle.co.uk (Eric) wrote in message news:<d8c847cd.0305150507.563e5069@posting.google.com>...
> Greetings,
> 
> I try to compile Time-HiRes-1.47 using perl 5.8.0 and gets:
> "Makefile:91: *** missing separator.  Stop."
> 
> I compiled the same version of Time-HiRes-1.47 on perl 5.6.0 and it
> compiles fine.
> 
> Both Makefile was generated using perl Makefile.PL.
> 
> Is anyone know if there is a patch for perl 5.8.0 to fix the above
> error or know what to modify to fix the error.
> 
> I using RedHat 9.0 and perl 5.8.0-88 come with the distribution. I
> checked RH site and found no patch available.
> 
> Any pointer appreciated.
> 
> TIA
> 
> Eric


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

Date: 16 May 2003 10:09:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: concise code competition
Message-Id: <ba2ddc$mi6$2@mamenchi.zrz.TU-Berlin.DE>

joeri <jvandervloet@hotmail.com> wrote in comp.lang.perl.misc:
> Hi folks,
> 
> we're having ourselves a little competition here
> on making the following code as concise as possible,
> without loosing any performance. Here's the code as it is now:
> 
>     opendir(DIR, $dir="c:/dir") or die "$!";
>     mkdir("$dir/output");
> 
>     for(grep(/\.txt$/, readdir(DIR))) {
>         open(FILE, "$dir/$_") or die "$!";
>         $out = "$dir/output/$_";
>         open(OUT, ">$out") if !-e $out || -z $out;
>         for(@strings=<FILE>) {
>             $_ =~ s/=/\n/g;
>             print OUT;
>         }
>         close OUT;
>         close FILE;
>     }
> 
> So what it does basically is read in all the .txt files from a specified
> directory,
> replace all "=" tokens by a newline, opens an outputfile of the same name in
> a subdirectory
> of the directory where one is reading the files from called "output" and
> writes the text there.
> That's it.
> Any of you guys have a way of writing the above code more compact?

That's too mundane to be fun to optimize.  (The contest trick ceased
to work ages ago.)

Why do you bother to close OUT and FILE, but not DIR?  Leave them
open and save two lines.

Anno


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

Date: Fri, 16 May 2003 12:49:06 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: concise code competition
Message-Id: <ba2irq$fmm$1@news.dtag.de>

joeri wrote:
> Hi folks,
> 
> we're having ourselves a little competition here
> on making the following code as concise as possible,
> without loosing any performance. Here's the code as it is now:

Shouldnt you check whether these succeed:

>     mkdir("$dir/output");

>         open(OUT, ">$out") if !-e $out || -z $out;

These would happen automagically anyway:

>         close OUT;
>         close FILE;

 >        for(@strings=<FILE>) {
 >            $_ =~ s/=/\n/g;
 >            print OUT;
 >        }

while(<FILE>) {
	s/=/\n/g;
	print OUT
}


malte



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

Date: Fri, 16 May 2003 14:40:55 +0200
From: "Stiv" <nospam@nospam.com>
Subject: Re: HELP: module installation without root password
Message-Id: <X05xa.55387$DN.1342085@tornado.fastwebnet.it>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> ha scritto nel messaggio
news:ba2a02$kdn$1@mamenchi.zrz.TU-Berlin.DE...
> Have you tried setting then environment variable PERL5LIB to your
> private directory?  I would have expected the build process to do
> that, but from what you say it doesn't.
>
> Anno


Thanks, Anno, that's the information I needed. Your suggestion was very
useful to me to find the right documentation. It's all right now and the
program is working.
Vielen Dank.

Stiv




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

Date: 16 May 2003 04:33:46 -0700
From: kkontour@yahoo.com (KieranK)
Subject: InitiateSystemShutdown Power Off
Message-Id: <a402dfea.0305160333.7099bf34@posting.google.com>

Hello,
I have been using the 'Win32::InitiateSystemShutdown' to reboot remote
machines.  I now need it to shutdown and power off the machines.  I
can get it to shutdown but now I get ' It is safe to turn off you
computer ' message.  The PC will power off when I do a shutdown
locally.
Any suggestions to why the perl command will not power down.
KieranK


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

Date: 16 May 2003 12:55:37 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: MYSQL images
Message-Id: <u97k8rf6me.fsf@wcl-l.bham.ac.uk>

Music Man <musicman@hotmail.com> writes:

> In article <u93cjhjwy4.fsf@wcl-l.bham.ac.uk>, nobull@mail.com says...
> > Music Man <musicman@hotmail.com> writes:
> > 
> > > In article <3EC1F118.8060401@bbsrc.ac.uk>, simon.andrews@bbsrc.ac.uk 
> > > says...
> > > > Do you really need to store the images in the 
> > > > database itself.  This gives you the overhead of retrieving them and 
> > > > outputting them with a CGI script each time.  When I've needed to do 
> > > > this before I usually store the images on disk, and store their location 
> > > > in the database.  That way I can add the real image location into the 
> > > > first dynamically generated web page and save myself the extra overhead 
> > > > of a separate CGI call for each image.
> > >
> > > Yes, because of the security reasons. You have control over which image 
> > > can be shown. If you have only locations of the images stored in a 
> > > database, than anyone who can guess filename, can actually see it.
> > 
> > Anyone who can guess the HTTP request needed to retrieve the image can
> > see it.  This is inpedendant of how the image is stored.  I also has
> > nothing to do with Perl.
> > 
> > 
> Not true.

Yes true indeed.

> If you have pics stored in a database, a CGI script has a 
> control over it, so it can choose whether to show it or not using 
> different security approaches (WEB server login, login with cookies 
> etc...). 

Web credentials and cookies are still part of the HTTP request.

If you are retirieving from a DB you loose request restartability and
caching unless you go to the effort of generating at least Etag:
headers and maybe some others.

If you store the images in a simple directory that is restricted to be
accessed only by a web server internal redirect or authenticated
requests you get the best of both worlds.  Not, of course, that this
has the slightest thing to do with Perl.  Perhaps you should mosey on
over to CIWAC where this is on-topic and oft-discussed.

(I say "oft" but a quick Google search indicates the most reacent time
I discussed this there was >2y ago)

http://groups.google.com/groups?selm=u94rvemetc.fsf%40wcl-l.bham.ac.uk

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 16 May 2003 14:14:43 +0200
From: Peng Zhao <peng.zhao@epfl.ch>
Subject: Re: newbie need help
Message-Id: <3EC4D633.4060807@epfl.ch>

Thanks a lot for your help, folks.

But there an odd thing happens, when I proceed, it gives me a result 
like this. how does it have so many decimals in the process time, when
get time and done time have only 5?
(kind of reminding me of the old bug of pentiums :-)))
it did it to me with all solutions you proposed me before, it's not very
important as I can just chop decimals. But just by curiousity, what 
makes it do that?

processtime= done-get

done		get		source		process time
---------------------------------------------------------------
962.659710      954.220410 	_o898/760       8.4393
965.353418      964.500950 	_o892/754       0.852468000000044
972.758253      951.882907	_o138/0 	20.8753459999999
973.039610      972.779920 	_o1022/884      0.259690000000091
977.124464      976.919158	_o934/796       0.20530599999995
984.038384      983.382523	_o1230/1092     0.655860999999959
997.548336      997.320344	_o1327/1189     0.227991999999972

thanks ,
cheers.
P.



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

Date: 16 May 2003 12:21:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie need help
Message-Id: <ba2l4o$pdn$2@mamenchi.zrz.TU-Berlin.DE>

Peng Zhao  <peng.zhao@epfl.ch> wrote in comp.lang.perl.misc:
> Thanks a lot for your help, folks.
> 
> But there an odd thing happens, when I proceed, it gives me a result 
> like this. how does it have so many decimals in the process time, when
> get time and done time have only 5?
> (kind of reminding me of the old bug of pentiums :-)))
> it did it to me with all solutions you proposed me before, it's not very
> important as I can just chop decimals. But just by curiousity, what 
> makes it do that?
> 
> processtime= done-get
> 
> done		get		source		process time
> ---------------------------------------------------------------
> 962.659710      954.220410 	_o898/760       8.4393
> 965.353418      964.500950 	_o892/754       0.852468000000044
> 972.758253      951.882907	_o138/0 	20.8753459999999
> 973.039610      972.779920 	_o1022/884      0.259690000000091
> 977.124464      976.919158	_o934/796       0.20530599999995
> 984.038384      983.382523	_o1230/1092     0.655860999999959
> 997.548336      997.320344	_o1327/1189     0.227991999999972

That is a FAQ.  "perldoc -q decimals" will take you there.

Anno


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

Date: 16 May 2003 10:38:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: No data entering @array from open(DATA...)
Message-Id: <ba2f39$mi6$3@mamenchi.zrz.TU-Berlin.DE>

Dodger  <dodger@dodger.org> wrote in comp.lang.perl.misc:
> On 13 May 2003, "Brad Walton" <sammie@greatergreen.com> in 
> news:oZhwa.837397$F1.105601@sccrnsc04 said something that resembled:

[valid points]

> And of course, then, rather than the whole block:
> 
> >  while (<CPDATA>) {
> >   @currplids = (@currplids,$_);
> >  }
> 
>  if this is all you're doing, you could do this:
> 
> 1 while push @currplids, <CPDATA>;

This won't work.  Push returns the new length of the array, so
the loop will never end.

Anno


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

Date: Fri, 16 May 2003 22:46:51 +1000
From: nospam4me <nospam4me@yahoohoo.com>
Subject: Re: novice programmer
Message-Id: <3EC4DDBB.45BA274F@yahoohoo.com>

Anthony wrote:
> 
>My objective is to
> rename a file named ABCDEFF.TXT to nnddmmyh.hmm
> 
> nn= number 0-9
> dd= day
> mm= month
> y=year
> h.h=hour
> mm= minutes
> 

#!/bin/perl
use strict;
use warnings;
use Time::Local;

## rename a file named ABCDEFF.TXT to nnddmmyh.hmm
## nn= number 0-9
## dd= day
## mm= month
## y=  year
## h.h=hour
## mm= minutes

my $num = 1;
my $filename = "ABCDEFF.TXT";
my $time = time();
my ($min, $hour, $day, $mon, $year) = (localtime($time))[1..5]; $mon++; $year+=1900;

$num = $num<10?"0$num":$num;
$min = $min<10?"0$min":$min;
my $h2 = $hour%10;
my $h1 = ($hour - $hour%10)/10;
$day = $day<10?"0$day":$day;
$mon = $mon<10?"0$mon":$mon;
$year = $year%1000;

my $stamp = "${num}${day}${mon}${year}${h1}.${h2}${min}";

# print("$stamp\n");
rename($filename, $stamp) or die("RENAME: $!");


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

Date: Fri, 16 May 2003 13:25:29 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: parse response from system query - too many ways to do it
Message-Id: <Pine.LNX.4.53.0305161316400.25340@lxplus098.cern.ch>


Reviewing the various scripts I've seen which need to issue a query to
the system (a query which is expected to return a number of similar
lines in reply) and parse the result, suggests that Perl has too many
different ways to do it ;-)

There's capturing the result from backticks and then iterating through
the lines of the result; there's opening a pipe from the command and
reading it as i/o; there's various different ways of handling the
result with while, foreach, etc.

What does the team think is the most Perl-ish way to handle this,
please?  (The result should be usable when taint checking is enabled.)


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

Date: Fri, 16 May 2003 11:07:38 +0000 (UTC)
From: "T Goddard" <see.signature@for.email.address.invalid>
Subject: Re: Problem with flock
Message-Id: <ba2gpq$hkf$1@sparta.btinternet.com>

"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:ba29bp$ol080$1@ID-184292.news.dfncis.de...

> > no error messages are generated.
>
> Are you sure of that?

I don't see any error messages on screen, but no I can't be sure that none
are being generated.

> > BTW I'm running ActivePerl 5.8.0.805 Win32 under Windows 98.
>
> Since flock() cannot be used on W95 and W98, you should get this error
> message: "flock() unimplemented on this platform"

Thanks for that, it would explain a lot :-)  I'm just starting out with Perl
and all the platform-specific issues are still new to me.  The system will
be tested under NT eventually so I should have more luck then.

Many thanks for your help

Tim.

--
My real e-mail address is ngroup1 before the at followed by
deskjockey.co.uk.




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

Date: Fri, 16 May 2003 07:21:11 -0400
From: Dan Coutu <coutu@snowy-owl.com>
Subject: Re: Question about Net::SMTP
Message-Id: <3EC4C9A7.1080301@snowy-owl.com>

Shane Mosely wrote:
> "Anthony Saffer" <anthony@nospam.safferconsulting.com> wrote in message
> news:3ebfa56d_2@nntp2.nac.net...
> 
>>Hello Everyone,
>>
>>I'm having trouble with Net::SMTP and am, once again, turning to you guys
>>for help. I have the following code:
>>
>>#!/usr/local/bin/perl -w
>>    use Net::SMTP;
>>    $smtp = Net::SMTP->new('smtp.junct.com',
>>       Hello=>'junct.com');
>>
>>
>>    $smtp->data();
>>    $smtp->datasend("From: Tester <just\@tester.com>\n");
>>    $smtp->datasend("To: anthony\@safferconsulting.com\n");
>>    $smtp->datasend("Subject: A test of SMTP\n");
>>    $smtp->datasend("This is a test");
>> $smtp->dataend();
>> $smtp->quit();
>> print "Mail Sent\n";
>>
>>The program actually makes a connection to my SMTP server (smtp.junct.com)
>>and sends SOMETHING. But I never get the mail. Can anyone tell me what's
>>wrong with this code or is there a problem with the SMTP server?
>>
>>
> 
> here is the script i use for net::smtp so you can see some of the
> differences and for from there:
> 
>   $smtp = Net::SMTP->new('216.86.198.174');
>      $smtp->mail($radd);
>      $smtp->to($item);
>      $smtp->data();
>      $smtp->datasend("From: " . $radd . "\n");
>      $smtp->datasend("To: " . $item . "\n");
>   $smtp->datasend("MIME-Version: 1.0\n");
>   $smtp->datasend("Content-Type: text/html\n");
>      $smtp->datasend("Subject: " . $subject . "\n");
>      $smtp->datasend("\n");
>      $smtp->datasend("<html><body>" . $body . "</body></html>\n");
>      $smtp->dataend();
>      $smtp->quit;
> 
> Something you may have overlooked is the blank line after your message ie
> (\n). Hope this helps If you dont want html formated email just take out the
> mime and content type info.
> 
> 

I have found that the key missing item in the original code is a call to 
the $smtp->to() method. It is this, and not the
"To: anthony\@safferconsulting.com\n" that actually determine the 
recipient. In fact you do not need to include the To: string at all as long 
as you provide that value in the to() method.

Dan



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

Date: 16 May 2003 11:20:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: removing spaces in a string
Message-Id: <ba2hir$pdn$1@mamenchi.zrz.TU-Berlin.DE>

Dodger  <dodger@dodger.org> wrote in comp.lang.perl.misc:
> On 13 May 2003, William Goedicke <goedicke@goedsole.com> in
> news:m3of26eo9u.fsf@mail.goedsole.com said something that resembled: 
> 
> > Dear Kevin - 
> > 
> > kgiles@optonline.net (Kevin) writes:
> > 
> >> how do you remove spaces in a string varaible?
> > 
> > $string =~ s/ //g;
> > 
> 
> The regex can be a little more efficient with s/ +//g
> That way if there are twenty in a row it can sub all twenty with nothing 
> once instead of subbing each one with nothing twenty times.

The fastest way to make single-character replacements is usually tr///.
If it ever matters...

Anno


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

Date: Fri, 16 May 2003 23:09:27 +1000
From: nospam4me <nospam4me@yahoohoo.com>
Subject: Re: removing spaces in a string
Message-Id: <3EC4E307.DD43DE1@yahoohoo.com>

Kevin wrote:
> 
> how do you remove spaces in a string varaible?
> 
> thanks
> 
> kg

Did you want every space character removed, or just the
leading/trailing spaces?


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

Date: 16 May 2003 03:05:43 -0700
From: u8526505@ms27.hinet.net (derek chen)
Subject: SendMessage with WM_GETTEXT return blank string
Message-Id: <85789064.0305160205.19d2468c@posting.google.com>

Hi,
I have a code like this 

	$buf=' ' x 256;
	my $ret=Win32::GUI::SendMessage($hnd, 14, 256, $buf);        #14:
WM_GETTEXT
	$buf=substr($buf, 0, $ret);

and I always get blank value in $buf although the $ret (length of the
returned string) is correct.
Since $buf's data type should be LParam do I need to take any action
to transform it ?
Thanks.

Derek


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 4993
***************************************


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