[19607] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1802 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 24 09:05:40 2001

Date: Mon, 24 Sep 2001 06:05:11 -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: <1001336711-v10-i1802@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 24 Sep 2001     Volume: 10 Number: 1802

Today's topics:
        a bit of help please. <na>
    Re: a bit of help please. <peb@bms.umist.ac.uk>
    Re: a bit of help please. <na>
    Re: a bit of help please. <bart.lateur@skynet.be>
    Re: a bit of help please. <dtweed@acm.org>
    Re: alternatives to ps command (Tim Hammerquist)
    Re: alternatives to ps command (F. Xavier Noria)
    Re: Copying Files on the Server <Graham.T.Wood@oracle.com>
    Re: eval-statement fools garbage-collection ? (Martien Verbruggen)
    Re: eval-statement fools garbage-collection ? <pilsl_@goldfisch.at>
    Re: faster execution nobull@mail.com
    Re: faster execution <bart.lateur@skynet.be>
    Re: faster execution <Rainer.Klier@erl.sbs.de>
        File compression <dc_hallett@hotmail.no.spam.com>
    Re: File compression <Thomas@Baetzler.de>
    Re: File compression <dc_hallett@hotmail.no.spam.com>
        Help: How to set transactions use rollback segment (Mike F)
    Re: How to remove whitespace without losing the 'real'  nobull@mail.com
    Re: How to remove whitespace without losing the 'real'  <theaney@toadmail.toad.net>
    Re: mail script (WIN) <tintin@snowy.calculus>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
        Please Help with Sockets! <oneconcept@yahoo.co.uk>
        Q: How to "reserve" processes <heiko.rau@spamshield.t-systems.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Sep 2001 12:01:58 +0100
From: "NEWS" <na>
Subject: a bit of help please.
Message-Id: <3baf12aa$0$227$ed9e5944@reading.news.pipex.net>

hey there everybody, im new to perl and want to write a basic script that
just counts up in seconds. doesn't sound too complicated,  but i'll be
****ed if i have any idea of how to do it.

anybody out there who can help ?

cheers

chris




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

Date: Mon, 24 Sep 2001 12:42:43 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: a bit of help please.
Message-Id: <3BAF1C33.3AA155CB@bms.umist.ac.uk>

NEWS wrote:
> 
> hey there everybody, im new to perl and want to write a basic script that
> just counts up in seconds. doesn't sound too complicated,  but i'll be
> ****ed if i have any idea of how to do it.
> 
> anybody out there who can help ?

#!/usr/bin/perl -w
use strict;

my $i = 0;
while(1){
	print $i++;
	sleep(1);
}

HTH

Paul

p.s. why not read over the manuals?  

try typing 'perldoc perldoc' and 'perldoc perl' on the command line for
details on the comprehensive documentation available with your
installation of Perl


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

Date: Mon, 24 Sep 2001 12:39:52 +0100
From: "NEWS" <na>
Subject: Re: a bit of help please.
Message-Id: <3baf1b8b$0$237$ed9e5944@reading.news.pipex.net>

thanks for the info



"Paul Boardman" <peb@bms.umist.ac.uk> wrote in message
news:3BAF1C33.3AA155CB@bms.umist.ac.uk...
> NEWS wrote:
> >
> > hey there everybody, im new to perl and want to write a basic script
that
> > just counts up in seconds. doesn't sound too complicated,  but i'll be
> > ****ed if i have any idea of how to do it.
> >
> > anybody out there who can help ?
>
> #!/usr/bin/perl -w
> use strict;
>
> my $i = 0;
> while(1){
> print $i++;
> sleep(1);
> }
>
> HTH
>
> Paul
>
> p.s. why not read over the manuals?
>
> try typing 'perldoc perldoc' and 'perldoc perl' on the command line for
> details on the comprehensive documentation available with your
> installation of Perl




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

Date: Mon, 24 Sep 2001 12:11:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: a bit of help please.
Message-Id: <b78uqtoma0isno8t7kjq6a5pctmgrva7ia@4ax.com>

NEWS wrote:

>hey there everybody, im new to perl and want to write a basic script that
>just counts up in seconds. doesn't sound too complicated,  but i'll be
>****ed if i have any idea of how to do it.

Look at what time() returns. It's an integer that counts the seconds
since jan 1st 1970 0:00:00. So, one is added every single second.

