[23772] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5976 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 24 00:05:45 2003

Date: Tue, 23 Dec 2003 21:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 23 Dec 2003     Volume: 10 Number: 5976

Today's topics:
    Re: \r disappear even in binary mode <noone@nowhere.com>
    Re: \r disappear even in binary mode <uri@stemsystems.com>
    Re: \r disappear even in binary mode <dwall@fastmail.fm>
    Re: Best way to send contents of file as body of mail m (at)FinancialDataCorp.com (Bob Mariotti)
    Re: help with file test <me@privacy.net>
    Re: LWP::Simple and Cookies not working <matthew.garrish@sympatico.ca>
    Re: monitor windows processes <dwall@fastmail.fm>
    Re: newbie: Terminating while($line=<stdin>) on Windows (Tad McClellan)
    Re: newbie: Terminating while($line=<stdin>) on Windows (John Deuf)
    Re: Parsing File (Tad McClellan)
    Re: search interval <noreply@gunnar.cc>
    Re: search interval <jgibson@mail.arc.nasa.gov>
    Re: search interval <gnari@simnet.is>
    Re: search interval <matthew.garrish@sympatico.ca>
    Re: Simple telnet-like access (John Deuf)
    Re: Starting Perl Script at Bootup <abigail@abigail.nl>
    Re: Time out SSL request? <jgibson@mail.arc.nasa.gov>
    Re: Using Set::Scalar with DF_File <no_spam_for_jkeen@verizon.net>
        Why does Perl use more resource than Php? <test@test.com>
    Re: Why does Perl use more resource than Php? <mike@no_address.tld>
    Re: Win32: Output to console <lv@aol.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 24 Dec 2003 01:15:27 +0100
From: noone <noone@nowhere.com>
Subject: Re: \r disappear even in binary mode
Message-Id: <pan.2003.12.24.00.15.26.617411@nowhere.com>

On Tue, 23 Dec 2003 22:10:28 +0000, Uri Guttman wrote:
> why don't you explain your real problem instead of the solution you
> want. i smell an xy problem here. you are struggling too hard with the
> only solution you think you have but we don't know what the underlying
> goal really is.

In fact I found by myself another solution for my real problem.

