[23611] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5818 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 17 18:10:44 2003

Date: Mon, 17 Nov 2003 15:10:12 -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           Mon, 17 Nov 2003     Volume: 10 Number: 5818

Today's topics:
    Re: regex to convert 1000000 -> 1,000,000 ? <wsanford@wallysanford.com>
    Re: regex to convert 1000000 -> 1,000,000 ? <syscjm@gwu.edu>
    Re: regex to convert 1000000 -> 1,000,000 ? <wsanford@wallysanford.com>
    Re: regex to convert 1000000 -> 1,000,000 ? <wsanford@wallysanford.com>
    Re: regex to convert 1000000 -> 1,000,000 ? <noreply@gunnar.cc>
    Re: regex to convert 1000000 -> 1,000,000 ? <syscjm@gwu.edu>
    Re: regexp on HTML <ubl@schaffhausen.de>
    Re: regexp on HTML (Tad McClellan)
    Re: regexp on HTML (Bill)
    Re: regexp on HTML (James E Keenan)
        running a sub inside regex (Thomas Isenbarger)
    Re: running a sub inside regex (Hae Jin)
    Re: Signal handling in objects <pinyaj@rpi.edu>
    Re: Signal handling in objects <spaceman-13187-20031106@ausgehaucht.sensenmann.at>
        What to use when rename fails? <stanb@panix.com>
    Re: What to use when rename fails? <trammell+usenet@hypersloth.invalid>
        where is DBI::DWIM? <ewilhelm@somethinglike.sbcglobalDOTnet>
        Win32::OLE adding shape to OLE Object (xlsheet) in PPT <lance-news@augustmailcom>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 17 Nov 2003 10:53:00 -0800
From: "Wally Sanford" <wsanford@wallysanford.com>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <bpb5eg$1kqno4$1@ID-196529.news.uni-berlin.de>

Sam Holden wrote:
>
> And one starts by reading the documentation for the language,
> compiler, software package, whatever it is you are new to. For perl
> the FAQ
> is a big chunk of that documentation and pretty hard to miss, unless
> of course you didn't bother looking at any of the documentation.

Actually, the whole situation is like this: Perl is like a software
package from a store that has a nice manual that under a hidden panel.
you don't know it's there unless you KNOW it's there.

Someone who is starting will likely not even of heard of "perldoc".

If they are unixsavy they might try something like: $ perl --help | grep
doc
Which doesn not return anything. `$ perl --help` by it self does nothing
to guide you to the docs.

Even grepping the man page for perl doesn't ofer much:

   $ man perl | grep doc
              perltoc             Perl documentation table of contents
              perlpod             Perl plain old documentation
          Extensive additional documentation for Perl modules is
          this additional documentation in the
          additional documentation is distributed standard with
          Perl, but you'll also find documentation for third-party
          You should be able to view Perl's documentation with your

So a newbie might be inclined to try

   $ perltoc
   bash: perltoc: command not found

And `$ man perl | grep perldoc` return nothing, but the point is they
have to first KNOW of perldoc.

   $ man perl | grep help
          you're not sure where you should look for help, try the -w
          Larry Wall <larry@wall.org>, with the help of oodles of
          help to others who wish to advocate the use of Perl in
          help mail in a bug report.

This could bery well lead

   $ help perl
   bash: help: no help topics match `perl'.  Try `help help'.

Many newsbies could of installed some linux distro that came with Perl
and they decide on exploring it. Looking for documentation seems to be
more then a trivial task.

So, just short of going to www.perl.org, how is one suppost to know of
perldoc and it's faq's off the bat?

It's not a question of a newsgroup being like a coutry or whatever, but
the lack of self advertising of perldoc it self. The fact thast there is
no mention of it in the man page doing simple greps is unacceptable.

Expecting someone to of read documentation thats buried in a way that
you didnt even know it was there in the "box" is what is unacceptable.

Now that I think about it, I never even heard of perldoc until I first
read this group a good some time ago.




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

