[26323] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8498 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 7 18:05:31 2005

Date: Fri, 7 Oct 2005 15:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 7 Oct 2005     Volume: 10 Number: 8498

Today's topics:
    Re: Help with simple script <do-not-use@invalid.net>
    Re: installing module manually in windows <noresp@aaa.aaa>
    Re: Is there a Perl Module The Does GCC like precompile <Random@Task.be>
    Re: print prints things in strange order. <bogus.email@no.spam.com>
    Re: print prints things in strange order. <rvtol+news@isolution.nl>
        SNMP.pm <subs.nntp.wfitzgerald@crtman.com>
    Re: SNMP.pm <subs.nntp.wfitzgerald@crtman.com>
    Re: SNMP.pm <glex_no-spam@qwest-spam-no.invalid>
    Re: SNMP.pm <subs.nntp.wfitzgerald@crtman.com>
    Re: threads, XSUB allocated memory, destructors, destru xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 07 Oct 2005 13:55:05 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Help with simple script
Message-Id: <yzdek6x35k6.fsf@invalid.net>


rv@bakker-sl-dot-nl.no-spam.invalid (laser4000) writes:
> I need a simple perl script that read in a txt file.
> and if it find a text wich I fill in a varialble it must print OK to
> dstout.

Consider putting more effort into expressing what it is you want.
People will probably not write the code for you anyway, but it's good
practice (and I don't mean good English practice, but it is that
too). How is that variable to be "filled", for example?


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

Date: Fri, 07 Oct 2005 20:54:37 +0000
From: mike<noresp@aaa.aaa>
Subject: Re: installing module manually in windows
Message-Id: <slndk1dll10ntv2tnr4m96onh77idthf0t@4ax.com>

On Fri, 7 Oct 2005 08:23:32 +1000, Ron Savage <ron@savage.net.au>
wrote:

>On Fri, 7 Oct 2005 03:26:04 +1000, John Bokma wrote:
>
>Hi Folks
>
>> http://johnbokma.com/perl/make-for-windows.html
>
>See also http://savage.net.au/Perl-modules/html/installing-a-module.html
>
>

ok, now i have successfully installed the modules. i have got my
program to send me emails with a list of the item numbers. what i need
to do now is get the for loop going within this bit of code. i have
read the Mail::Sender notes but it doesnt have any mention of
including a loop.

use Mail::Sender;
     
        $sender = new Mail::Sender {smtp => 'mysmtpserver', 
	from => 'me@whatever.com'};
        $sender->MailFile({to => 'you@whatever.com', 
	subject => 'New items found', 
        msg => "I'm sending you the list you wanted.",
	for ($b = 1; $b <= $a; $b++) 
	 {
  		msg => "$title[$b]\n",
  		msg =>
"http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$itemnumber[$b]\n\n";
 	 }
        file => $localfile});

thanks for any help


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

Date: Fri, 07 Oct 2005 11:42:59 -0400
From: Random Task <Random@Task.be>
Subject: Re: Is there a Perl Module The Does GCC like precompile on C++ files ?
Message-Id: <4Iw1f.3671$R4.588219@news20.bellglobal.com>

A. Sinan Unur wrote:
> Random Task <Random@Task.be> wrote in
> news:SKv1f.8627$2F2.1053934@news20.bellglobal.com: 
> 
> 
>>A. Sinan Unur wrote:
>>
>>>Random Task <Random@Task.be> wrote in news:434683A6.2090904@Task.be:
>>>
>>>
>>>>I want to take an IDL file and preprocess it ... like someone would
>>>>do with a C file 
>>>
>>>...
>>>
>>>
>>>>The trick is ... I only have access to Perl ... so I can't use gcc.
>>>>So I was hoping I would not have to implement this myself.
> 
> 
> ...
> 
> 
>>>What did you find when you searched CPAN?
>>>
>>>http://search.cpan.org/search?query=cpp&mode=all
>>>
>>
>>I found this:
>>
>>http://search.cpan.org/~ram/Pod-PP-0.1.2/PP.pm
> 
> 
> So, you skipped the first match?
> 

Indeed it looks like I did ... I'll give this a shot! Ooops ...

> 
>>It looks reasonably close to what I need.
>>
>>However it looks like a beta and that it is no longer being
>>maintained. 
> 
> 
> http://search.cpan.org/~shevek/Text-CPP-0.12/CPP.pm
> 
> DESCRIPTION ^
> 
> A fast C preprocessor in XS. This does not require an external C 
> preprocessor, and will not fork() or exec() any external process.
> 
> Sinan

Only down side is that it still looks like a beta ... but i'll try it 
anyways ...

Thanks,

Jim


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