However, I think that the feature introduced from perl 5.005
( http://shrunk.net/?c=9801d4dd ) which consists in ignoring literal
carriage returns is too drastic.

David.



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

Date: Wed, 24 Dec 2003 00:42:38 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: \r disappear even in binary mode
Message-Id: <x7y8t3jbb5.fsf@mail.sysarch.com>

>>>>> "n" == noone  <noone@nowhere.com> writes:

  > On Tue, 23 Dec 2003 22:10:28 +0000, Uri Guttman wrote:
  >> why don't you explain your real problem instead of the solution you
  >> want. i smell an xy problem here. you are struggling too hard with the
  >> only solution you think you have but we don't know what the underlying
  >> goal really is.

  > In fact I found by myself another solution for my real problem.

so at least state it and your solution.

  > However, I think that the feature introduced from perl 5.005
  > ( http://shrunk.net/?c=9801d4dd ) which consists in ignoring literal
  > carriage returns is too drastic.

it was prolly because of the moving of source files from winblows to
unix and back. it makes sense from that perspective. you must be the
first to complain about it and until i know your real problem, i don't
sympathise with your complaint.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Wed, 24 Dec 2003 00:43:47 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: \r disappear even in binary mode
Message-Id: <Xns945AC8B20ABAAdkwwashere@216.168.3.30>

noone <noone@nowhere.com> wrote:

> On Tue, 23 Dec 2003 22:10:28 +0000, Uri Guttman wrote:
>> why don't you explain your real problem instead of the solution you
>> want. i smell an xy problem here. you are struggling too hard with the
>> only solution you think you have but we don't know what the underlying
>> goal really is.
> 
> In fact I found by myself another solution for my real problem.
> 
> However, I think that the feature introduced from perl 5.005
> ( http://shrunk.net/?c=9801d4dd ) which consists in ignoring literal
> carriage returns is too drastic.

Would you mind telling us more about the problem and its solution?  Someone 
else might benefit from the solution to your problem.  There have been plenty 
of occasions when I've found an answer or a pointer to an answer in the 
Google (formerly Dejanews) archives.

-- 
David Wall


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

Date: Wed, 24 Dec 2003 02:19:51 GMT
From: R.Mariotti(at)FinancialDataCorp.com (Bob Mariotti)
Subject: Re: Best way to send contents of file as body of mail message with Mail::Mailer?
Message-Id: <3fe8f75d.48560122@news.cshore.com>

On 22 Dec 2003 08:40:10 -0800, lsrtech@optonline.net (lsrtech) wrote:

>I cannot figure out how to include the contents of a file as the body
>of a mail message using Mail::Mailer.
>
>Do I just open the file into a variable and send it that way?  Is
>there a limit to how much content a variable can contain?  Is this the
>only way?...if not, what is the most efficient way that is not prone
>to cause problems for large files?
>
>Thanks.


I second the recommendation of MIME::lite

I just created such a script today doing the same thing as you asked
for.

My code snippet looks like this:

open (IFH,<filename) or die ...

@data=<IFH>;

then I just referenced @data in the output area and it worked just
great.  The entire contents of the file appeared as the body of the
email message.

Good luck,

Bob


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

Date: Wed, 24 Dec 2003 15:33:37 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: help with file test
Message-Id: <bsatvp$bg22h$1@ID-172104.news.uni-berlin.de>


"S.R.Sriram" <srsriram@sriram.com> wrote in message
news:3FE89231.DD43668D@sriram.com...
Matt Garrish wrote:


>Yes the name for the directory $BASEDIR is odd but well it exists.
>
>Here is the directory structure that exists:
>
>w-srsriram>> pwd
>/home/srsriram/play/$BASEDIR
>
>w-srsriram>> ls -l
>total 0
>-rw-rw-r--   1 srsriram umtscc        11 Dec 23 12:36 foo
>-rw-rw-r--   1 srsriram umtscc        11 Dec 23 12:36 foo1
>-rw-rw-r--   1 srsriram umtscc        11 Dec 23 12:37 foo2

I can't for the life of me think of why you'd want such a bizarre directory
name.  Why did you choose $BASEDIR






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

Date: Tue, 23 Dec 2003 18:09:23 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: LWP::Simple and Cookies not working
Message-Id: <sW3Gb.7540$d%1.1664732@news20.bellglobal.com>


"Dan" <webmaster@heavyharmonies.com> wrote in message
news:Pv3Gb.120414$8y1.373415@attbi_s52...
> I have a script that does a search of completed Ebay auctions for
> certain items. All was fine until a few weeks ago, when Ebay changed it
> so that one must login in order to search completed items. I've modified
> the script to support cookies for the login information after searching
> on deja. The script seems fairly simple, but the get() statement returns
> a page that claims that the browser does not support cookies. I can't
> see what I'm missing here :(
>

By default $ua will identify itself as the libwww version you are using.
There's nothing stopping you from telling the server you're something else:

$ua->agent('Mozilla/5.0');

(untested, however, as I have no interest in ebay... : )

Matt




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

Date: Wed, 24 Dec 2003 00:32:15 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: monitor windows processes
Message-Id: <Xns945AC6BF07E13dkwwashere@216.168.3.30>

[comp.lang.perl was rmgrouped in August 1995.  It offically no longer exists, 
so please don't post there.  We can't help it if some carelessly-administered 
news servers still carry it.]

"RB" <wi@rjsolutions.org> wrote:

> Does anyone know how to monitor the existance of a process running in
> windows task manager.
> 
> Basically I want to start another process only if the previous has finished
> and the script runs in windows.

Often someone has already solved a particular problem and made it available 
on the CPAN.  Try searching there:  http://search.cpan.org/

Win32::Process::Info looks useful.

-- 
David Wall


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

Date: Tue, 23 Dec 2003 20:20:55 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: newbie: Terminating while($line=<stdin>) on Windows
Message-Id: <slrnbuhu07.6n0.tadmc@magna.augustmail.com>

Madhur <a_madhur@vsnl.net> wrote:

> while($line==<stdin>)
             ^^
             ^^
             ^^ this isn't even your real code, is it?


    while ( $line = <STDIN> )


Or you will have problems if you ever put that code into a package,
as the warning in perlop.pod states.

Space characters are not a scarce resource. Feel free to use as
many of them as you like to make your code easier to read
and understand.


> How would this be terminated. 


The sentence above should be terminated with a question mark.


> It is terminated by  ^D on Unix system I
> think.
> But on windows It doesnt work.


^Z


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 23 Dec 2003 19:03:57 -0800
From: google@spongers.com (John Deuf)
Subject: Re: newbie: Terminating while($line=<stdin>) on Windows
Message-Id: <9760255.0312231903.4db48da1@posting.google.com>

"Madhur" <a_madhur@vsnl.net> wrote in message news:<bsa11g$b8aej$1@ID-81175.news.uni-berlin.de>...
> Hello
> while($line==<stdin>)
> {
> 
> }
> How would this be terminated. It is terminated by  ^D on Unix system I
> think.
> But on windows It doesnt work.

Hi,

maybe the line should be read as

   while($line eq <stdin>)

But it is certainly not what you want.
If the initial line was 

   while($line = <stdin>)

you expect maybe that the while stops when STDIN becomes false.

With a PC you may have to face the ^M ending char, the irritating
carriage-return char added to line-feed. I.e. on PC, 2 chars to end
the line.

To cope with that problem, I propose this, but I'm sure there are
better algorithms, using $_ for instance :)

   while (<STDIN>)          # get line in $_
   {
        chomp;              # removes the unix LF char
        s/\015//;           # removes the PC CR char
        $line = $_;         # if you really want the $line var...

           ....  your process ....
   }

Regards

  JD


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

Date: Tue, 23 Dec 2003 19:57:46 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Parsing File
Message-Id: <slrnbuhskq.6n0.tadmc@magna.augustmail.com>

BrokenSaint <tartemp@epix.net> wrote:

> I appologize for my ignorance on how the post groups work.


      http://mail.augustmail.com/~tadmc/clpmisc.shtml

      http://www.catb.org/~esr/faqs/smart-questions.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 24 Dec 2003 00:15:20 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: search interval
Message-Id: <bsait1$bh0qp$1@ID-184292.news.uni-berlin.de>

Ying Hu wrote:
> There are two data sets,
> data set 1:
> A1 123 125
> A2 129 200
> A3 400 420
> ...
> ...
> data set 2:
> B1 126
> B2 130
> B3 202
> ...
> ...
> 
> My question is how to get B2 and A2 { 130 (B2) is in [from]129
> [to]200 (A2)} .

I would suggest that you write a script that does what you want. Perl
is probably a suitable programming language, btw.

If you would encounter difficulties, that you after having made
serious attempts to resolve them yourself can't find the solution to,
please post your program here. If you do so, don't forget to comply
with the posting guidelines:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

Good luck!

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Tue, 23 Dec 2003 15:46:51 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: search interval
Message-Id: <231220031546517888%jgibson@mail.arc.nasa.gov>

In article <3FE8C50D.BE70D081@mail.nih.gov>, Ying Hu <yhu@mail.nih.gov>
wrote:

> Hi,
> There are two data sets,
> data set 1:
> A1 123 125
> A2 129 200
> A3 400 420
> ...
> ...
> data set 2:
> B1 126
> B2 130
> B3 202
> ...
> ...
> 
> My question is how to get B2 and A2 { 130 (B2) is in [from]129 [to]200
> (A2)} .
> 
> thanks
> Ying
> 

Well, you could write a Perl program to do that quite easily :)

Are you asking how to do this in Perl? The best way to get help writing
a Perl program from this newsgroup is to try it yourself and post your
program if you run into trouble. You also need to be a little more
specific about what you are trying to do. In the datasets shown above,
does each line in data set 2 get compared to each line in data set 1,
or is it just B1 checked against A1, B2 checked against A2, etc.? Are
your datasets in text files?

Hint: check out the split function for breaking a line into its
component elements.


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

Date: Tue, 23 Dec 2003 23:19:15 -0000
From: "Ragnar Hafstaš" <gnari@simnet.is>
Subject: Re: search interval
Message-Id: <bsaiic$3pj$1@news.simnet.is>

"Ying Hu" <yhu@mail.nih.gov> wrote in message
news:3FE8C50D.BE70D081@mail.nih.gov...
> Hi,
> There are two data sets,
> data set 1:
> A1 123 125
> A2 129 200
> A3 400 420
> ...
> ...
> data set 2:
> B1 126
> B2 130
> B3 202
> ...
> ...
>
> My question is how to get B2 and A2 { 130 (B2) is in [from]129 [to]200
> (A2)} .

SELECT b.key,a.key from tableb,tablea where b.val between a.minval and
a.maxval

seriously, we need a bit of context here to fathom what your real question
is.

if your data sets are small, simple iteration might be called for
otherwise, more details could help.
for instance what ranges for A and B values are we talking about here?
what are the sizes of the datasets?
are the A intervals non-overlapping? are the B values unique?

what have you tried so far, and how did that fail?

gnari





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

Date: Tue, 23 Dec 2003 19:20:53 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: search interval
Message-Id: <uZ4Gb.7620$d%1.1702095@news20.bellglobal.com>


"Ying Hu" <yhu@mail.nih.gov> wrote in message
news:3FE8C50D.BE70D081@mail.nih.gov...
> Hi,
> There are two data sets,
> data set 1:
> A1 123 125
> A2 129 200
> A3 400 420
> ...
> ...
> data set 2:
> B1 126
> B2 130
> B3 202
> ...
> ...
>
> My question is how to get B2 and A2 { 130 (B2) is in [from]129 [to]200
> (A2)} .
>

Feels like homework, you don't even seem to have tried, AND you didn't even
make it very clear what you're trying to do (are the identifier values of
any use whatsoever???), but since it's the holidays here's something to get
you started: (and please don't post back asking for modifications to the
code if it doesn't do what you want!)

use strict;
use warnings;

my %test;
my %range;

while (my $line = <DATA>) {

   next if $line =~ /^\s*$/;

   my @vals = split(/\s+/, $line);

   if (scalar(@vals) == 2) {

      $test{$vals[0]} = [@vals];

   }

   elsif (scalar(@vals) == 3) {

      $range{$vals[0]} = [@vals];

   }

   else {

      die "Unknown pattern found in data line $.\n";

   }

}

# because life is all about pleasing Uri...

my @print;

foreach my $key (sort keys %test) {

   my $chk = isbetween($test{$key}[1], \%range);

   push @print, $chk if $chk;

}

print @print;



sub isbetween {

   my ($v, $href) = @_;

   foreach my $r (sort keys %$href) {

      # just for clarity I've assigned more comprehensible variable names

      my $min = $$href{$r}[1];
      my $max = $$href{$r}[2];

      if (($v > $min) && ($v < $max)) {
         return "The value $v is between $min and $max\n";
      }

   }

}


__DATA__
A1 123 125
A2 129 200
A3 400 420

B1 126
B2 130
B3 202





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

Date: 23 Dec 2003 19:07:52 -0800
From: google@spongers.com (John Deuf)
Subject: Re: Simple telnet-like access
Message-Id: <9760255.0312231907.757d438f@posting.google.com>

pkent <pkent77tea@yahoo.com.tea> wrote in message news:<pkent77tea-D8C66B.19213723122003@ptb-nnrpp01.plus.net>...
> In article <9760255.0312230955.5e6d4fd6@posting.google.com>,
>  google@spongers.com (John Deuf) wrote:
> 
> > I'd like to use a module in Perl to connect to a remote server through
> > a Telnet like connection.
> > 
> > Something allowing to 
> > - wait for "login" word, then send the "login" name
> > - then wait for "password" then entering my password
> > - then doing a few I/O with the server (commands / answers)
> > 
> > I never used a tcp-ip module in Perl
> > 
> > - what is the best module to use
> 
> I'd use Net::Telnet - the first example does exactly what you've said 
> you want to do:
> 
> http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm
> 
> P

This is *exactly* what I needed : an effective simple solution :)

