[28137] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9501 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 20 06:05:51 2006

Date: Thu, 20 Jul 2006 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Jul 2006     Volume: 10 Number: 9501

Today's topics:
    Re: Help with script to get backup log status on window anno4000@radom.zrz.tu-berlin.de
    Re: Help with tied/nested data structures <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: Help with tied/nested data structures <rvtol+news@isolution.nl>
    Re: Help with tied/nested data structures <clint@0lsen.net>
    Re: How get UTF-8 from urlencoded web form <jwkenne@attglobal.net>
        How to find out if a certain value is in a list? <tjpn@not_spam.surfeu.fi>
    Re: How to find out if a certain value is in a list? anno4000@radom.zrz.tu-berlin.de
    Re: How to print at certain point in perl <jurgenex@hotmail.com>
    Re: How to print at certain point in perl <rvtol+news@isolution.nl>
    Re: How to print at certain point in perl <DJStunks@gmail.com>
    Re: How to print at certain point in perl <jurgenex@hotmail.com>
    Re: How to print at certain point in perl <bart@nijlen.com>
    Re: How to use a module's @EXPORT array to document its anno4000@radom.zrz.tu-berlin.de
    Re: How to use a module's @EXPORT array to document its <news@lawshouse.org>
        libstdc++ problem with ExtUtils::MakeMaker sherlock@genome.stanford.edu
    Re: libstdc++ problem with ExtUtils::MakeMaker <sisyphus1@nomail.afraid.org>
        new CPAN modules on Thu Jul 20 2006 (Randal Schwartz)
        Unable to lock a file to stop sendmail writing to it <garfield_99999@yahoo.com>
    Re: Unable to lock a file to stop sendmail writing to i anno4000@radom.zrz.tu-berlin.de
    Re: Unable to lock a file to stop sendmail writing to i <noreply@gunnar.cc>
    Re: Unable to lock a file to stop sendmail writing to i <garfield_99999@yahoo.com>
    Re: Unable to lock a file to stop sendmail writing to i <benmorrow@tiscali.co.uk>
        Win32::OLE and CAPICOM to find a certificate in certifi danielhe99@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 20 Jul 2006 08:24:25 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Help with script to get backup log status on windows systems