Date: Mon, 17 Nov 2003 14:45:04 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <3FB92540.3090209@gwu.edu>

Wally Sanford wrote:
> Sam Holden wrote:
> 
>>And one starts by reading the documentation for the language,
>>compiler, software package, whatever it is you are new to. For perl
>>the FAQ
>>is a big chunk of that documentation and pretty hard to miss, unless
>>of course you didn't bother looking at any of the documentation.
> 
<much about the hidden perl docs>
> 
> So, just short of going to www.perl.org, how is one suppost to know of
> perldoc and it's faq's off the bat?

Well, if you come to this group, the posting guidelines, posted twice
every week, if you *read* the group before *post* to it, like you should
(remember why the good Lord gave two ears and only one mouth!)

Your points about the difficulty of finding perldoc are well taken.
But it doesn't excuse clueless posts, because people who have found
this newsgroup have found the key to finding perldoc if they will
*read*.

               Chris Mattern



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

Date: Mon, 17 Nov 2003 12:41:16 -0800
From: "Wally Sanford" <wsanford@wallysanford.com>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <bpbbph$1l7rn1$1@ID-196529.news.uni-berlin.de>

Chris Mattern wrote:
> Wally Sanford wrote:
>> Sam Holden wrote:
>>
>>> And one starts by reading the documentation for the language,
>>> compiler, software package, whatever it is you are new to. For perl
>>> the FAQ
>>> is a big chunk of that documentation and pretty hard to miss, unless
>>> of course you didn't bother looking at any of the documentation.
>>
> <much about the hidden perl docs>
>>
>> So, just short of going to www.perl.org, how is one suppost to know
>> of perldoc and it's faq's off the bat?
>
> Well, if you come to this group, the posting guidelines, posted twice
> every week, if you *read* the group before *post* to it, like you
> should (remember why the good Lord gave two ears and only one mouth!)

Twice a week? I have seen them posted at all the last few months. I have
been through 3 different isp's so that is not limited to just my news
service. Wehre is this being posted from? Under what name?

> Your points about the difficulty of finding perldoc are well taken.
> But it doesn't excuse clueless posts, because people who have found
> this newsgroup have found the key to finding perldoc if they will
> *read*.

Well if other people cannot see the faq being posted as you say, jsut
like it does nto show on my server, then that too is a broken bridge
that cannot be crossed, and would also exaplin why some newbies seem to
give blank stairs when asked why they didnt read it.




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

Date: Mon, 17 Nov 2003 12:42:57 -0800
From: "Wally Sanford" <wsanford@wallysanford.com>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <bpbbsl$1m2vbk$1@ID-196529.news.uni-berlin.de>

Wally Sanford wrote:
> Chris Mattern wrote:
>> Wally Sanford wrote:
>>> Sam Holden wrote:
>>>
>>>> And one starts by reading the documentation for the language,
>>>> compiler, software package, whatever it is you are new to. For perl
>>>> the FAQ
>>>> is a big chunk of that documentation and pretty hard to miss,
>>>> unless of course you didn't bother looking at any of the
>>>> documentation.
>>>
>> <much about the hidden perl docs>
>>>
>>> So, just short of going to www.perl.org, how is one suppost to know
>>> of perldoc and it's faq's off the bat?
>>
>> Well, if you come to this group, the posting guidelines, posted twice
>> every week, if you *read* the group before *post* to it, like you
>> should (remember why the good Lord gave two ears and only one mouth!)
>
> Twice a week? I have seen them posted at all the last few months. I
> have been through 3 different isp's so that is not limited to just my
> news service. Wehre is this being posted from? Under what name?

That should be "I -haven't- seen them ..." Sorry.




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

Date: Mon, 17 Nov 2003 21:46:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <bpbc8r$1mjmlu$1@ID-184292.news.uni-berlin.de>