Date: Fri, 07 Oct 2005 20:32:32 GMT
From: "Robbie Hatley" <bogus.email@no.spam.com>
Subject: Re: print prints things in strange order.
Message-Id: <AXA1f.1373$B14.908@newssvr11.news.prodigy.com>

Ok, thanks to "John W. Krahn" and "A. Sinan Unur" for the
fast replies to my post.

I'd written:

> > #!/bin/perl
> > open my $F, $0 or die $!;
> > while (<$F>)
> > {
> >    chomp;
> >    print ("one two three " . "$_" . " DEF \n");
> > }
> > close $F;
> > ...
> > djgpp Perl outputs:
> >  DEF wo three #!/bin/perl
> >  DEF wo three open my $F, $0 or die $!;
> >  DEF wo three while (<$F>)
> >  DEF wo three {
> >  DEF wo three    chomp;
> >  DEF wo three    print ("one two three " . $_ . " DEF \n");
> >  DEF wo three }
> >  DEF wo three close $F;
> > What's going on there???...

and John replied:

> Your perl program is stored on disk in a DOS text format that
> has a carriage return and line feed at the end of the line and
> the djgpp version's chomp() removes these correctly however
> cygwin is a UNIX enviroment so it only removes the line feed
> but not the carriage return.

AH, I see it clearly now.  The LF is gone but the CR remains, so
the print cursor obediantly goes to start of same line and starts
over-writing.

Perhaps I should get a unixy editor for use with cygwin...  but
then my files would look like crud in notepad; and if I use
NoteTab (my favorite editor) instead, it'll change all the LFs
back to CRLFs anyway.

I think I'll alter chomp in the Perl source and recompile.

::: Reads source :::

How come this is full of Tolkien quotes?  Not that I'm
complaining.  Mithril and elven glass suit me fine.

A. Sinan Unur wrote:

> s/(:?\015\012)|(:?\015)|(:?\012)//

Ok, cool chomp replacement.  Basically, "replace CRLF, CR,
or LF with empty substring".

But what is this ":?" thingy?  I'd read that RE as meaning
"zero-or-one colons", which doesn't seem to make sense in
this context.

::: reads www.perl.org man pages :::

Ah, I see... you meant non-capture grouping:

s/(?:\015\012)|(?:\015)|(?:\012)//

If you switch the ':' and '?', it's still a valid RE, but
it then means something very different!  :-)

Or just take out the groupings and chomp all CRs and LFs:

s/[\015\012]//g;

or even:

s/[\n\r]//g;


Cheers,
Robbie Hatley




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

Date: Fri, 7 Oct 2005 22:46:04 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: print prints things in strange order.
Message-Id: <di6tu0.1fg.1@news.isolution.nl>

Robbie Hatley schreef:

> Perhaps I should get a unixy editor for use with cygwin...

Try pico.


> but then my files would look like crud in notepad

No problem with wordpad.


> I think I'll alter chomp in the Perl source and recompile.

Forget it.


And I wouldn't assume that /\012/ and /\n/ are always the same, 
/\n/ could just as well be a /\015/ on an $fruitmachine.

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Fri, 07 Oct 2005 17:30:42 -0400
From: Warrick FitzGerald <subs.nntp.wfitzgerald@crtman.com>
Subject: SNMP.pm
Message-Id: <6OB1f.59$F06.826@news.uswest.net>

Hi All,

I can't seem to use SNMP.pm on my box.

=====

#!/usr/bin/perl -w
use SNMP;
print "test \n";

=====

Fails with the following error:

=====

[root@Uploads wfitzgerald]# ./test.pl
Can't locate SNMP.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl .) at ./test.pl line 2.
BEGIN failed--compilation aborted at ./test.pl line 2.

=====

However the module is in it's @INC path

=========
It's there:
[root@Uploads wfitzgerald]# find /usr/lib/perl5/vendor_perl/5.8.1  |
grep -i snmp
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi/auto/Net/SNMP
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/MessageProcessing.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Dispatcher.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Message.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security/Community.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security/USM.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/PDU.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Transport
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Transport/UDP.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security.pm
/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP.pm

=====

Any ideas?

Thanks
Warrick



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

Date: Fri, 07 Oct 2005 17:33:02 -0400
From: Warrick FitzGerald <subs.nntp.wfitzgerald@crtman.com>
Subject: Re: SNMP.pm
Message-Id: <4346E98E.7060303@crtman.com>

Warrick FitzGerald wrote:

>Hi All,
>
>I can't seem to use SNMP.pm on my box.
>
>=====
>
>#!/usr/bin/perl -w
>use SNMP;
>print "test \n";
>
>=====
>
>Fails with the following error:
>
>=====
>
>[root@Uploads wfitzgerald]# ./test.pl
>Can't locate SNMP.pm in @INC (@INC contains:
>/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1
>/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
>/usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl
>/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
>/usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
>/usr/lib/perl5/vendor_perl .) at ./test.pl line 2.
>BEGIN failed--compilation aborted at ./test.pl line 2.
>
>=====
>
>However the module is in it's @INC path
>
>=========
>It's there:
>[root@Uploads wfitzgerald]# find /usr/lib/perl5/vendor_perl/5.8.1  |
>grep -i snmp
>/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi/auto/Net/SNMP
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/MessageProcessing.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Dispatcher.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Message.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security/Community.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security/USM.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/PDU.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Transport
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Transport/UDP.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP/Security.pm
>/usr/lib/perl5/vendor_perl/5.8.1/Net/SNMP.pm
>
>=====
>
>Any ideas?
>
>Thanks
>Warrick
>
>  
>
Opps sorry the error it fails with is:

[root@Uploads wfitzgerald]# ./test.pl
Can't locate SNMP.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl .) at ./test.pl line 2.
BEGIN failed--compilation aborted at ./test.pl line 2.


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

Date: Fri, 07 Oct 2005 16:47:45 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: SNMP.pm
Message-Id: <52C1f.64$F06.822@news.uswest.net>

Warrick FitzGerald wrote:

>>Hi All,
>>
>>I can't seem to use SNMP.pm on my box.
>>
>>=====
>>
>>#!/usr/bin/perl -w
>>use SNMP;
>>print "test \n";

use Net::SNMP;

Looking at the online documentation for SNMP would have answered it for 
you: http://search.cpan.org/~dtown/Net-SNMP-5.1.0/lib/Net/SNMP.pm


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

Date: Fri, 07 Oct 2005 17:54:14 -0400
From: Warrick FitzGerald <subs.nntp.wfitzgerald@crtman.com>
Subject: Re: SNMP.pm
Message-Id: <4346EE86.3000409@crtman.com>

J. Gleixner wrote:

> Warrick FitzGerald wrote:
>
>>> Hi All,
>>>
>>> I can't seem to use SNMP.pm on my box.
>>>
>>> =====
>>>
>>> #!/usr/bin/perl -w
>>> use SNMP;
>>> print "test \n";
>>
>
> use Net::SNMP;
>
> Looking at the online documentation for SNMP would have answered it
> for you: http://search.cpan.org/~dtown/Net-SNMP-5.1.0/lib/Net/SNMP.pm

Ok sorry I was trying to simplify my problem, but here's the real situation:

When running snmptt, I get the same error

[root@Uploads wfitzgerald]# /usr/sbin/snmptt
--ini=/etc/snmptt/snmptt.ini --debug2
Unknown option: debug2
Config file /etc/snmptt/snmptt.ini loaded
Can't locate SNMP.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl .) at (eval 2) line 1.

Could not load the Perl module SNMP!  If net_snmp_perl_enable is
enabled then the SNMP module is required.  Please see snmptt.html
for system requirements.  Note:  SNMPTT uses the Net-SNMP package's
SNMP module, NOT the CPAN Net::SNMP module!

died at /usr/sbin/snmptt line 249.

======

However as I showed it is installed (or so I belive anyway).

Since snmptt was not written by me, I'm really trying to figure out
what's going on. Even if I hard code the path


use lib qw(/usr/lib/perl5/site_perl/5.8.1/Net/);
use lib qw(/usr/lib/perl5/site_perl/5.8.1/Net/SNMP/);

I still get other errors so soemthings not right, I just don't know what.


Thanks
Warrick


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

Date: 07 Oct 2005 15:10:00 GMT
From: xhoster@gmail.com
Subject: Re: threads, XSUB allocated memory, destructors, destruction
Message-Id: <20051007111000.718$NG@newsreader.com>

"Sisyphus" <sisyphus1@nomail.afraid.org> wrote:
> "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> wrote in
> message .
> .
> >
> > So in essence: the XS portion of your code isn't thread-safe. In order
> > to make it thread-safe, you have to take control over the cloning
> > process. See 'perldoc perlmod' and search for "CLONE". For recent perls
> > (>= 5.8.7) all you have to do is provide a CLONE_SKIP method for the
> > package 'Experimental' (in your case).
>
> Yep - CLONE_SKIP seems to be the missing ingredient - works for me,
> anyway.
>
> I don't  understand why the problem arises only with *blessed* objects.
> Does cloning not occur wrt unblessed objects ? Or is it just that
> problems are avoided simply because perl doesn't (automatically) clean up
> unblessed objects  ?

For the unblessed objects, you were calling _destroy yourself, and doing
it from within just one of the threads.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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


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