Message-Id: <4i8stpF2m10hU1@news.dfncis.de>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> "Matt Williamson" <ih8spam@spamsux.org> wrote in
> news:e9lohn$jip$1@nntp.aioe.org: 
> 
> > "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message 
> > news:Xns98057A8FCC814asu1cornelledu@127.0.0.1...
> >> "Matt Williamson" <ih8spam@spamsux.org> wrote in
> >> news:e9lkp8$9gt$1@nntp.aioe.org:
> >>
> >>>  if ($header[0] =~ /ffef/i) { #handle the utf16 .xml files
> >>
> >> I can't comment on the rest of your post, but here you are looking
> >> for a sequence of characters 'f', 'f', 'e', 'f' anywhere in the
> >> string. Those characters have nothing to do with the BOM.
> >>
> >> http://www.unicode.org/faq/utf_bom.html#BOM
> 
> > So, getting the first 2 bytes of the file, converting them to hex and
> > checking the string representation of the hex characters isn't the
> > right way to do it? That part seems to work fine. What is a better
> > way? It took me 4 hours to come up with that <g>
> 
> I did not realize that was what you were doing.

It is a rather roundabout way of checking the first two bytes of
a string.

    read F, my $buffer, 2;
    @header = unpack "h*", $buffer;
    if ($header[0] =~ /ffef/i) { #handle the utf16 .xml files

Instead, define a string constant that contains the relevant two
bytes and compare (untested):

    use constant BOM => "\xFF\xEF";

    read F, my $buffer, 2;
    if ( $buffer eq BOM ) { # handle the utf16 .xml files

Anno


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

Date: Thu, 20 Jul 2006 01:03:06 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Help with tied/nested data structures
Message-Id: <eDAvg.527$gF6.247@newsread2.news.pas.earthlink.net>

On 07/19/2006 04:41 PM, Mumia W. wrote:
> [...]
> Clint, I'm thinking that you can modify the hash-tying class (Foo) to 
> accept a reference to an underlying hash and operate on the values in 
> that hash. Then you can tie the scalars of the underlying hash to the 
> scalar-tying class (Bar).

I hope this demonstrates the technique:

#!/usr/bin/perl

use strict 'vars','subs', 'refs';
use warnings;

my %hash;
my @planets = qw(mercury venus earth);

tie %hash, 'HashTest';

for my $plan (@planets) {
     $plan =~ m/^./;
     $hash{$plan} = '  ...' . (ucfirst $plan);
}

print "  Planet: $hash{$_}\n" for (@planets);
exit;

#######################################

package ScalarTest;
use Tie::Scalar;
use base 'Tie::StdScalar';

sub FETCH {
     my ($self) = shift;
     print "FETCH on $self in @{[ __PACKAGE__ ]}\n";
     $self->SUPER::FETCH(@_);
}


package HashTest;
use Tie::Hash;
use base 'Tie::ExtraHash';
use Data::Dumper;

sub FETCH {
     my ($self) = shift;
     print "FETCH on $self in @{[ __PACKAGE__ ]}\n";
     $self->SUPER::FETCH(@_);
}

sub STORE {
     my $self = shift;
     my ($name, $value) = @_;
     # print "STORE on $self in @{[ __PACKAGE__ ]}\n";

     $self->[0]{$name} = '';
     my $ref = \$self->[0]{$name};
     if (! tied($ref)) {
         tie $$ref, 'ScalarTest', $value;
     }
     $self;
}

__END__

I used Tie::ExtraHash and Tie::StdScalar to cut down on the 
code. That's not too relevant. The important part is where the 
scalar hash value is tested to see if it's already tied. If 
not, it's tied to 'ScalarTest.'

HTH




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

Date: Thu, 20 Jul 2006 03:46:24 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Help with tied/nested data structures
Message-Id: <e9mub1.1dk.2@news.isolution.nl>

Mumia W. schreef:

>      my ($self) = shift;
> [...]
>      my ($self) = shift;
> [...]
>      my $self = shift;

Any special reason for the difference?

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Wed, 19 Jul 2006 21:40:04 -0500
From: Clint Olsen <clint@0lsen.net>
Subject: Re: Help with tied/nested data structures
Message-Id: <slrnebtr83.1cpj.clint@belle.0lsen.net>

On 2006-07-20, Mumia W. <mumia.w.18.spam+nospam.usenet@earthlink.net> wrote:
> I hope this demonstrates the technique:
>
> #!/usr/bin/perl
>
> use strict 'vars','subs', 'refs';
> use warnings;
>
> my %hash;
> my @planets = qw(mercury venus earth);
>
> tie %hash, 'HashTest';
>
> for my $plan (@planets) {
>      $plan =~ m/^./;
>      $hash{$plan} = '  ...' . (ucfirst $plan);
> }
>
> print "  Planet: $hash{$_}\n" for (@planets);
> exit;
>
> #######################################
>
> package ScalarTest;
> use Tie::Scalar;
> use base 'Tie::StdScalar';
>
> sub FETCH {
>      my ($self) = shift;
>      print "FETCH on $self in @{[ __PACKAGE__ ]}\n";
>      $self->SUPER::FETCH(@_);
> }
>
>
> package HashTest;
> use Tie::Hash;
> use base 'Tie::ExtraHash';
> use Data::Dumper;
>
> sub FETCH {
>      my ($self) = shift;
>      print "FETCH on $self in @{[ __PACKAGE__ ]}\n";
>      $self->SUPER::FETCH(@_);
> }
>
> sub STORE {
>      my $self = shift;
>      my ($name, $value) = @_;
>      # print "STORE on $self in @{[ __PACKAGE__ ]}\n";
>
>      $self->[0]{$name} = '';
>      my $ref = \$self->[0]{$name};
>      if (! tied($ref)) {
>          tie $$ref, 'ScalarTest', $value;
>      }
>      $self;
> }
>
> __END__
>
> I used Tie::ExtraHash and Tie::StdScalar to cut down on the 
> code. That's not too relevant. The important part is where the 
> scalar hash value is tested to see if it's already tied. If 
> not, it's tied to 'ScalarTest.'

Hi:

Thanks a lot for the code snippet.  In fact, I notice that if I tie from
within the FETCH or TIEHASH handlers (apparently, the key is before the
call to bless) that things seem to work correctly.

This also explains why my prior code I mentioned to Anno worked.  When I
did chaining of tied structures I returned a newly tied object in the FETCH
method.

Thanks,

-Clint


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

Date: Wed, 19 Jul 2006 21:58:43 -0400
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: How get UTF-8 from urlencoded web form
Message-Id: <YsBvg.743$An.74@fe11.lga>

Alan J. Flavell wrote:
> Has it never occurred to you to ask yourself why CGI.pm, for example, 
> contains this comment:
> 
> # Define the CRLF sequence.  I can't use a simple "\r\n" because the meaning
> # of "\n" is different on different OS's (sometimes it generates CRLF, sometimes LF
> # and sometimes CR). 

CGI.pm would appear to be wrong. "\n" demonstrably does not produce 
CRLF, either on ActivePerl for Windows or on MSYS perl.

    perl -e "print length(qq(\n))"

prints "1".

> Wouldn't you be prepared to admit that you were mistaken, and to 
> refer readers to perlport for more reliable information on this 
> matter?

perlport is distinctly confused on the subject; it badly needs to be 
rewritten both for clarity and for factual correctness. e.g., in "when 
accessing a file in 'text' mode, STDIO translates it to (or from) 
\015\012, depending on whether you're reading or writing.", either the 
"reading" and "writing" or the "to" and "from" need to be interchanged; 
and "You can get away with this on Unix and Mac OS (they have a single 
character end-of-line), but the same program will break under DOSish 
perls because you're only chop()ing half the end-of-line." is flat 
contrary to the way Perl has worked on DOSish systems for as long as I 
can remember (and that's over a decade), unless it is describing the 
anomalous case of a text file that has been read in binary mode.

And, by the way, on MacOS 10.4, ord("\n") returns "10", just as it does 
on Unix and Windows; I just checked now. I don't know what perl ports on 
MacOS Classic did.

-- 
John W. Kennedy
"The blind rulers of Logres
Nourished the land on a fallacy of rational virtue."
   -- Charles Williams.  "Taliessin through Logres: Prelude"


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

Date: Thu, 20 Jul 2006 12:07:44 +0300
From: "TN" <tjpn@not_spam.surfeu.fi>
Subject: How to find out if a certain value is in a list?
Message-Id: <44bf47e4$0$22332$39db0f71@news.song.fi>

Hi there,
what would be the shortest (or best...) way to find out if a certain value 
is in the list like in the code here:

my @resultarray = &somefunc("case"); # returns a list (1,3,5,7,9) in this 
case
# now I need to know whether 7 is in the @resultarray or not
if (...) {
    # 7 was in the @resultarray
} else {
    # 7 was not in the @resultarray
}


Greetings,
TN




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

Date: 20 Jul 2006 09:21:01 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to find out if a certain value is in a list?
Message-Id: <4i907tF2md8aU3@news.dfncis.de>

TN <tjpn@not_spam.surfeu.fi> wrote in comp.lang.perl.misc:
> Hi there,
> what would be the shortest (or best...) way to find out if a certain value 
> is in the list like in the code here:

perldoc -f grep

Anno


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

Date: Thu, 20 Jul 2006 00:51:07 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <%rAvg.6069$Ss2.3860@trnddc01>

Amaninder wrote:
> I want to print something, lets say "abc",  at certain point on the
> screen no matter whats come before it.

The Curses module is your friend, see 
http://search.cpan.org/author/GIRAFFED/Curses-1.14/gen/make.Curses.pm

> For example,  if there are
> following lines
>
> wwwwwwwwwwwwwwwwwwwwwwwwwwww
> qqqqqqqqqqqqqqqqqqqqqq
> zzzzzzzzzzzzzzzzzzzzzzzzzzzz
> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
>
> i want to print "abc" always at fixed length from  the left.  Like
>
>
> wwwwwwwwwwwwwwwwwwwwwwwwwwww       abc
> qqqqqqqqqqqqqqqqqqqqq                                 abc
> zzzzzzzzzzzzzzzzzzzzzzzzzzzz                     abc
> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee  abc

What are you talking about? None of those lines has anything fixed to it.
They are all of different length and the abc is offset by different numbers 
of characters from the preceeding text and the abc's are not aligned by any 
means.

jue 




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

Date: Thu, 20 Jul 2006 03:51:28 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to print at certain point in perl
Message-Id: <e9mukf.1dk.1@news.isolution.nl>

Amaninder schreef:

> I dont know how to post in
> proportional font

I assumed that you composed your posting while having some proportional
font active, which is not a good idea on technical newsgroups in
general, but especially not when you address outlining of text.


> but if you click the "Proportional Font"  at the top
> right corner, you can see what i mean. :)

There are hundreds of proportional fonts available on this system, each
with its own characteristics concerning character widths and spacing
etc., so I strongly doubt that I will see what you seem to think that
you mean.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: 19 Jul 2006 19:15:14 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <1153361714.835896.321510@i3g2000cwc.googlegroups.com>

J=FCrgen Exner wrote:
> Amaninder wrote:
> > I want to print something, lets say "abc",  at certain point on the
> > screen no matter whats come before it.
>
> The Curses module is your friend, see
> http://search.cpan.org/author/GIRAFFED/Curses-1.14/gen/make.Curses.pm
>
> > For example,  if there are
> > following lines

(repaired by J. Peavy)

> > wwwwwwwwwwwwwwwwwwwwwwwwwwww
> > qqqqqqqqqqqqqqqqqqqqqq
> > zzzzzzzzzzzzzzzzzzzzzzzzzzzz
> > eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
> >
> > i want to print "abc" always at fixed length from  the left.  Like
> >
> > wwwwwwwwwwwwwwwwwwwwwwwwwwww            abc
> > qqqqqqqqqqqqqqqqqqqqq                   abc
> > zzzzzzzzzzzzzzzzzzzzzzzzzzzz            abc
> > eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee abc

so how would you perform this task with Curses? I've never used it, but
if I was solving this problem I would use Text::Table so I didn't have
to determine the length of the longest line ahead of time...

-jp



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

Date: Thu, 20 Jul 2006 04:52:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to print at certain point in perl
Message-Id: <h_Dvg.4784$RV.3090@trnddc08>

DJ Stunks wrote:
> Jürgen Exner wrote:
>> Amaninder wrote:
>>> I want to print something, lets say "abc",  at certain point on the
>>> screen no matter whats come before it.
>>
>> The Curses module is your friend, see
>> http://search.cpan.org/author/GIRAFFED/Curses-1.14/gen/make.Curses.pm
>>
>>> For example,  if there are
>>> following lines
>
> (repaired by J. Peavy)
>
>>> wwwwwwwwwwwwwwwwwwwwwwwwwwww
>>> qqqqqqqqqqqqqqqqqqqqqq
>>> zzzzzzzzzzzzzzzzzzzzzzzzzzzz
>>> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
>>>
>>> i want to print "abc" always at fixed length from  the left.  Like
>>>
>>> wwwwwwwwwwwwwwwwwwwwwwwwwwww            abc
>>> qqqqqqqqqqqqqqqqqqqqq                   abc
>>> zzzzzzzzzzzzzzzzzzzzzzzzzzzz            abc
>>> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee abc
>
> so how would you perform this task with Curses? I've never used it,

Well, Curses allows you to position the cursor at any point on the screen, 
just like the OP asked:
<quote>
I want to print something [...] at certain point on the screen no matter 
whats come before it.
</quote>

> but if I was solving this problem I would use Text::Table so I didn't
> have to determine the length of the longest line ahead of time...

I was assuming that he already knew _where_ he wants to print the abc. In 
particular because he wants to print at that position "no matter what come 
before it" I would guess that the preceeding text in that line has no effect 
on the desired position of abc.

Of course his description (I refuse to call that a specification) is so 
vague, that any interpretation may be correct.

jue 




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

Date: 20 Jul 2006 00:23:36 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: How to print at certain point in perl
Message-Id: <1153380216.257378.155780@p79g2000cwp.googlegroups.com>

Amaninder wrote:

> I want to print something, lets say "abc",  at certain point on the
> screen no matter whats come before it. For example,  if there are
> following lines
>
> wwwwwwwwwwwwwwwwwwwwwwwwwwww
> qqqqqqqqqqqqqqqqqqqqqq
> zzzzzzzzzzzzzzzzzzzzzzzzzzzz
> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
>
> i want to print "abc" always at fixed length from  the left.  Like
>
> wwwwwwwwwwwwwwwwwwwwwwwwwwww       abc
> qqqqqqqqqqqqqqqqqqqqq                                 abc
> zzzzzzzzzzzzzzzzzzzzzzzzzzzz                     abc
> eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee  abc

#!/usr/bin/perl
use strict;
use warnings;
my $max = 0;

# what are the lines ?
my $lines = 'wwwwwwwwwwwwwwwwwwwwwwwwwwww
qqqqqqqqqqqqqqqqqqqqq
zzzzzzzzzzzzzzzzzzzzzzzzzzzz
eeeeeeeeeeeeeeeeeeeeee';

# what is the string to display next to each line ?
my $str = 'abc';

# how many spaces between longest line and $str ?
my $spaces = 2;

for (split /\n/, $lines)  {
  $max = length($_) if length($_) > $max;
}

for (split /\n/, $lines)  {
  my $sp = '';
  $sp.=' ' for ( 1 .. ($max + $spaces - length($_)) );
  print $_ . $sp . $str . "\n";
}

__END__


Hope this helps,

-- 
 Bart



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

Date: 19 Jul 2006 23:30:13 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to use a module's @EXPORT array to document its exported objects?
Message-Id: <4i7tk5F2js8tU1@news.dfncis.de>

Henry Law  <news@lawshouse.org> wrote in comp.lang.perl.misc:
> anno4000@radom.zrz.tu-berlin.de wrote:
> > Henry Law  <news@lawshouse.org> wrote in comp.lang.perl.misc:
> ...
> >> But if I run it on my Windows _development_ _client_ against one of the 
> >> _server_ modules the "require" statement croaks because the server has a 
> >> different set of Perl modules installed.  I get "Can't locate xxx in 
> >> @INC (@INC contains ..." messages.
> ...
> >> modules?   Or can I suppress the "Can't locate" messages safely just for 
> >> the tool?
> > 
> > The latter.  perldoc -f eval.
> 
> OK, I see the basic principle: wrap up my "require" in an eval statement 
> so that the program doesn't crash.  But the eval still fails with the 
> same error (now visible in $@), and doesn't create the variables, or 
> make them visible.
> 
> Snippet of the code
> eval {require NFB::Utilities::Server};
> warn $@ if $@;
> print "Version of NFB::Utilities::Server is 
> $NFB::Utilities::Server::VERSION\n";
> 
> The variable $NFB::Utilities::Server::VERSION (which I can see is 
> defined in the module) is undefined, as is the @EXPORT_OK array etc.
> 
> I must be missing something ...

No, I was missing something.  I missed the fact that the missing
module was called one level down, so to speak.

So, in your example above, the module NBF::Utilities::Server calls
some module Nowhere::Around and fails.  Apparently you aren't free
to modify NBF::Utilities::Server, otherwise the obvious solution
would be to change it so it doesn't immediately die when
Nowhere::Around is missing.

Without changing NBF::Utilities::Server, you can try to fake that
Nowhere::Around is already loaded:

    $INC{ 'Nowhere/Around.pm'} = 'fooled you';
    require NBF::Utilities::Server;

That may work, but if NBF::Utilities::Server tries to use things
from Nowhere::Around during initialization you're out of luck again.

Anno


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

Date: Thu, 20 Jul 2006 08:58:33 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: How to use a module's @EXPORT array to document its exported objects?
Message-Id: <1153382310.76988.0@demeter.uk.clara.net>

A. Sinan Unur wrote:

>> ugly and maybe not even possible.
> 
> I do not understand why that is ugly or impossible in most cases. It 
> seems to me that the development environment ought to be as similar to 
> the deployment environment as possible.

Well, yes in a way, but the server bits of the code I'm writing run on a 
Linux server which doesn't have lots of the end-user stuff installed 
(Tk, for example), and the client end (which is where I also do the code 
writing and documenting) is Windows.  And some of the server modules 
aren't available for the ActiveState Perl environment (well, I've not 
been able to find them).

> module info 
> 
> in the search box.

Having had two wizard-level Perl people working on the case it's clear 
to me that this idea isn't going to work so I'll stop trying and find 
another way.

I'll do that CPAN search.  Thanks, Anno and Sinan.



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

Date: 19 Jul 2006 18:19:09 -0700
From: sherlock@genome.stanford.edu
Subject: libstdc++ problem with ExtUtils::MakeMaker
Message-Id: <1153358349.380043.115680@75g2000cwc.googlegroups.com>

Hi,

The GO::TermFinder modules
(http://search.cpan.org/dist/GO-TermFinder/), which I wrote, often seem
to have problems (platform dependent) when doing the make step,
specifically compiling the swig code in the 'native' directory.  The
Makefile.PL in that directory has:

 'LIBS'            => ['-lm -lstdc++'],

but when the make is run, I see a complaint:

Note (probably harmless): No library found for -lstdc++

which later results in failures like:

#                   'Can't load
'/Users/sherlock/dev/GO-TermFinder/blib/arch/auto/GO/TermFinder/Native/Native.bundle'
for module GO::TermFinder::Native:
dlopen(/Users/sherlock/dev/GO-TermFinder/blib/arch/auto/GO/TermFinder/Native/Native.bundle,
2): Symbol not found: __ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base

during the make test phase.  If however, I look at the generated
Makefile in the native directory, I see:

LDLOADLIBS = -lm

if I change this to:

LDLOADLIBS = -lm -lstdc++

and redo the make, the problem is fixed.  It is of course annoying to
tell people they may need to hand-edit make files during the
installation process.  Does anyone know what I'm doing wrong in the
Makefile.PL file that might remedy the problem?

In this example, I was running Perl 5.8.8 on OSX 10.4.7, with
ExtUtils::MakeMaker 6.17 - I have seen this exact same problem on other
platforms though,

Many thanks in advance,
Gavin



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

Date: Thu, 20 Jul 2006 18:52:15 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: libstdc++ problem with ExtUtils::MakeMaker
Message-Id: <44bf4520$0$1211$afc38c87@news.optusnet.com.au>


<sherlock@genome.stanford.edu> wrote in message
news:1153358349.380043.115680@75g2000cwc.googlegroups.com...
> Hi,
>
> The GO::TermFinder modules
> (http://search.cpan.org/dist/GO-TermFinder/), which I wrote, often seem
> to have problems (platform dependent) when doing the make step,
> specifically compiling the swig code in the 'native' directory.  The
> Makefile.PL in that directory has:
>
>  'LIBS'            => ['-lm -lstdc++'],
>
> but when the make is run, I see a complaint:
>
> Note (probably harmless): No library found for -lstdc++
 .
 .
> If however, I look at the generated
> Makefile in the native directory, I see:
>
> LDLOADLIBS = -lm

Yep, '-lstdc++' is not added to LDLOADLIBS because that library could not be
found when running the Makefile.PL. (If it had been found it *would* have
been added.)
And yet, the library is obviously present and *can* be located by the build
('make') process. The question therefore becomes "Why is the stdc++ library
not located by the 'perl Makefile.PL" process ?"

I don't know the answer, but the ExtUtils::LibList documentation may help
you to devise some tests that you can run on the problem platform(s) to
determine the cause.

Cheers,
Rob




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

Date: Thu, 20 Jul 2006 04:42:12 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jul 20 2006
Message-Id: <J2oqEC.1Jon@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Alzabo-0.8901
http://search.cpan.org/~drolsky/Alzabo-0.8901/
A data modelling tool and RDBMS-OO mapper
----
CGI-Ex-2.05
http://search.cpan.org/~rhandom/CGI-Ex-2.05/
CGI utility suite - makes powerful application writing fun and easy
----
Convert-MIL1750A-0.1
http://search.cpan.org/~jtclarke/Convert-MIL1750A-0.1/
Conversion routines between decimal floating/integer values and hexadecimal values in the MIL-STD-1750A format.
----
DBIx-Class-Schema-Loader-0.03005
http://search.cpan.org/~blblack/DBIx-Class-Schema-Loader-0.03005/
Dynamic definition of a DBIx::Class::Schema
----
DPKG-WebInfo-0.1
http://search.cpan.org/~bureado/DPKG-WebInfo-0.1/
----
Devel-Pler-0.08
http://search.cpan.org/~adamk/Devel-Pler-0.08/
----
EasyDBAccess-3.0.3
http://search.cpan.org/~foolfish/EasyDBAccess-3.0.3/
Perl Database Access Interface
----
File-Flat-0.96
http://search.cpan.org/~adamk/File-Flat-0.96/
Implements a flat filesystem
----
Gnome2-Wnck-0.13
http://search.cpan.org/~tsch/Gnome2-Wnck-0.13/
Perl interface to the Window Navigator Construction Kit
----
Log-Simple-1.8
http://search.cpan.org/~mouns/Log-Simple-1.8/
Basic runtime logger
----
PAR-Dist-0.11
http://search.cpan.org/~audreyt/PAR-Dist-0.11/
Create and manipulate PAR distributions
----
Scalar-Defer-0.04
http://search.cpan.org/~audreyt/Scalar-Defer-0.04/
Calculate values on demand
----
Schedule-Load-3.040
http://search.cpan.org/~wsnyder/Schedule-Load-3.040/
Load distribution and status across multiple host machines
----
Test-Dependencies-0.06
http://search.cpan.org/~zev/Test-Dependencies-0.06/
Ensure that your Makefile.PL specifies all module dependencies
----
Test-Pod-1.26
http://search.cpan.org/~petdance/Test-Pod-1.26/
check for POD errors in files
----
Text-Trac-0.03
http://search.cpan.org/~mizzy/Text-Trac-0.03/
Perl extension for formatting text with Trac Wiki Style.
----
Text-Trac-0.04
http://search.cpan.org/~mizzy/Text-Trac-0.04/
Perl extension for formatting text with Trac Wiki Style.
----
Win32-Crypt-0.00_002
http://search.cpan.org/~esskar/Win32-Crypt-0.00_002/
----
Win32-PowerPoint-0.03
http://search.cpan.org/~ishigaki/Win32-PowerPoint-0.03/
helps to convert texts to PP slides
----
XML-Atom-0.21_01
http://search.cpan.org/~miyagawa/XML-Atom-0.21_01/
Atom feed and API implementation
----
version-0.652
http://search.cpan.org/~jpeacock/version-0.652/
Perl extension for Version Objects


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 20 Jul 2006 01:54:24 -0700
From: "GarfGarf" <garfield_99999@yahoo.com>
Subject: Unable to lock a file to stop sendmail writing to it
Message-Id: <1153385664.308602.112280@s13g2000cwa.googlegroups.com>

Hi all,

I am trying to write a script that reads a mailbox that sendmail
updates, but I want to be able to lock the file, read the file, empty
the file and unlock the file again.
 The problem I have is that locking doesn't seem to work. As I can't
lock the file, sendmail writes into the file while i'm writing and that
causes all sorts of problems.

Here are some things I tried:-

sysopen(FH,"/tmp/file",O_EXCL | O_RDWR) || die "Error:$!";
print "File opened\n";
sleep 20;
close FH;

or


use Fcntl ':flock'; # import LOCK_* constants
open(FILE,"</tmp/file") || die $!;
flock(FILE,LOCK_EX);
sleep 20;
close FILE;


each one of those should lock the file, and hold the lock for 20
seconds.
However during that 20 seconds I can still run    date >> /tmp/file
and it gets written to.

This happens both on solaris and linux.

Help !



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

Date: 20 Jul 2006 09:03:42 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Unable to lock a file to stop sendmail writing to it
Message-Id: <4i8v7eF2md8aU2@news.dfncis.de>

GarfGarf <garfield_99999@yahoo.com> wrote in comp.lang.perl.misc:
> Hi all,
> 
> I am trying to write a script that reads a mailbox that sendmail
> updates, but I want to be able to lock the file, read the file, empty
> the file and unlock the file again.
>  The problem I have is that locking doesn't seem to work. As I can't
> lock the file, sendmail writes into the file while i'm writing and that
> causes all sorts of problems.
> 
> Here are some things I tried:-
> 
> sysopen(FH,"/tmp/file",O_EXCL | O_RDWR) || die "Error:$!";
> print "File opened\n";
> sleep 20;
> close FH;

The O_EXCL flag to sysopen() doesn't do what you seem to think it does.
This is explicitly pointed out in perldoc -f sysopen. Read it.

> or
> 
> 
> use Fcntl ':flock'; # import LOCK_* constants
> open(FILE,"</tmp/file") || die $!;
> flock(FILE,LOCK_EX);
> sleep 20;
> close FILE;
> 
> 
> each one of those should lock the file, and hold the lock for 20
> seconds.
> However during that 20 seconds I can still run    date >> /tmp/file
> and it gets written to.

Quite so.  File locking is advisory, not mandatory.  Read perldoc -f
flock.

Anno


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

Date: Thu, 20 Jul 2006 11:11:43 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Unable to lock a file to stop sendmail writing to it
Message-Id: <4i8vjqF2lsr5U1@individual.net>

GarfGarf wrote:
> I am trying to write a script that reads a mailbox that sendmail
> updates, but I want to be able to lock the file, read the file, empty
> the file and unlock the file again.
>  The problem I have is that locking doesn't seem to work.

I think your problem is merely a misconception with respect to the 
meaning of flock(). As stated in

     perldoc -f flock

the nature of an flock() lock is advisory.

> sendmail writes into the file while i'm writing and that
> causes all sorts of problems.

That's probably because sendmail doesn't use flock on the mailboxes.

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


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

Date: 20 Jul 2006 02:16:28 -0700
From: "GarfGarf" <garfield_99999@yahoo.com>
Subject: Re: Unable to lock a file to stop sendmail writing to it
Message-Id: <1153386988.302678.38690@p79g2000cwp.googlegroups.com>


Gunnar Hjalmarsson wrote:
> GarfGarf wrote:
> > I am trying to write a script that reads a mailbox that sendmail
> > updates, but I want to be able to lock the file, read the file, empty
> > the file and unlock the file again.
> >  The problem I have is that locking doesn't seem to work.
>
> I think your problem is merely a misconception with respect to the
> meaning of flock(). As stated in
>
>      perldoc -f flock
>
> the nature of an flock() lock is advisory.
>
> > sendmail writes into the file while i'm writing and that
> > causes all sorts of problems.
>
> That's probably because sendmail doesn't use flock on the mailboxes.
>
>

Ok, thanks for the replies.
It seems flock is not the way to go..

So, how can I lock the file to stop sendmail spatting it?



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

Date: Thu, 20 Jul 2006 10:35:50 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Unable to lock a file to stop sendmail writing to it
Message-Id: <mcv3p3-5no.ln1@osiris.mauzo.dyndns.org>


Quoth "GarfGarf" <garfield_99999@yahoo.com>:
> 
> Gunnar Hjalmarsson wrote:
> > GarfGarf wrote:
> > > I am trying to write a script that reads a mailbox that sendmail
> > > updates, but I want to be able to lock the file, read the file, empty
> > > the file and unlock the file again.
> > >  The problem I have is that locking doesn't seem to work.
> >
> > I think your problem is merely a misconception with respect to the
> > meaning of flock(). As stated in
> >
> >      perldoc -f flock
> >
> > the nature of an flock() lock is advisory.
> >
> > > sendmail writes into the file while i'm writing and that
> > > causes all sorts of problems.
> >
> > That's probably because sendmail doesn't use flock on the mailboxes.
> >
> >
> 
> Ok, thanks for the replies.
> It seems flock is not the way to go..
> 
> So, how can I lock the file to stop sendmail spatting it?

You need to find out how sendmail *does* lock the files, then do the
same. It might use flock locking, fcntl locking or create a lockfile.
Then you do the same.

FWIW, if you use maildir mail folders you don't need locking...

Ben

-- 
  The cosmos, at best, is like a rubbish heap scattered at random.
                                                           Heraclitus
  benmorrow@tiscali.co.uk


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

Date: 19 Jul 2006 23:47:12 -0700
From: danielhe99@gmail.com
Subject: Win32::OLE and CAPICOM to find a certificate in certificate store will raise exception
Message-Id: <1153378031.980095.282760@m73g2000cwd.googlegroups.com>

Hi,

I am trying to use win32::OLE to access certificate store via CAPICOM.
If  certificates in the store meet the searching criteria, the
certificates object
method "find"  works, but if no certificate meets the searching
criteria, it will raise
an error message:
 OLE exception from "<Unknown Source>": The Data is invalid.

How to solve the problem or catch the exception in Perl script?

Thanks!

===== test case =======
#!c:/Perl/bin/perl.exe -w
#Test store->certificates->Find

use strict;
use Win32::OLE;

# CAPICOM constant definitions
use constant {
    # Store Location
    #
http://msdn.microsoft.com/library/en-us/security/security/capicom_store_location.asp
    CAPICOM_LOCAL_MACHINE_STORE           => 1,
    CAPICOM_CURRENT_USER_STORE            => 2,
    # Store Open Mode
    #
http://msdn.microsoft.com/library/en-us/security/security/capicom_store_open_mode.asp
    CAPICOM_STORE_OPEN_READ_ONLY  => 0,
    # key storage flags
    #
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/certificate_load.asp
    CAPICOM_KEY_STORAGE_DEFAULT => 0,
    # The Find method returns a Certificates object that contains all
certificates that
    # match the specified search criteria. This method was introduced
in CAPICOM 2.0. see:
    #
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/certificates_find.asp
    CAPICOM_CERTIFICATE_FIND_SHA1_HASH           => 0,
};

# Search the certificate with the thumbprint SHA1 in local certificate
store.
my $SHA1 = "0000000049d8650d2515111709ee1b4800000000";

Win32::OLE->Option ('Warn' => 3);

# Create a new Store object, and use it to open the store.  See
#
<http://msdn.microsoft.com/library/en-us/security/security/store.asp>.
my $Store = Win32::OLE->new('CAPICOM.Store', sub {$_[0]->Close();})
           or die "Oops, cannot start CAPICOM";
$Store->Open (CAPICOM_LOCAL_MACHINE_STORE, 'ROOT',
CAPICOM_STORE_OPEN_READ_ONLY);

# TEST the certificates->find function
# if no certificate is found, this program will hangup after several
tries!
# here 10 tries, should print out 10 times "continue searching..." if
no exception.
for(1...10)
{
  $Store->Certificates->Find(CAPICOM_CERTIFICATE_FIND_SHA1_HASH,
$SHA1);
  print "continue searching...\n";
}
print "\nCompleted.\n";


# perl version
#
#  This is perl, v5.8.8 built for MSWin32-x86-multi-thread
#  (with 25 registered patches, see perl -V for more detail)
#
# Copyright 1987-2006, Larry Wall
#
# Binary build 817 [257965] provided by ActiveState
http://www.ActiveState.com
# Built Mar 20 2006 17:54:25



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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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