Wally Sanford wrote:
> Chris Mattern wrote:
>> Well, if you come to this group, the posting guidelines, posted
>> twice every week, if you *read* the group before *post* to it,
>> like you should (remember why the good Lord gave two ears and
>> only one mouth!)
> 
> Twice a week? I have seen them posted at all the last few months. I
> have been through 3 different isp's so that is not limited to just
> my news service. Wehre is this being posted from? Under what name?

This reminds me of a suggestion I have posted a couple of times. I
think it would be a good idea if this link appeared at the bottom of
each message:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

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



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

Date: Mon, 17 Nov 2003 16:28:57 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <3FB93D99.9070302@gwu.edu>

Wally Sanford wrote:
> Chris Mattern wrote:
> 
>>Wally Sanford wrote:
>>
>>>Sam Holden wrote:
>>>
>>>
>>>>And one starts by reading the documentation for the language,
>>>>compiler, software package, whatever it is you are new to. For perl
>>>>the FAQ
>>>>is a big chunk of that documentation and pretty hard to miss, unless
>>>>of course you didn't bother looking at any of the documentation.
>>>
>><much about the hidden perl docs>
>>
>>>So, just short of going to www.perl.org, how is one suppost to know
>>>of perldoc and it's faq's off the bat?
>>
>>Well, if you come to this group, the posting guidelines, posted twice
>>every week, if you *read* the group before *post* to it, like you
>>should (remember why the good Lord gave two ears and only one mouth!)
> 
> 
> Twice a week? I have seen them posted at all the last few months. I have
> been through 3 different isp's so that is not limited to just my news
> service. Wehre is this being posted from? Under what name?

Tad McClellan posts it, regular as clockwork.  Which may explain why he
sometimes gets a mite testy when it seems nobody reads it.

Here's the tally for the previous month:
http://groups.google.com/groups?q=g:thl2841035936d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=I7KdneDkfuJQDSmiRVn-gw%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=bq2dnRM9tozeAS2iRVn-vg%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=rLWdnWTq0fmkyzaiRVn-hg%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=Q8mdncYtlYEt_DqiRVn-vg%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=CeSdnf_I7LJohj-iRVn-tw%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=_t6dnV0S5enwugOiRVn-sg%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=BvydnQNsvqvPTgWiRVn-vw%40august.net
http://groups.google.com/groups?q=g:thl2343458277d&dq=&hl=en&lr=&ie=UTF-8&safe=off&selm=bX2dnWHam6pUQwmiU-KYjA%40august.net

Eight times in the past month.  I've accessed the newsgroup from several
different ISPs and Google, and they've always been there.  Not sure how
you missed it.

> 
> 
>>Your points about the difficulty of finding perldoc are well taken.
>>But it doesn't excuse clueless posts, because people who have found
>>this newsgroup have found the key to finding perldoc if they will
>>*read*.
> 
> 
> Well if other people cannot see the faq being posted as you say, jsut
> like it does nto show on my server, then that too is a broken bridge
> that cannot be crossed, and would also exaplin why some newbies seem to
> give blank stairs when asked why they didnt read it.
> 
If it doesn't show on your server, it can only be because your server
is broken, which is scarcely the fault of the Perl documentation or
its maintainers.


           Chris Mattern




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

Date: Mon, 17 Nov 2003 17:21:48 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: regexp on HTML
Message-Id: <bpavld$pui$1@news.dtag.de>

Bart van den Burg wrote:

> Hi
> 
> I need to empty the very last cell that can be found in $r

Use an HTML parser to parse HTML.

malte



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

Date: Mon, 17 Nov 2003 10:24:47 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regexp on HTML
Message-Id: <slrnbrhtif.d4a.tadmc@magna.augustmail.com>

Bart van den Burg <bart-news@NOSPAMtvreclames.nl> wrote:

> Subject: regexp on HTML

> Any ideas on how to do this?


Yes, don't use a regex.

You should use a module that understands HTML data when you want
to process HTML data.

   use HTML::TableExtract;