Thank you.


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

Date: 24 Dec 2003 03:25:34 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Starting Perl Script at Bootup
Message-Id: <slrnbui1pe.cd.abigail@alexandra.abigail.nl>

Andy Lester (andy@petdance.com) wrote on MMMDCCLXV September MCMXCIII in
<URL:news:3FE75885.1070400@petdance.com>:
[] >>To get a useful answer, even if it's not the right place to do it.
[] >>Far better than a malicious lie.
[]  
[] > You may want to take your sarcasm/irony detector to the shop for a
[] > readjustment.
[]  
[]  It's not mine I'm concerned about.  It's the person who originally
[]  posted the question, who has no way of knowing that Abigail's answer is 
[]  wrong.

If their knowledge was at such a level that it wasn't obvious the 
answer was insane, the right answer wouldn't have helped either.

[]  I'd like to think that the person who happens to post in an incorrect
[]  newsgroup doesn't deserve an incorrect answer.

Yeah, but how to stop that. Hire someone to kill anyone posting an
incorrect answer? What are you going to do with people posting a
wrong answer because they lack the knowledge?

[]  We were all rookies at one point.

So? Did you get 100% correct answers on your first 100 questions?
Did you *know* they were correct?

Usenet is an harsh environment. It isn't aimed at people with long toes,
unstable psyches, children, whiners, or people who want to be spoonfed.