In the long run, it'll run pretty exact, but in the short term, the lack
of resolution may hinder you. There's no telling exactly how long time()
will retain its current value. The module Time::Hires, available from
CPAN (<http://search.cpan.org>) or
http://www.activestate.com/PPMpackages/> if you're running a Win32 perl,
can help. Just get the partial seconds from time(), subtract from 1, and
sleep() during that fraction of a second.

-- 
	Bart.


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

Date: Mon, 24 Sep 2001 12:42:43 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: a bit of help please.
Message-Id: <3BAF28FD.92C2AB23@acm.org>

Paul Boardman wrote:
> #!/usr/bin/perl -w
> use strict;
> 
> my $i = 0;
> while(1){
>         print $i++;
>         sleep(1);
> }

Although this will count at a rate of *about* one count per second,
it isn't counting in seconds. This would be better:

my $start = time;
$| = 1; # force flushing of output
while (1) {
    print "\r", time - $start;
    sleep(1);
}

-- Dave Tweed


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

Date: Mon, 24 Sep 2001 11:11:55 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: alternatives to ps command
Message-Id: <slrn9qu60v.2u3.tim@vegeta.ath.cx>

Me parece que perl misk <perlmisk@yahoo.co.uk> dijo:
> as i understand it, it is considered "bad practice" to use shell or
> system commands.

I found another reason it's a bad idea while looking into your problem.
See below.

> I am trying to get a process listing, but cannot find an alternative
> to `ps -fu`.  This isn't so much a problem until:

Here's a portion of the output of `ps -fu` in a bash session on my linux
box:

$ ps --version
procps version 2.0.6
$ ps -fume
UID        PID  PPID  C STIME TTY          TIME CMD
me         813   765  1 Sep23 ?        00:04:29 kwm
me         857     1  0 Sep23 ?        00:00:00 kaudioserver
me         858   813  0 Sep23 ?        00:00:00 kwmsound
me         859   813  0 Sep23 ?        00:00:05 kpanel
me         860   813  0 Sep23 ?        00:00:03 kfm
me         874   860  1 Sep23 ?        00:05:34 /usr/bin/xmms
me         879   874  0 Sep23 ?        00:00:03 /usr/bin/xmms
me         880   879  0 Sep23 ?        00:00:59 /usr/bin/xmms
me         881   875  0 Sep23 pts/0    00:00:00 -bash
me         897   879  0 Sep23 ?        00:02:36 /usr/bin/xmms
me        3011  3010  0 03:46 pts/1    00:00:00 slrn
me        3021  3011  0 03:58 pts/1    00:00:03 gvim -f +7 /home/tim/.followup
me        3866   879  0 04:17 ?        00:00:00 /usr/bin/xmms
me        3867   879  0 04:17 ?        00:00:00 /usr/bin/xmms
me        3873  3872  0 04:19 ttyq0    00:00:00 ps -fume
$

> This all works fine, for all processes created in the pas 24hrs, eg:
> andrewm  12585  1130  0 09:19 pts/5    00:00:00 telnet lion
> 
> but fails on older processes, eg:
> andrewm   4195  1098  0 Sep 21 pts/1    00:00:00 telnet lion

As you can see, I don't have the problem with ps that you do; my
pre-today start times use a date without a space separator.  In fact, if
I were to write a regex to parse this output, I may not even take into
account that another version inserts one.  In such a case, using my
regex with your version of ps would allocate (given the above
circumstances) a TIME value of '23' and a COMMAND value of
'0:00 -bash'; not very useful.

> apart from creating a hugely complicated regex that will catch all
> occurences, what else can I do?

OTOH, ps seems to always be proprietary in implementation (and,
unfortunately, interface). My ps manpage suggests proc(5), the proc
pseudo-filesystem.  This may be a more portable solution, if the target
OS supports it.  Some versions of ps also allow you to specify the
format of its output. You may want to look into this as well.

HTH
-- 
I have the simplest tastes.  I am always satisfied with the best.
    -- Oscar Wilde


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

Date: 24 Sep 2001 11:22:42 GMT
From: fxn@retemail.es (F. Xavier Noria)
Subject: Re: alternatives to ps command
Message-Id: <9on522$4adql26@news1s.iddeo2.es>

On 24 Sep 2001 03:01:03 -0700, perl misk <perlmisk@yahoo.co.uk> wrote:

: I am trying to get a process listing

You may use Proc::ProcessTable.

-- fxn


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

Date: Mon, 24 Sep 2001 13:16:58 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Copying Files on the Server
Message-Id: <3BAF243A.570DCFF7@oracle.com>

This is a multi-part message in MIME format.
--------------D6054C2340BCAE6125DC74F5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

RoJo wrote:

> I know my server is running Solaris.  How do I access the OS to copy a
> flat file?  I need to make the filename dynamic, i.e. named at
> runtime.
>
> Ron (rojo@mindspring.com)

link("$oldfilename","$newfilename");

Graham Wood


--------------D6054C2340BCAE6125DC74F5
Content-Type: text/x-vcard; charset=UTF-8;
 name="Graham.T.Wood.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Graham Wood
Content-Disposition: attachment;
 filename="Graham.T.Wood.vcf"

begin:vcard 
n:;Graham
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:Graham.T.Wood@oracle.com
fn:Graham Wood
end:vcard

--------------D6054C2340BCAE6125DC74F5--



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

Date: Mon, 24 Sep 2001 20:23:26 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: eval-statement fools garbage-collection ?
Message-Id: <slrn9qu2cu.8ai.mgjv@martien.heliotrope.home>

On Sun, 23 Sep 2001 20:32:43 +0200,
        peter pilsl <pilsl_@goldfisch.at> wrote:
> 
> I work with big anonymous structures and have the problem, that garbage 
> collection doesnt work. First I thought about circular references, but now 
> I found my problem:

> print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
> my $ptr={};
> $ptr->{big}=[];
> $#{$ptr->{big}}=5000000;
> def2($ptr);
> print &{$ptr->{test}->{func2}}(5),"\n";
> print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
> undef $ptr;
> print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
> 
> sub def2 {
>   my $ptr=shift;
>   my $cmd='$ptr->{test}->{func2}=sub{return $_[0]+4};';
> #  $ptr->{test}->{func2}=sub{return $_[0]+4};
>   eval $cmd;
> }
> 
> 
> when running this way I get (skipped last column, the 5th column is the 
> size):
> pilsl    24212  0.0  1.0  2816 1288 pts/9    S    20:17   0:00 
> 9
> pilsl    24212  0.0 16.4 22356 20900 pts/9   S    20:17   0:00 
> pilsl    24212  0.0 16.4 22356 20904 pts/9   S    20:17   0:00 
> So the memory is *not* freed at the undef-statement ..

You don't know that. When memory is freed, it is not necessary for the
process to hand it back to the OS immediately, or at all. All it means
is that it is available to the application for subsequent requests for
memory.

On many Unix systems it is possible for programs to return memory to the
OS while still running (this has not always been the case on most
Unices), but it can only do that under certain circumstances, and it
most of the time as very little control over whether or not the OS gets
the memory back.

The message is: you cannot take the memory your OS reports a process to
be using, and equate the fact that it doesn't diminish to a memory leak.
One other possibility is that Perl has released the memory (freed it),
and for some reason the OS hasn't reclaimed it.

> When commenting the eval-statement in the def2-sub and uncomment the other 
> assignment, I get the following (expected result):
> 
> pilsl    24245  0.0  1.0  2820 1292 pts/9    S    20:21   0:00 
> 9
> pilsl    24245  0.0 16.4 22356 20900 pts/9   S    20:21   0:00 
> pilsl    24245  0.0  1.0  2824 1372 pts/9    S    20:21   0:00 
> So the mem is released at the undef-statement ...
> 
> this is strange ...

All you can conclude with certainty is that in the latter case the OS
has been able to reclaim the memory. 

Anyway, after all this digression: your code works fine for me under
Perl 5.6.1 on Linux kernel 2.2.16 with glibc 2.1.3, both with and
without the eval:

$ cat /tmp/foo.pl
#!/usr/local/bin/perl -w
use strict;

my $ptr={};
$#{$ptr->{big}}=5000000;
def2($ptr);
print $ptr->{test}->{func2}(5),"\n";
print `ps -o vsize,rss,args -p $$ | tail -1`;
undef $ptr;
print `ps -o vsize,rss,args -p $$ | tail -1`;

sub def2 {
    my $ptr=shift;
    my $cmd='$ptr->{test}->{func2}=sub{return $_[0]+4};';
    $ptr->{test}->{func2}=sub{return $_[0]+4};
    #eval $cmd;
}

$ /tmp/foo.pl
9
22000 20864 perl -w /tmp/foo.pl
 2468 1340 perl -w /tmp/foo.pl

$ vi /tmp/foo.pl # comment out 15, uncomment 16

$ /tmp/foo.pl
9
22000 20864 perl -w /tmp/foo.pl
 2468 1340 perl -w /tmp/foo.pl

One part of the perl config that may be of importance, but also may not
be:

$ perl -V | grep malloc
    alignbytes=4, usemymalloc=n, prototype=define
                  ^^^^^^^^^^^^^

What is your version of Perl?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: Mon, 24 Sep 2001 14:12:05 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: eval-statement fools garbage-collection ?
Message-Id: <3baf2319@e-post.inode.at>


Martien Verbruggen wrote:
>> So the memory is *not* freed at the undef-statement ..
> 
> You don't know that. When memory is freed, it is not necessary for the
> process to hand it back to the OS immediately, or at all. All it means
> is that it is available to the application for subsequent requests for
> memory.
> 
> On many Unix systems it is possible for programs to return memory to the
> OS while still running (this has not always been the case on most
> Unices), but it can only do that under certain circumstances, and it
> most of the time as very little control over whether or not the OS gets
> the memory back.
> 

thnx,

Thats an interesting point. However this makes things even worse. My 
program runs in a mod_perl-environment and if your statement is true on my 
system, that means, that every mod_perl-script using such structures is 
memleaking, cause it never releases the memory back to the OS unless the 
task terminates. 
And this is why I discovered my problem: apache-webserver seemed to be 
memleaking when running my application on it.

I made subsequent tests and found out, that the memory is released to the 
OS when I "manally" delete the structure.   (see below, dest($ptr) instead 
of undef $ptr) So I think its a problem of perl (or better: a problem of my 
way to use perl)

I also extended my little script to loop around the allocate-part to see if 
the mem is reclaimed to the OS when it needs it. At least on my linux2.4.10 
(or 2.4.9) it does not, even if the thread gets bigger than 400M and 
swapping makes my harddisks shake.
The same on BSD3.4.

perl on both machines is 5.6.0, and

> 
> $ perl -V | grep malloc
>     alignbytes=4, usemymalloc=n, prototype=define
>                   ^^^^^^^^^^^^^

is the same here. Maybe I should have a look at perl 5.6.1.

here my extended script, including a loop-feature and a (very dumb) 
manually destruction-routine.

using dest instead of undef I get the expected results. The mem is released 
immediately when using the eval-statement.
using undef I get in big troubles with heavy swap ...

case1: loop 0..20, use dest and eval
<skip first 20 loops>
===============
 1928 1452
9
21460 21000
 1928 1452

case 2: loop 0..20,  use undef and eval
<skip first 19 loops>
===============
373976 173480
9
393512 193016
393512 193016
===============
393512 193016
9
413044 212548
413044 212548


the script:

#!/usr/bin/perl -w
use strict;

foreach (0..2) {   # extend to 20 later to get the full 400MB ;)
  allocate();
}

sub allocate
{
  print "===============\n";
  print `ps -o vsize,rss -p $$ | tail -1`;
  my $ptr={};
  $ptr->{big}=[];
  $#{$ptr->{big}}=5000000;
  def2($ptr);
  print &{$ptr->{test}->{func2}}(5),"\n";
  print `ps -o vsize,rss -p $$ | tail -1`;
#  undef $ptr;        # let perl do the job
  dest($ptr);      # let the script to the job
  print `ps -o vsize,rss -p $$ | tail -1`;
}

sub def2 {
  my $ptr=shift;
  my $cmd='$ptr->{test}->{func2}=sub{return $_[0]+4};';
#  $ptr->{test}->{func2}=sub{return $_[0]+4};
  eval $cmd;
}

sub dest {
  my $ptr=shift;
  my $ptype=ref($ptr);
  if ($ptype) {
    if ($ptype eq 'ARRAY') {
#  uncomment only if arrayelements can be references again
#      foreach (@{$ptr}) {
#        dest($_);
#      }
      @{$ptr}=();
    };
    if ($ptype eq 'HASH') {
      foreach (keys %{$ptr}){
        dest($ptr->{$_});
        delete($ptr->{$_});
      }
      %{$ptr}=();   
    }
  }
}
  




-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: 24 Sep 2001 12:12:58 +0100
From: nobull@mail.com
Subject: Re: faster execution
Message-Id: <u91ykwetad.fsf@wcl-l.bham.ac.uk>

train2venus@hotmail.com (venus) writes:

>    	 foreach $location_name (%LOCATION ) {
>         	$location_code = $LOCATION{$location_name};
>         
> 		if ($location_name eq $location ) {
> 		


This is like going up to a group of people and trying to find John by
asking each person in turn to tell you their name rather than simply
asking John to step forward.

 		if (my $location_code = $LOCATION{$location}) {

Also your use of printf is also pathological:

> 		printf FILE "$location_code\,"; 
>		printf FILE "%4s", "$min3\,";
>		printf FILE "%4s", "$max3\,";
> 		printf FILE "%1s", "$wx3\n";

Is location_code really a printf() template?

Why are you putting fixed punctuation in the data rather than the
template?

Why are you using 4 printf()s?

What't the point of specifying a minimum field width of one for the
last field when the data you are putting therein is certain to be
non-null anyhow?  ("$wx3\n" must at least contain "\n"!).

printf FILE "%s,%3s,%3s,%s\n", $location_code, $min3, $max3, $wx3;

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


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

Date: Mon, 24 Sep 2001 12:26:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: faster execution
Message-Id: <7e9uqtc13o5revpgq68ogchoslodlq14r0@4ax.com>

Rainer Klier wrote:

>$location_code = $LOCATION{$location};
>if(defined($location_code)) {
>  printf FILE "$location_code\,";
>  printf FILE "%4s", "$min3\,";
>  printf FILE "%4s", "$max3\,";
>  printf FILE "%1s", "$wx3\n";
>}

Don't use printf where you don't have to.

  print FILE "$location_code,";

And why not put it all in one statement?

	if(defined(my $code = $LOCATION{$location})) {
	    printf FILE "%s,%3s,%3s,%1s\n", $code, $min3, $max3, $wx3;
	}

-- 
	Bart.


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

Date: Mon, 24 Sep 2001 13:55:44 -0100
From: Rainer Klier <Rainer.Klier@erl.sbs.de>
Subject: Re: faster execution
Message-Id: <3BAF4970.17BFAE13@erl.sbs.de>

Bart Lateur wrote:
> 
> Rainer Klier wrote:
> 
> >$location_code = $LOCATION{$location};
> >if(defined($location_code)) {
> >  printf FILE "$location_code\,";
> >  printf FILE "%4s", "$min3\,";
> >  printf FILE "%4s", "$max3\,";
> >  printf FILE "%1s", "$wx3\n";
> >}
> 
> Don't use printf where you don't have to.
> 
>   print FILE "$location_code,";

Just copied the inner loop of the original author.
Did not think longer about this.

> And why not put it all in one statement?

>         if(defined(my $code = $LOCATION{$location})) {
>             printf FILE "%s,%3s,%3s,%1s\n", $code, $min3, $max3, $wx3;
>         }

Agreed for the printfs. For my point of view 
on readability, $a = $b; if(defined($a)) { ..
is ok too.

Regards, Rainer


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

Date: Mon, 24 Sep 2001 11:20:40 +0100
From: "Daz" <dc_hallett@hotmail.no.spam.com>
Subject: File compression
Message-Id: <9on1jt$e7$1@pheidippides.axion.bt.co.uk>

Hi,

I'm new to perl and want to write a prog that reads file headers and
compresses files older than a certain date.

Anyone have any handy code that could help?

Regards,
D.

--
Mining the Mines of Saturn since 1980,
but Knot in 3D...





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

Date: Mon, 24 Sep 2001 14:26:28 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: File compression
Message-Id: <hg9uqtgtbcna0t0qhaiuhktltqv89gkkfn@4ax.com>

On Mon, 24 Sep 2001, "Daz" <dc_hallett@hotmail.no.spam.com> wrote:
>I'm new to perl and want to write a prog that reads file headers and
>compresses files older than a certain date.

"find . -type f -mtime +14 -exec gzip -9f {} \;"

should do the trick on most Unixish OS'es. If you want to do it by
yourself, look at the File::Find and stat manpages.

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: Mon, 24 Sep 2001 13:28:58 +0100
From: "Daz" <dc_hallett@hotmail.no.spam.com>
Subject: Re: File compression
Message-Id: <9on94j$5gl$1@pheidippides.axion.bt.co.uk>

Thanks for the help,

I'm trying to do this from a cron though and there are multiple sets of
files.

I need to put this in a script of some kind (possibly shell script, though
ideally perl).

Regards,
Daz

--
Mining the Mines of Saturn since 1980,
but Knot in 3D...

Thomas Bätzler <Thomas@Baetzler.de> wrote in message
news:hg9uqtgtbcna0t0qhaiuhktltqv89gkkfn@4ax.com...
> On Mon, 24 Sep 2001, "Daz" <dc_hallett@hotmail.no.spam.com> wrote:
> >I'm new to perl and want to write a prog that reads file headers and
> >compresses files older than a certain date.
>
> "find . -type f -mtime +14 -exec gzip -9f {} \;"
>
> should do the trick on most Unixish OS'es. If you want to do it by
> yourself, look at the File::Find and stat manpages.
>
> HTH,
> --
> use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
> split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
> '"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
> $_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl




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

Date: Thu, 20 Sep 2001 19:32:31 GMT
From: u518615722@spawnkill.ip-mobilphone.net  (Mike F)
Subject: Help: How to set transactions use rollback segment
Message-Id: <l.1001014352.1597717285@[64.94.198.252]>

Hi, I have a perl scripts which I want to use only one rollback segment
the script is like the follow:
_----------------------------------------------------------------
my $dbh = DBI->connect ( 'dbi:Oracle:test',
                        'test',
                        'test',
                           {
                                PrintError => 1,
                                RaiseError => 1,
                                AutoCommit => 1
                        }
                        ) || die "Database Connection not made $DBI::errstr" ;

#increate day in a month
my $count1 = 1;
while ($count1 < 32)
{
         my $T1="to_date('2001/1/$count1 00:00:00','yyyy/mm/dd 
hh24:mi:ss')";
         my $T2="to_date('2001/1/$count1 23:59:59','yyyy/mm/dd 
hh24:mi:ss')";
         $count1 = $count1 + 1;

   # set rollback segment
      my $sql = qq{ set transaction use rollback segment RBS0 };
                $dbh->do ( $sql );
  
      #move data from test to archtest
                my $sql = qq{
   INSERT INTO table1 select * from table2
        where polltime > $T1 and polltime < $T2};
        $dbh->do ( $sql );
        }
$dbh->disconnect();
----------------------------------------------------------------
But the first sql does not seem to work, the transaction did not use
rollback segment I specified.

Could somebody help me out?

Thanks for your help





 



-- 
Sent  by dbadba62  from  hotmail  subdomain  of  com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new


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

Date: 24 Sep 2001 12:10:00 +0100
From: nobull@mail.com
Subject: Re: How to remove whitespace without losing the 'real' whitespace?
Message-Id: <u93d5cetfb.fsf@wcl-l.bham.ac.uk>

rdok@netscape.net (RiCaRdO) writes:

> I'm looking for a way to filter out whitespaces from an input file
> without losing the actual information

s/^\s+//; # Remove leading spaces.
s/\s+$/; # Remove trailing spaces.
s/\s+/ /g; # Replace multiple spaces with a single space.

> I came up with this:

[snip C program written in Perl ]

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


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

Date: 24 Sep 2001 08:49:29 -0400
From: Tim Heaney <theaney@toadmail.toad.net>
Subject: Re: How to remove whitespace without losing the 'real' whitespace?
Message-Id: <87k7yooism.fsf@susie.watterson>

nobull@mail.com writes:

> rdok@netscape.net (RiCaRdO) writes:
> 
> > I'm looking for a way to filter out whitespaces from an input file
> > without losing the actual information
> 
> s/^\s+//; # Remove leading spaces.
> s/\s+$/; # Remove trailing spaces.
> s/\s+/ /g; # Replace multiple spaces with a single space.

Except he probably doesn't want to lose the newline. Perhaps you mean

  s/\s+/ /g; # Replace multiple spaces with a single space.
  s/^ //;    # Remove initial space.
  s/ $/\n/;  # Replace final space with newline.

Tim


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

Date: Mon, 24 Sep 2001 22:59:16 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: mail script (WIN)
Message-Id: <G7Gr7.13$DT2.609332@news.interact.net.au>


"bill" <bill02115@hotmail.com> wrote in message
news:9olnr1$r9j$1@panix3.panix.com...
>
> I'm a Unix guy, but I now need to perform a Windows98 trick, and I'm
> lost.  I need to write a Perl script that sends e-mails with a pdf
> attachment (it's a huge list of recipients, and they all need to have
> a customized e-mail, via a template).  Maybe there are better ways to
> do this without using Perl, but I want to find out how to do it with
> Perl.
>
> There are two issues here:
>
>   1. How does one send e-mails from within a Perl script in Windows98?
>      (In Unix, I just open a pipe to sendmail.)
>
>   2. How does one attach a pdf file to the sent mail?  (I've never done
>      this, even in Unix.)

Use MIME::Lite and Net::SMTP

eg:

   my $msg = MIME::Lite->new(
                 From     =>'me@myhost.com',
                 To       =>'you@yourhost.com',
                 Cc       =>'some@other.com, some@more.com',
                 Subject  =>'Helloooooo, nurse!',
                 Type     =>'image/gif',
                 Encoding =>'base64',
                 Path     =>'hellonurse.gif'
   );

MIME::Lite->send('smtp', "smtp.myisp.net", Timeout=>60);
$msg->send;





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

Date: Mon, 24 Sep 2001 12:46:45 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <tquaplk5e54gce@corp.supernews.com>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 17 Sep 2001 13:50:16 GMT and ending at
24 Sep 2001 13:28:58 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  138 (42.9% of all posters)
Articles: 225 (22.9% of all articles)
Volume generated: 390.4 kb (18.1% of total volume)
    - headers:    175.0 kb (3,630 lines)
    - bodies:     211.0 kb (7,351 lines)
    - original:   143.8 kb (5,422 lines)
    - signatures: 4.2 kb (146 lines)

Original Content Rating: 0.682

Averages
========

Posts per poster: 1.6
    median: 1.0 post
    mode:   1 post - 89 posters
    s:      1.2 posts
Message size: 1776.8 bytes
    - header:     796.5 bytes (16.1 lines)
    - body:       960.3 bytes (32.7 lines)
    - original:   654.7 bytes (24.1 lines)
    - signature:  18.9 bytes (0.6 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

    7    13.9 (  5.0/  8.4/  3.9)  laura_fairhead@my-deja.com
    6     8.5 (  5.3/  3.2/  1.6)  "Kwakeb.net - Administrator" <webmaster@kwakeb.net>
    6    12.4 (  5.7/  6.7/  2.6)  "GuaRDiaN" <guardian@chello.be>
    5    10.3 (  3.7/  6.6/  5.6)  Rory <rory@campbell-lange.net>
    4     5.4 (  3.1/  2.3/  1.3)  "Christopher M. Jones" <christopher_j@keepurspamtoyerself.qwest.net>
    4     7.3 (  2.9/  3.9/  3.2)  Bianka.Martinovic@Materna.de
    4     7.3 (  3.4/  3.9/  2.5)  peter <peter_icaza@REMOVE2REPLYuhc.com>
    4     9.3 (  3.5/  4.7/  3.8)  Ilmari Karonen <usenet11585@itz.pp.sci.fi>
    4     7.9 (  3.7/  4.3/  1.1)  jeffplus@mediaone.net
    4     7.0 (  3.0/  4.0/  1.0)  ychandra@cisco.com

These posters accounted for 4.9% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  13.9 (  5.0/  8.4/  3.9)      7  laura_fairhead@my-deja.com
  12.4 (  5.7/  6.7/  2.6)      6  "GuaRDiaN" <guardian@chello.be>
  11.5 (  1.9/  9.5/  2.5)      2  Peter Korman <peter_korman@lotus.com>
  10.3 (  3.7/  6.6/  5.6)      5  Rory <rory@campbell-lange.net>
   9.3 (  3.5/  4.7/  3.8)      4  Ilmari Karonen <usenet11585@itz.pp.sci.fi>
   8.5 (  5.3/  3.2/  1.6)      6  "Kwakeb.net - Administrator" <webmaster@kwakeb.net>
   7.9 (  3.7/  4.3/  1.1)      4  jeffplus@mediaone.net
   7.3 (  3.4/  3.9/  2.5)      4  peter <peter_icaza@REMOVE2REPLYuhc.com>
   7.3 (  2.9/  3.9/  3.2)      4  Bianka.Martinovic@Materna.de
   7.3 (  2.6/  4.7/  3.7)      3  Michael Slass <mikesl@wrq.com>

These posters accounted for 4.4% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.909  (  2.8 /  3.1)      3  hugh1 <weiwe1@yeah.net>
0.847  (  5.6 /  6.6)      5  Rory <rory@campbell-lange.net>
0.830  (  3.2 /  3.9)      4  Bianka.Martinovic@Materna.de
0.823  (  2.4 /  2.9)      3  "Scott Wessels" <swessels@usgn.net>
0.819  (  1.8 /  2.2)      3  "Raj" <oneconcept@yahoo.co.uk>
0.812  (  3.8 /  4.7)      4  Ilmari Karonen <usenet11585@itz.pp.sci.fi>
0.795  (  3.7 /  4.7)      3  Michael Slass <mikesl@wrq.com>
0.661  (  1.2 /  1.8)      3  Del <delanthear@yahoo.com>
0.654  (  2.5 /  3.9)      4  peter <peter_icaza@REMOVE2REPLYuhc.com>
0.583  (  1.8 /  3.2)      3  mark@artwarren.co.ukNOSPAM

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.566  (  1.3 /  2.2)      3  Ilmari Karonen <usenet11586@itz.pp.sci.fi>
0.564  (  1.3 /  2.3)      4  "Christopher M. Jones" <christopher_j@keepurspamtoyerself.qwest.net>
0.524  (  2.0 /  3.8)      3  quasiperfect@yahoo.com
0.509  (  1.6 /  3.2)      6  "Kwakeb.net - Administrator" <webmaster@kwakeb.net>
0.470  (  1.5 /  3.2)      3  "Younes ALAOUI" <yalaoui@lexbase.fr>
0.460  (  3.9 /  8.4)      7  laura_fairhead@my-deja.com
0.384  (  2.6 /  6.7)      6  "GuaRDiaN" <guardian@chello.be>
0.330  (  0.7 /  2.0)      3  Philip Wasson <pwasson@mindspring.com>
0.256  (  1.0 /  4.0)      4  ychandra@cisco.com
0.250  (  1.1 /  4.3)      4  jeffplus@mediaone.net

20 posters (14%) had at least three posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      25  alt.perl
      13  comp.lang.perl
       6  comp.lang.perl.modules
       3  comp.mail.mutt
       2  comp.lang.perl.moderated
       2  alt.perl.sockets
       2  comp.unix.questions
       2  comp.unix.programmer
       1  comp.infosystems.search
       1  alt.comp.perlcgi.freelance

Top 10 Crossposters
===================

Articles  Address
--------  -------

       4  John Hoarty <jhoarty@quickestore.com>
       3  Kelly and Sandy <junk@almide.demon.co.uk>
       2  "Steve Grazzini" <s_grazzini@hotmail.com>
       2  Bikesh Patel <bikesh@my-deja.com>
       2  peter <peter_icaza@REMOVE2REPLYuhc.com>
       2  "Rogier" <rogier@arpadrive-in.com>
       1  LinuxBear@nowhere.com
       1  Gary Johnson <garyjohn@spk.agilent.com>
       1  "David Thompson" <david.thompson1@worldnet.att.net>
       1  "Frank" <frank.wuerffel@bln.siemens.de>


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

Date: Mon, 24 Sep 2001 12:33:34 +0100
From: "Raj" <oneconcept@yahoo.co.uk>
Subject: Please Help with Sockets!
Message-Id: <1001331128.19255.0.nnrp-12.c2d95a2c@news.demon.co.uk>

Hi,

I've posted to this group before but I didn't get any replies!  Can anyone
please help me?

Here's the code I am having trouble with:

$reply = <S>;
        if ($reply =~ /^200\s+(.*)/) { # 200 Data follows = OK
                while (<S>) {
                        #print "<P>".$_;
                        ($key, $value) =~ /^BILL:(.*?)=(.*)/;
                        $address{$key} = $value;
                }
                close(S);
                return 1;
        } elseif {
                return undef;

Where S is the socket connection.  This socket connects fine, and the
commented out print line outputs the values I am trying to plug into the
assoc array.

Regards,
Raj




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

Date: Mon, 24 Sep 2001 13:26:30 +0200
From: "Heiko Rau" <heiko.rau@spamshield.t-systems.de>
Subject: Q: How to "reserve" processes
Message-Id: <9on52d$apr$1@news.sns-felb.debis.de>

Hi all,

with UNIX, each user has a limited amount of processes. Although this number
is fairly high (something around 250 on the platform used) a user managed to
start so many processes, that my perl programm (while starting normally) was
not able to execute properly: it crashed with an error message indicating
the lack of available processes.

I read perlipc and the according chapters in "Programming Perl" but I found
no solution. At program startup I am able to start an almost arbitrary
number of processes in the background. But whenever I try to kill such a
process and start one by my own again, the kernel does not give my program
priority but gives it to e.g. a shell, where I executed "ls" on the command
prompt.

It seems to me that the solution would be to start a number of background
processes and tell one of them at a given point of time to not longer
execute thier own code, but pass a CODEREF or a string for a "system()"-call
to execute.

Any comments/suggestions are highly appreciated.

Heiko




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

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


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