Would seem a good one for what you are trying to do.


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


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

Date: 17 Nov 2003 11:53:02 -0800
From: wherrera@lynxview.com (Bill)
Subject: Re: regexp on HTML
Message-Id: <239ce42f.0311171153.1007d66@posting.google.com>

"Bart van den Burg" <bart-news@NOSPAMtvreclames.nl> wrote in message news:<bpar5a$df6$1@reader10.wxs.nl>...
> Hi
> 
> I need to empty the very last cell that can be found in $r
> 
> Currently, I have
>     $r =~ s:<td>.*</td></tr>$:<td></td></tr>:;
> 
> But that merges all cells into one empty cell...
> Any ideas on how to do this?
> 
> Thanks
> Bart
> 
> HTML source table =
> 
> <table>
> <tr class='row1'><td>Name</td><td>Referer</td></tr>
> <tr class='row2'><td>Description</td><td>Hoe ben je op deze site terecht
> gekomen?</td></tr>

What is needed here IMO is a variable sized negative look-behind
assertion, which AFAIK is not available in Perl?

What I find useful in taking a variable sized chunk of code from the
end of a string is to do a reverse and split:

my $r = '<tr><td> 1 </td><td> 2 </td><td> 3 </td></tr>';
$rr = reverse $r;
(undef, $rr) = split (/\>dt\</, $rr, 2);
$rr = reverse $rr;
$r = $rr . '</tr>';
print $r;

Of course, this presupposes that </tr> is at the end of the line.
Maybe just parsing the whole table with HTML::Parse would be your best
bet.


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

Date: 17 Nov 2003 12:56:45 -0800
From: jkeen@concentric.net (James E Keenan)
Subject: Re: regexp on HTML
Message-Id: <b955da04.0311171256.248eedb5@posting.google.com>

"Bart van den Burg" <bart-news@NOSPAMtvreclames.nl> wrote in message news:<bpar5a$df6$1@reader10.wxs.nl>...
> Hi
> 
> I need to empty the very last cell that can be found in $r
> 
> Currently, I have
>     $r =~ s:<td>.*</td></tr>$:<td></td></tr>:;
> 
> But that merges all cells into one empty cell...
> Any ideas on how to do this?
> 

What follows is a non-robust, first pass at a solution using one of
your source code lines as an example.  Take it as a jumping-off point.
 Parsing HTML is generally better done using a module such as
HTML::Parser.

    use strict;
    use warnings;
    my ($r, $s);

    $r = q|<tr><td>1.</td><td>Zoekmachine</td><td>17</td><td><img
src='images/delete.gif'/></td><td></td><td><a
href="admin.pl?sessionID=9ZooUn8AAAEAACNWBk0AAAAA&amp;amp;action=poll&amp;action2=edit&amp;action3=moveup&amp;id=3&amp;option="><img
src='images/arrowdown.gif'/></a></td></tr>|;
    print '$r  :', "\n";
    print "$r\n";

    $s = $r;
    if ($s =~ s|(.*<td>).*(</td></tr>)$|$1$2|s) {
      print '$s  :', "\n";
      print "$s\n";
    }

HTH.
jimk


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

Date: Mon, 17 Nov 2003 16:31:50 -0500
From: isen@molbio.mgh.harvard.edu (Thomas Isenbarger)
Subject: running a sub inside regex
Message-Id: <isen-1711031631500001@ruvkung4pb3.mgh.harvard.edu>

I have never posted to this group before, so please forgive me if I am
posting in the wrong place

in the perl script below, I am trying to construct a string, within a
regex, based on an earlier captured match. 

i think something about the last elsif block doesn't work.  the regex
within the while loop near the bottom (before the subroutine) returns no
matches to sequences that should work.

for molecular biologists out there, I am trying to find the reverse
complement on the fly inside the regex.  the @pairing array is something
like @pairing = (AU, CG, GC, UA) and defines the substitutions to be made
in order to build a reverse complement.