Kindergarden is that-away.

And don't bother answering, I plonk whiners. *PLONK*


Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: Tue, 23 Dec 2003 15:41:54 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Time out SSL request?
Message-Id: <231220031541540062%jgibson@mail.arc.nasa.gov>

In article <96996c7b.0312231350.4b960612@posting.google.com>, Michael
Capone <macapone@yahoo.com> wrote:

> Hi folks,
> 
> I'm using perl (actually, mod_perl environment on RH 8.0) to connect
> to an external SSL server.  I feed it an XML request and get a
> response back.  The problem is, the server is flaky, and I'd like to
> be able to timeout / break if I haven't gotten a response in X
> seconds.  (Note that the server may connect, but simply not send a
> response, i.e., it's too busy.)
> 
> I don't really understand filehandles and setting timeouts in unix /
> perl as much as I should.  The code below was lifted from the
> Net::SSLeay readme and worked, and I never questioned it further.
> 
> Could someone show me how to modify the code below to add my timeout? 
> Note that I'm also completely open to other methods of connecting to
> an SSL server; the Net::SSLeay method seemed to be the quickest to
> implement, and I have no idea if there's a better way out there.
> 
> Thanks!
> 
> Michael

I have absolutely no experience using Net::SSLeay, but you might try
getting the file descriptor number and using the select statement to
block on input from the socket using a timeout value. See perldoc "-f
fileno" and "-f select" for more info. The documentation for
Net::SSLeay::Handle doesn't say anything about file number of the
underlying socket, but that for Net::SSLeay does.

> 
> #!/usr/local/bin/perl -w
> 
>     use strict;
>     use Net::SSLeay::Handle qw/shutdown/;
> 
>     my ($request, $response) ;
> 
>     local *F;
>     my $FH = *F;
> 
>     $request = <<ENDXML;    
>     <?xml version="1.0"?>
>     <Request>
>         <UserId>user1</UserId>
>         <Password>pass1</Password>
>     </Request>
> ENDXML
> 
>     my ($host, $port) = ("www.some.server", 443);
>     tie(*SSL, "Net::SSLeay::Handle", $host, $port);
>     
>     print SSL "POST /xmlapps/blah HTTP/1.0\n";
>     print SSL "Content-type: application/x-www-form-urlencoded\n";
>     print SSL "Content-length: " . length($request) . "\n\n";
>     print SSL $request;
>     
>     shutdown(\*SSL, 1);
> 
>     $response .= $_ while (<SSL>);
>     close SSL;
>     print $response;


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

Date: Wed, 24 Dec 2003 03:55:20 GMT
From: "Jim Keenan" <no_spam_for_jkeen@verizon.net>
Subject: Re: Using Set::Scalar with DF_File
Message-Id: <I68Gb.1138$eC.912@nwrdny02.gnilink.net>


"Brian Halligan" <halligan@mcw.edu> wrote in message
news:1b3f172d.0312231004.55e81234@posting.google.com...
> I would like to use DB_File to store and retrive a large number of
> sets in a hash.

Since you didn't post any code, we have to guess as to how you went about
this.  In particular, what are you using as the key to store each hash?


> I have been using Set::Scalar to create and compare
> the sets, but I have been having trouble storing these sets using
> DB_File.  When I try to retrive the set based on a hash key, I get a
> string that looks like the print version of the set.

Cf. the discussion in the Set::Scalar POD about the "display format" for a
Set::Scalar object.  I recall getting tripped up on this when I first
studied this module.

> I would like it
> to return a new set that I could then compare to others.  Do I have to
> 'take apart' the print version and then recreate the set, or is there
> a simple way to avoid this overhead and save and retrive the set
> structure directly?   Thanks.
>
Perhaps you could use the 'members' method:

use Set::Scalar;
use Data::Dumper;

my @a0 = qw(abel abel baker camera delta edward fargo golfer);
my @a1 = qw(baker camera delta delta edward fargo golfer hilton);
my @a2 = qw(fargo golfer hilton icon icon jerky);
my @a3 = qw(fargo golfer hilton icon icon);
my @a4 = qw(fargo fargo golfer hilton icon);

my $s0 = Set::Scalar->new(@a0);
my $s1 = Set::Scalar->new(@a1);
my $s2 = Set::Scalar->new(@a2);
my $s3 = Set::Scalar->new(@a3);
my $s4 = Set::Scalar->new(@a4);

my %HoA = (
 s0 => [ $s0->members ],
 s1 => [ $s1->members ],
 s2 => [ $s2->members ],
 s3 => [ $s3->members ],
 s4 => [ $s4->members ],
);

print Dumper(\%Hoa);    # I think this may give you what you want

For a simpler interface, you may wish to consider the List::Compare module
available from CPAN.  Full disclosure:  I wrote it.  But I've never tried it
in conjunction with DB_File.  HTH

Jim Keenan




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

Date: Tue, 23 Dec 2003 23:40:27 GMT
From: "I Report, You Decide" <test@test.com>
Subject: Why does Perl use more resource than Php?
Message-Id: <Ln4Gb.232551$Ec1.8219387@bgtnsc05-news.ops.worldnet.att.net>

A hosting service lungcapage has banned yabb, because it takes too much
CPU/memory, but phpBB is fine. Is that perl/php or the script itself? why
perl sucks more resource of a server than php? i thought only mod-perl will
suck not regular perl.

-- 
I am Social Liberal-Fiscal Conservative
Social Liberal: Forgiveness, Acceptance of Difference, Universal Healthcare,
Free College Education for Everyone
Fiscal Conservative: Small Government, No Tax for Low Income




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

Date: Wed, 24 Dec 2003 04:58:17 GMT
From: "M" <mike@no_address.tld>
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <J19Gb.631596$HS4.4601996@attbi_s01>


"I Report, You Decide" <test@test.com> wrote in message
news:Ln4Gb.232551$Ec1.8219387@bgtnsc05-news.ops.worldnet.att.net...
> A hosting service lungcapage has banned yabb, because it takes too much
> CPU/memory, but phpBB is fine. Is that perl/php or the script itself?

yabb != perl.  Did the hosting service "ban" perl?  That should answer your
question.




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

Date: Tue, 23 Dec 2003 21:25:35 -0600
From: l v <lv@aol.com>
Subject: Re: Win32: Output to console
Message-Id: <RG7Gb.4537$5M.92429@dfw-read.news.verio.net>

Dave... wrote:
> I'm using Perl on a windows machine to automate Visual Studio .NET C++
> builds each day. The command I run is the VS commandline program
> devenv.exe which outputs log and error information to the console if
> run directly on the commandline. For some reason I am unable to
> capture or redirect this output to the console when I run the command
> from Perl until the entire build is complete. Using system() I get no
> ouput at all so I tried the following...
> 
> $|=1;
> open(COMPILELOG, "$devenvcommand |");
> while( <COMPILELOG> )
> {
>     print;
> }
> close(COMPILELOG);
> 
> This does capture the output, but doesn't print it out until the
> entire build is completed instead of outputing during the build. I
> also tried adding 2>&1 to the command but it did not help.
> 
> Is there a way to output in real time the way it works on the
> commandline or could someone explain to me why it cannot be done?
> 
> Dave...


I do not know where you are in this post, however, here is my $.02

1. try launching a new process to exec the build command using one of 
several options.  Use the command 'cmd', or 'start' or use Win32::process

The following will not print until dir /s is complete
    perl -e " print `dir /s`"

The following will print in real time  (run cmd /? at a command prompt 
for more info).
    perl -e " print `cmd /c dir /s`"

start is another *cool* program provided with win 95 and above.  I use 
it extensively on a win 2000 server to start and capture the output of 
17 separate oracle backups on 11 unix servers. (run start /? at a 
command prompt for more info).
for example, your main script could run, either backtics or system(),
    `start cmd /c $devenvcommand`
or keeping with my example
    perl -e " `start cmd /c dir /s` "

Please note that you might want to use the /k option vs /c when using 
the cmd command in order to view your build output.


2.  Not sure if you need to capture the output from the build, try 
redirecting the build output to a log file if one is not already 
created.  Then, prior to your build command, start another process to 
*tail* the log file, sleep for 2 seconds before opening the log file if 
needed.  When the main script is done running the build command, you can 
continue on and parse the build output if required; or a simple print 
"\a\a";  :)

There are windows ports of the unix tail program on the net for free. 
There is also a perl version of tail
http://search.cpan.org/~sdague/ppt-0.12/bin/tail
or
File::Tail
or
I seem to remember a Perl Recipe of the Day regarding a tail program ( 
you'll need to search for it ).  It involved seek() and resetting the 
EOF, sleeping, then re-reading the file.

Len



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

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 5976
***************************************


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