for non molecular biologists out there, a sequence that should match is
'acgu' if you need a test case.

input for the program:

use "acgu" for the target sequence.

then, for the sequence elements enter "1s=ac", RETURN, "1r", RETURN, RETURN.

please contact me at isen (AT) mgh (DOT) molbio (DOT) harvard (DOT) edu

if you are willing to help and/or need more information.

thank-you,
Tom Isenbarger


#!/usr/bin/perl -w
use re 'eval';                                                 #allows
execution of code within regex expressions (??{})

@pairing = (AU, GC, CG, UA, NN);

print "enter target sequence ";
$target = uc<STDIN>;
chomp($target);

if ($target =~ /[^ACGTU]/) {
   die "invalid characters found in target sequence.  exiting isenfind\n\n";
}

#ask to keep IUB codes or convert them?
#ask to leave N or not?

print "enter sequence elements, one line at a time (return to stop)\n";

$input = "";
$i = 0;

do {
   $input = uc<STDIN>;
   chomp ($input);
   $input =~ s/\s+//g;
   $element[$i] = $input;
   $i++;
} until ($input eq "");

for ($i = 0; $i < @element; $i++) {
   $item = $element[$i];
   print "$item\n";
   if ($item =~ /^{/) {                                      #a base
pairing rule
      $pairingstring = $item;
      $pairingstring  =~ s/[{}]//g;
      @pairing = split /,/, $pairingstring;
      #check for valid pair rule syntax
      print "pairing now @pairing\n";
   }
   
   elsif ($item =~ /^(\d+)S=([ACGUBDHKMNRSVWY]+)/) {         #a specific
sequence element to remember
      $pattern = "(".$2.")";
      $regex .= $pattern;
      $regexpos[$1] = ($i+1);                               #record the
position of this sequence in the element list
   }
   
   elsif ($item =~ /^(\d+)S=(\d+)-(\d+)/) {                  #a
non-specific sequence element to remember
      $pattern = "([ACGU]{$2,$3})";
      $regex .= $pattern;
      $regexpos[$1] = ($i+1);
   }
   
   elsif ($item =~/^(\d+)S/) {
      $lookwhere = $regexpos[$1];
      $pattern = "(\\".$lookwhere.")";
      $regex .= $pattern;
   }
   
   elsif ($item =~ /^[ACGUBDHKMNRSVWY]+/) {                  #a specific
sequence element
      $pattern = "(".$item.")";
      $regex .= $pattern;
   }
   
   elsif ($item =~ /^(\d+)-(\d+)/) {                         #a
non-specific sequence element
      $pattern = "([ACGU]{$1,$2})";
      $regex .= $pattern;
   }
   
   elsif ($item =~ /^(\d+)P/) {                              #a palindrome
of an earlier saved element
      $lookwhere = $regexpos[$1];
      $pattern = "(??{reverse \$".$lookwhere."})";
      $regex .= $pattern;
   }
   
   elsif ($item =~ /^(\d+)R/) {                              #a reverse
complement of an earlier saved element
      $lookwhere = $regexpos[$1];
      $pattern = "(??{revcomp (\$".$lookwhere.', @pairing)})';  #use '
quotes so that @pairing is not interpolated
      $regex .= $pattern;
   }
   
}

use re 'debug';

print "regex  $regex\n";
print "target $target\n";

while ($target =~ /$regex/g) {
   $position = pos $target;
   print "$&    $position\n";
}

### subroutines

sub revcomp {
   my $sequence = shift (@_);
   my @pairing = @_;
   my $rc = undef;
   
   foreach $pair (@pairing) {
      ($first, $second) = split //, $pair;
      $match{$first} .= $second;
   }
   foreach $key (keys(%match)) {
      if (length($match{$key}) > 1) {
         $match{$key} = "[".$match{$key}."]";
      }
   }
   
   @string = split (//, reverse ($sequence));              #process string
one char at a time using substitutions in %match
   
   foreach $base (@string) {
      $rc .= $match{$base};
   }
   
   print "in sub rc = $rc\n\n";
   
   return $rc;                                             #return reverse
complement of sequence
}


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

Date: Mon, 17 Nov 2003 14:38:22 -0800
From: "Austin P. So (Hae Jin)" <haejin@ubc.ca>
Subject: Re: running a sub inside regex
Message-Id: <bpbila$3s6$1@nntp.itservices.ubc.ca>



Thomas Isenbarger wrote:

> in the perl script below, I am trying to construct a string, within a
> regex, based on an earlier captured match. 

> i think something about the last elsif block doesn't work.  the regex
> within the while loop near the bottom (before the subroutine) returns no
> matches to sequences that should work.
> 
> for molecular biologists out there, I am trying to find the reverse
> complement on the fly inside the regex.  the @pairing array is something
> like @pairing = (AU, CG, GC, UA) and defines the substitutions to be made
> in order to build a reverse complement.

It is quite possible to do it on the fly...something like

if ($string =~ m/($substring|revcomp($substring))/ig) {
	$match_position = pos + 1;
	$match = $1;
	...
}

sub revcomp {
#make reverse complement
return
}

Everyone has their own style of perl, but I'm having a hard time 
deciphering what you are hoping to do...so as I'm not all that sure what 
you wish to do, this particular solution may not be what you want...

Austin



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

Date: Mon, 17 Nov 2003 11:27:55 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: Signal handling in objects
Message-Id: <Pine.SGI.3.96.1031117112012.188527A-100000@vcmr-64.server.rpi.edu>

On Mon, 17 Nov 2003, Stefan Weiss wrote:

>Can somebody please explain what happens with that anonymous sub that
>gets assigned to $SIG{INT} and $SIG{TERM} in line 22? Where does it take
>the value of "$self" from? If it's from the surrounding scope, then how
>can it know (later on) that the "running" attribute has changed from 0
>to 1? Is this the proper way to do signal handling in an OO context?

It is from the surrounding scope; it's called a closure:

  my $random_word = do {
    my @data = qw( some values of things here );
    sub { return $data[rand @data] }
  };

Here, @data is a lexical variable visible ONLY inside that do BLOCK where
it is created, and if not for the anonymous subroutine I create and return
and store in $random_word, @data would disappear.  However, because the
anonymous subroutine uses a lexical variable, it is a "closure"; plainly
stated, it refers to a lexical variable, and even once that lexical goes
out of scope, it will still have access to its contents.

The code reference in $random_word is the ONLY way of accessing the
contents of @data.

>    my $self = bless $obj, $class;
>    $SIG{TERM} = $SIG{INT} = sub { $self->handleSignal(shift) };

That code ref is a closure.  The $self it uses is the same $self that you
return from new(), so the object in that code ref is the same object
you're using in the rest of YOUR program.

-- 
Jeff Pinyan            RPI Acacia Brother #734            2003 Rush Chairman
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



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

Date: Mon, 17 Nov 2003 18:09:18 +0100
From: Stefan Weiss <spaceman-13187-20031106@ausgehaucht.sensenmann.at>
Subject: Re: Signal handling in objects
Message-Id: <26729503.JlBS8uz6qZ@weyoun.foo.at>

Jeff 'japhy' Pinyan <pinyaj@rpi.edu> wrote:

>>    my $self = bless $obj, $class;
>>    $SIG{TERM} = $SIG{INT} = sub { $self->handleSignal(shift) };
> 
> That code ref is a closure.  The $self it uses is the same $self that you
> return from new(), so the object in that code ref is the same object
> you're using in the rest of YOUR program.

I knew about the closure, but somehow I had completely overlooked that
$self is of course a hash _reference_, so it's no wonder that another
method can change one of its values, and the signal handler would know
about it. My thought was that $self would be "frozen" inside that
closure, and I would end up with an old copy of the object - but of
course that can't happen with a hash ref.

Sometimes you can't see the forest for the trees, until someone comes
along and happens to mention it. Thanks for your help, that's cleared
it up for me.

cheers,
stefan


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

Date: Mon, 17 Nov 2003 20:55:48 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: What to use when rename fails?
Message-Id: <bpbckk$3th$1@reader2.panix.com>

 Ijust discoverd (the hard way) that rename, won't work across filesystems
 :-(

 What can I use in it's place?

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin


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

Date: Mon, 17 Nov 2003 21:04:24 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: What to use when rename fails?
Message-Id: <slrnbriduo.94n.trammell+usenet@hypersloth.el-swifto.com.invalid>

On Mon, 17 Nov 2003 20:55:48 +0000 (UTC), Stan Brown <stanb@panix.com>
wrote:
> Ijust discoverd (the hard way) that rename, won't work across
> filesystems :-(
> 
>  What can I use in it's place?
> 

perldoc File::Copy



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

Date: Mon, 17 Nov 2003 20:05:07 GMT
From: Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet>
Subject: where is DBI::DWIM?
Message-Id: <pan.2003.11.17.14.05.50.969954.1618@somethinglike.sbcglobalDOTnet>

This is partly an SQL question but I'm also trying to find out if there is
a perl module that has already solved it.  Searching CPAN, google, and
reading the DBI/DBD docs seems to indicate that this is just the status
quo.

I am new to SQL, but I'm shocked by the fact that there is no "set the
value of this column in this row" command.  I can INSERT or UPDATE, but
first I must SELECT to see if the row already exists (unless I disable
some warnings, do with autocommit and just '$ins->(@vals) or
$upd->(@vals)', but this still requires me to write two SQL statements
which basically express the same desire and then prepare two statement
handles.

At best, it seems to double (or triple) the amount of SQL-related code,
but at worst, it inherently violates the "single point of truth" rule.

REPLACE is not a good solution, since the rest of the row's contents
should be left intact (but if it isn't there, we just want to create it
and get on with our lives.)  

It seems like an UPDATE statement could easily enough be translated into
the required INSERT statement (but maybe I haven't thought forward far
enough in this idea.)

If anyone could give me a tip that would allow one "statement of intent"
to create whatever SQL statements are needed, that would be great.

Otherwise, tell me why this is crazy before I go write DBI::DWIM

With all of the sql use via Perl and the tendency of Perl to make you
want to be consise, I would think that some kind of "make it so" function
would have been cooked up by now.

Thanks,
Eric


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

Date: Mon, 17 Nov 2003 13:44:21 -0600
From: Lance Hoffmeyer <lance-news@augustmailcom>
Subject: Win32::OLE adding shape to OLE Object (xlsheet) in PPT
Message-Id: <Fd2dne0Ns6SOuCSiRVn-sA@august.net>

I am trying to add a shape to an Excel table of numbers within Powerpoint.

Here is the code I am using.  I do not get an error but I do not
get the shape either?

Lance


use strict;
use warnings;
use Win32::OLE;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft PowerPoint';
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Const 'Microsoft Office';
use Win32::OLE::Variant;
use Time::localtime;
###############################################################################
##############################################################################
##                           DEFINE SOME PATHS 
   ####
###############################################################################
###############################################################################
my $dirpath   = "C:\\test"; # Path to Excel and PPT

my $ppt=Win32::OLE->GetActiveObject('Powerpoint.Application')||
         Win32::OLE->new('PowerPoint.Application','Quit');
$ppt->{Visible} = 1;
my $p2 = 
$ppt->Presentations->Open({FileName=>"$dirpath"."\\Mainreport.ppt"});
foreach my $z (in $p2->Slides(4)->Shapes())
{
if ($z->{Type}== 7){
my $zz=$z->OLEFormat->Object;
my $wsheet = $zz->Worksheets(1)->Shapes->AddShape(msoShapeOval, 10, 10, 
30, 30);
                    }
}



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

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


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