[29416] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 660 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 19 03:10:42 2007

Date: Thu, 19 Jul 2007 00:09: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, 19 Jul 2007     Volume: 11 Number: 660

Today's topics:
    Re: Apache Configuration using PERL <xicheng@gmail.com>
    Re: catch-ing unsatisfied ``use'' <peter@makholm.net>
    Re: connect a database in remote server (can connect to  usenet@DavidFilmer.com
    Re: Handling Large files (a few Gb) in Perl <sydches@gmail.com>
    Re: Handling Large files (a few Gb) in Perl xhoster@gmail.com
    Re: How do you retrieve a char from a string? <spamtrap@dot-app.org>
        Math <sigzero@gmail.com>
    Re: Math <jwkenne@attglobal.net>
    Re: Math <jurgenex@hotmail.com>
    Re: Math <wahab@chemie.uni-halle.de>
        new CPAN modules on Thu Jul 19 2007 (Randal Schwartz)
        new lines in the way  new2perl@gmail.com
    Re: Recursively Removing Embedded Quotes <nobull67@gmail.com>
    Re: retrieving usenet messages III <zaxfuuq@invalid.net>
    Re: retrieving usenet messages III <zaxfuuq@invalid.net>
    Re: uncleared data on serial port problem (DF4OR)
    Re: XML::Twig segfault on solaris xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Jul 2007 22:02:29 -0000
From:  Xicheng Jia <xicheng@gmail.com>
Subject: Re: Apache Configuration using PERL
Message-Id: <1184796149.759853.174970@x35g2000prf.googlegroups.com>

On Jul 17, 11:27 am, nicklas.bornst...@gmail.com wrote:
> Hi,
>
> Im trying to use PERL, generating some of the Apache Configuration.
> I have loaded the module mod_perl, and then do something like;
>
> <Perl>
> print 'ErrorDocument 404http://www.google.dk';
> </Perl>
>
> in my httpd.conf - but the Apache Configuration don't evaluate on the
> print, it just print out the line in the comand promt.
>
> I have seach Google and found some example using somthing like;
> use Apache::PerlSections();
>
> but I can't figure it out. If I use the PerlSections(), I get the
> error;
> "Can't locate Apache/PerlSections.pm in @INC ...".
>
> How do I simply write some configuration line in my httpd.conf, using
> Perl? Thanks!

Check out this page:
=====

    http://modperlbook.org/html/ch04_04.html

    4.4.1. Constructing <Perl> Sections

=====
Instead of printing out Apache configration directives, you should do
something like:

<Perl>
    @ErrorDocument = (
        [ 404 => 'http://www.google.dk' ],
        [ 500 => '/error.html' ],
    );
</Perl>

(untested)
Regards,
Xicheng



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

Date: Wed, 18 Jul 2007 16:55:17 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: catch-ing unsatisfied ``use''
Message-Id: <87d4yptzwq.fsf@hacking.dk>

"David Formosa (aka ? the Platypus)" <dformosa@usyd.edu.au> writes:

>>     BEGIN {
>>         try {
>>             require Image::Magick;
>>         } catch Error {
>>             require GraphicsMagick;
>>         }
>>     }
>
> Perl has try and catch now?  My 5.8.8 definitly doesn't have anything
> looking like it.  Perhaps you mean 

Yes, Error.pm provides wrappers arround eval, die and if($@) which is
not completly unlike other languages Exception handling routines. 

The above code doesn't match the Error.pm syntax completely. It should
say

BEGIN {
  try {
      require Image::Magick;
  } catch Error with {
      require GraphicsMagick;
  };
}



//Makholm


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

Date: Wed, 18 Jul 2007 19:20:14 -0000
From:  usenet@DavidFilmer.com
Subject: Re: connect a database in remote server (can connect to the server via SSH)
Message-Id: <1184786414.885816.194240@m37g2000prh.googlegroups.com>

On Jul 17, 9:35 am, zhangxiaoyu...@gmail.com wrote:
> Hi, All:
> My perl code need to connect to a database (MySQL) in remote server,
> and I can login that server via SSH. I am a new to perl, can anyone
> give me a hint how can I do that. Many thanks.
>
> Xiaoyu

perldoc DBI


--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: Wed, 18 Jul 2007 08:35:05 -0700
From:  "sydches@gmail.com" <sydches@gmail.com>
Subject: Re: Handling Large files (a few Gb) in Perl
Message-Id: <1184772905.437746.93730@z24g2000prh.googlegroups.com>

Hi,

I started running both my programs (C++ and Perl) on a whole lot of
test files. And I noticed something.

The C code and Perl code run in almost the same time!
Except a single 1 Gb file which the C code does in around 250
milliseconds, and Perl takes about 2-3 minutes for that!
The output says 460 is the longest record.

Unfortunately, I am unable to open this file directly (because of the
size).
I am going to try a splitter to see what kind of data is on this one
file.

Thanks for all the help. Boy, did I learn a whole lot talking to you
guys!

Warm regards!
Syd



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

Date: 18 Jul 2007 16:39:21 GMT
From: xhoster@gmail.com
Subject: Re: Handling Large files (a few Gb) in Perl
Message-Id: <20070718123923.559$O8@newsreader.com>

"sydches@gmail.com" <sydches@gmail.com> wrote:
> Hi,
>
> I started running both my programs (C++ and Perl) on a whole lot of
> test files. And I noticed something.
>
> The C code and Perl code run in almost the same time!
> Except a single 1 Gb file which the C code does in around 250
> milliseconds, and Perl takes about 2-3 minutes for that!
> The output says 460 is the longest record.
>
> Unfortunately, I am unable to open this file directly (because of the
> size).
> I am going to try a splitter to see what kind of data is on this one
> file.

I wonder if Perl is somehow deciding that that file is in Unicode rather
than simple one-byte characters.  I understand that that will slow things
down considerably.  I don't know how Perl would make that decision; I have
little experience on that topic.


Xho

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


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

Date: Wed, 18 Jul 2007 15:48:03 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How do you retrieve a char from a string?
Message-Id: <m2bqe9h4ss.fsf@dot-app.org>

anno4000@radom.zrz.tu-berlin.de writes:

> Sherm Pendley  <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
>> Thierry <lamthierry@gmail.com> writes:
>> 
>> > I have the following string:
>> >
>> > my $greet = "hello";
>> > print $greet[0]."\n";
>> >
>> > The above clearly doesn't work since $greet is not an array. Is there
>> > an easy way to access characters at specific index in a string without
>> > losing $greet as a String?
>> 
>> print substr($greet, 0);
>
> That's the entire string.  The first character is "substr($greet, 0, 1)".

The OP said he wanted characterS at the specific index, and didn't specify
how many. That's my story and I'm sticking to it. :-)

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Thu, 19 Jul 2007 01:46:54 -0000
From:  Robert Hicks <sigzero@gmail.com>
Subject: Math
Message-Id: <1184809614.126019.220110@x40g2000prg.googlegroups.com>

I realize that any math in Perl is probably slower than the same math
in "C" but I was wondering if Perl was as accurate as "C" in math
computations. I don't see why it wouldn't be but I thought I would ask
as a heavy spherical math project is on the horizon.

Robert



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

Date: Wed, 18 Jul 2007 22:25:19 -0400
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Math
Message-Id: <jYzni.31$aM6.12@newsfe12.lga>

Robert Hicks wrote:
> I realize that any math in Perl is probably slower than the same math
> in "C" but I was wondering if Perl was as accurate as "C" in math
> computations.

It's all the same arithmetic under the covers. But it /will/ be slower, 
if pure compute time is the bottleneck.
-- 
John W. Kennedy
"The poor have sometimes objected to being governed badly; the rich have 
always objected to being governed at all."
   -- G. K. Chesterton.  "The Man Who Was Thursday"


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

Date: Thu, 19 Jul 2007 03:28:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Math
Message-Id: <QTAni.5344$bP4.2730@trndny01>

Robert Hicks wrote:
> I realize that any math in Perl is probably slower than the same math
> in "C" but I was wondering if Perl was as accurate as "C" in math
> computations.

Computational precision depends on many factors like e.g. underlying 
hardware, OS architecture, standard libraries, compiler/interpreter 
optimization, etc.
But it has nothing to do with the actual programming language(*).

jue

(*): well, at least as long as we exclude symbolic computations in 
specialized mathematical programming languages.






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

Date: Thu, 19 Jul 2007 08:36:50 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Math
Message-Id: <f7n0q3$26ae$1@nserver.hrz.tu-freiberg.de>

Robert Hicks wrote:
> I realize that any math in Perl is probably slower than the same math
> in "C" but I was wondering if Perl was as accurate as "C" in math
> computations. I don't see why it wouldn't be but I thought I would ask
> as a heavy spherical math project is on the horizon.

 From my own experiences: Perl is not *that* slow in
numerical thinks. The speed-problem will show up
if you do some matrix or vector stuff in naíve
Perl expressions because the array handling
is somehow expensive then.

The "accuracy" is, as has been mentioned, in the
normal IEEE "double" range. With only one additional
line of code (eg. "use Math::BigFloat;"), one can get
into almost "arbitary accuracy" mode
(see: http://perldoc.perl.org/Math/BigFloat.html and others).

There is already a Perl extension for vector and matrix
computations, it's called 'PDL' (Perl Data language,
see http://pdl.perl.org/) an an implementation of
GNU-GMP's mpf routines
(http://search.cpan.org/~sisyphus/Math-GMPf-0.14/GMPf.pm)

To get a clearer picture for startup, read:
http://math.arizona.edu/~kerl/doc/perl-talk.pdf

Regards

M.





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

Date: Thu, 19 Jul 2007 04:42:22 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jul 19 2007
Message-Id: <JLEt2M.15Ky@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.

Acme-CorpusScrambler-0.01
http://search.cpan.org/~shelling/Acme-CorpusScrambler-0.01/
An Acme way doing Lorem Ipsum. 
----
AnyEvent-2.54
http://search.cpan.org/~mlehmann/AnyEvent-2.54/
provide framework for multiple event loops 
----
B-LintSubs-0.05
http://search.cpan.org/~pevans/B-LintSubs-0.05/
Perl compiler backend to check sub linkage 
----
CPAN-Reporter-0.46
http://search.cpan.org/~dagolden/CPAN-Reporter-0.46/
Provides Test::Reporter support for CPAN.pm 
----
Catalyst-Action-RenderView-ErrorHandler-0.0102
http://search.cpan.org/~andremar/Catalyst-Action-RenderView-ErrorHandler-0.0102/
Custom errorhandling in deployed applications 
----
Catalyst-Plugin-Authentication-Credential-TypeKey-0.4
http://search.cpan.org/~jrobinson/Catalyst-Plugin-Authentication-Credential-TypeKey-0.4/
TypeKey Authentication for Catalyst. 
----
Catalyst-Plugin-Unicode-0.4
http://search.cpan.org/~mramberg/Catalyst-Plugin-Unicode-0.4/
Unicode aware Catalyst 
----
Catalyst-View-Email-0.04
http://search.cpan.org/~jshirley/Catalyst-View-Email-0.04/
Send Email from Catalyst 
----
ClearPress-39
http://search.cpan.org/~rpettett/ClearPress-39/
Simple, fresh & fruity MVC framework 
----
Config-Crontab-1.21
http://search.cpan.org/~scottw/Config-Crontab-1.21/
Read/Write Vixie compatible crontab(5) files 
----
DBIx-MyParse-0.88
http://search.cpan.org/~philips/DBIx-MyParse-0.88/
Perl API for MySQL's SQL Parser 
----
Email-Abstract-2.133_01
http://search.cpan.org/~rjbs/Email-Abstract-2.133_01/
unified interface to mail representations 
----
IMDB-Film-0.29
http://search.cpan.org/~stepanov/IMDB-Film-0.29/
OO Perl interface to the movies database IMDB. 
----
IO-Dirent-0.04
http://search.cpan.org/~scottw/IO-Dirent-0.04/
Access to dirent structs returned by readdir 
----
IO-Zlib-1.06
http://search.cpan.org/~tomhughes/IO-Zlib-1.06/
IO:: style interface to Compress::Zlib 
----
Java-Javap-0.02
http://search.cpan.org/~philcrow/Java-Javap-0.02/
Java to Perl 6 API translator 
----
Linux-loadavg-0.04
http://search.cpan.org/~perlboy/Linux-loadavg-0.04/
Get system load averages (via getloadavg(3C) system call) 
----
Linux-loadavg-0.05
http://search.cpan.org/~perlboy/Linux-loadavg-0.05/
Get system load averages (via getloadavg(3C) system call) 
----
MRO-Compat-0.04
http://search.cpan.org/~blblack/MRO-Compat-0.04/
mro::* interface compatibility for Perls < 5.9.5 
----
Module-PortablePath-0.05
http://search.cpan.org/~rpettett/Module-PortablePath-0.05/
Perl extension follow modules to exist in different non-core locations on different systems without having to refer to explicit library paths in code. 
----
Mollie-Micropayment-0.02
http://search.cpan.org/~ckras/Mollie-Micropayment-0.02/
Perl API for Mollie's Micropayment service 
----
MooseX-Method-0.36
http://search.cpan.org/~berle/MooseX-Method-0.36/
Method declaration with type checking 
----
MooseX-Method-0.37
http://search.cpan.org/~berle/MooseX-Method-0.37/
Method declaration with type checking 
----
Net-DBus-0.33.5
http://search.cpan.org/~danberr/Net-DBus-0.33.5/
Perl extension for the DBus message system 
----
Net-TFTP-0.17
http://search.cpan.org/~gbarr/Net-TFTP-0.17/
TFTP Client class 
----
PDF-OCR-1.03
http://search.cpan.org/~leocharre/PDF-OCR-1.03/
get ocr and images out of a pdf file 
----
RT-Extension-RT2toRT3-1.26_01
http://search.cpan.org/~falcone/RT-Extension-RT2toRT3-1.26_01/
This tool migrates your RT2 instance to an RT 3.x instance 
----
Speech-eSpeak-0.12
http://search.cpan.org/~hgneng/Speech-eSpeak-0.12/
Perl extension for eSpeak text to speech 
----
Task-Apache-Dependencies-0.01
http://search.cpan.org/~ski/Task-Apache-Dependencies-0.01/
installs all non-Apache prereqs for Apache 
----
Template-Trivial-0.08
http://search.cpan.org/~scottw/Template-Trivial-0.08/
Simple (yet powerful) and fast substitution templates 
----
Term-Visual-0.07
http://search.cpan.org/~lunartear/Term-Visual-0.07/
split-terminal user interface 
----
Test-Config-System-0.61
http://search.cpan.org/~iank/Test-Config-System-0.61/
System configuration related unit tests 
----
Test-Config-System-0.62
http://search.cpan.org/~iank/Test-Config-System-0.62/
System configuration related unit tests 
----
Test-Reporter-1.30
http://search.cpan.org/~fhoxh/Test-Reporter-1.30/
sends test results to cpan-testers@perl.org 
----
Tk-Wizard-2.012
http://search.cpan.org/~mthurn/Tk-Wizard-2.012/
GUI for step-by-step interactive logical process 
----
Verilog-Perl-3.010
http://search.cpan.org/~wsnyder/Verilog-Perl-3.010/
----
WebService-Reflexa-0.03
http://search.cpan.org/~zigorou/WebService-Reflexa-0.03/
Perl wrapper for Japanese assoc word search engine. (http://labs.preferred.jp/reflexa/) 
----
XHTML-Instrumented-0.05
http://search.cpan.org/~gam/XHTML-Instrumented-0.05/
packages to control XHTML 
----
XML-Encoding-2.00
http://search.cpan.org/~shay/XML-Encoding-2.00/
A perl module for parsing XML encoding maps. 
----
XML-FeedLite-1.006
http://search.cpan.org/~rpettett/XML-FeedLite-1.006/
Perl extension for fetching Atom and RSS feeds with minimal outlay 
----
XML-RAI-1.3022
http://search.cpan.org/~tima/XML-RAI-1.3022/
RSS Abstraction Interface. 
----
inc-0.01
http://search.cpan.org/~ingy/inc-0.01/
Add Named Resources to @INC 


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: Thu, 19 Jul 2007 02:11:27 -0000
From:  new2perl@gmail.com
Subject: new lines in the way
Message-Id: <1184811087.457988.327250@e16g2000pri.googlegroups.com>

Hi,

I am trying to parse a text file that looks like this:

__
VAR1=15
VAR2=16
VAR=17

FIRSTJOKE=this is my first joke.  its isnt that funny but its still
pretty good bla hbls dfd fsdf dsf sdfsd sd fdssd sdfdsf
dsfdsfsdsdfsfsd

SECONDJOKE=fdsf sdfdsf sdfdsfsdfdsfdsfdsfderew
rweeeeeeeeeeeeeeeeeeeeeeeer2 wr ewre  rewr er ewewrrewrew rewrewrew
ewrew ewr ewr er ewr ewr er ewr we rew ew
rewrewrewrewrewrererewrewrewrewrewrewrewrwerewrererewreerewrewrerererererer

THIRDJOKE=notfunny
---

My code is like this:

#!/bin/perl

#$/=undef;

$conffile = "/myarea/myconfigfile";

#read in config variables
open ( CONFIGFILE, "< $conffile" ) || die "Can't open email template:
$conffile  \n";

    while ( <CONFIGFILE> ) {
      chop;
      if (/.*=.*/) {
          ($ConfigVar, $Congif_value) = split (/=/);
           $ConfigValues{$ConfigVar}=$Congif_value;
      }

   }
close CONFIGFILE,


while ( ($k,$v) = each %ConfigValues ) {
    print "$k => $v\n";
}


# It only prints out the first line of each joke.  I played around
with $/ but not working.
# I understand that $/ is set to new line by default. So this explains
why I only get
# the first line of each joke.
# There must be a simple way to fix this?  I appreciate any feedback.
Bob


while ( ($k,$v) = each %ConfigValues ) {
    print "$k => $v\n";
}

Output:

SECONDJOKE => fdsf sdfdsf sdfdsfsdfdsfdsfdsfderew
rweeeeeeeeeeeeeeeeeeeeeeeer2 wr ewre
THIRDJOKE => notfunny
VAR1 => 15
VAR => 17
VAR2 => 16
FIRSTJOKE => this is my first joke.  its isnt that funny but its still
pretty good bla



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

Date: Wed, 18 Jul 2007 10:44:07 -0700
From:  Brian McCauley <nobull67@gmail.com>
Subject: Re: Recursively Removing Embedded Quotes
Message-Id: <1184780647.171998.86290@d30g2000prg.googlegroups.com>

On Jul 17, 3:28 pm, Buck <BuckTheManTurgid...@gmail.com> wrote:
> I have a routine that recursively removes embedded parentheses and it
> works just fine.  But when I adapt that regex to do the same thing
> with single quotes, it doesn't work.  It matches two quoted strings,
> not the inner one.
>
> E.g. the regex below
>
> '[^'']*'
>
> should match inner, but it matches left and right.
>
> '  left  '  inner  ' right '

> what am I doing wrong?

Expecting you computer to be psychic.

What is it about the sample data that indicates that it is a nested
string and not two separate strings?



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

Date: Wed, 18 Jul 2007 20:01:47 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <nfmdnUMSsbJnNAPbnZ2dnUVZ_jCdnZ2d@comcast.com>


"merl the perl" <zaxfuuq@invalid.net> wrote in message 
news:mu6dnZWZLJ8DKQDbnZ2dnUVZ_uKknZ2d@comcast.com...

> IIRC, you were the first to mention that the braces were a problem.  I 
> read aloud the names of every perl function tonight.  IIRC, abs is the 
> first and write is the last.
If that list were from 2003, would it differ from Perl, 2007?
-- 
Wade Ward




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

Date: Thu, 19 Jul 2007 00:28:32 -0700
From: "merl the perl" <zaxfuuq@invalid.net>
Subject: Re: retrieving usenet messages III
Message-Id: <Usydnalyk-fjdQPbnZ2dnUVZ_vShnZ2d@comcast.com>


<QoS@domain.invalid> wrote in message news:iXdni.7979$fj5.4837@trnddc08...
>
> "merl the perl" <zaxfuuq@invalid.net> wrote in message-id: 
> <AcednX7A-f0vwADbnZ2dnUVZ_jWdnZ2d@comcast.com>
>> I've been trying to herd usenet messages into files on my machine.
> According to new emerging NNTP standards XOVER is the preferred method
> of gathering new headers moving forward; although it would be a good idea
> to fall back to newnews <since> in the case that XOVER is not supported.
I'm not sure if that's a problem at this point.

> It would be best if you carefully parsed anything that the server sends
> back to your client, if you study the Net::NNTP debug information, you
> will notice that the messages coming from the server are denoted with
> a '<<< '.
I don't see debug information at the cpan site:
http://search.cpan.org/dist/libnet/Net/NNTP.pm
Net::NNTP=GLOB(0x18329d0)<<< 480 authentication required
Net::NNTP=GLOB(0x18329d0)>>> AUTHINFO USER zax
Net::NNTP=GLOB(0x18329d0)<<< 381 more authentication required
----> so the server asks for authentication.
Net::NNTP=GLOB(0x18329d0)>>> AUTHINFO PASS ....
Net::NNTP=GLOB(0x18329d0)<<< 281 News.GigaNews.Com
-----> have I successfully authenticated by here?

Net::NNTP=GLOB(0x18329d0)>>> GROUP comp.lang.perl.misc
Net::NNTP=GLOB(0x18329d0)<<< 211 132595 501456 634050 comp.lang.perl.misc
Net::NNTP=GLOB(0x18329d0)>>> NEWNEWS comp.lang.perl.misc 070717 073757 GMT
Net::NNTP=GLOB(0x18329d0)<<< 502 NEWNEWS permission denied (command
disabled)
-----> because by down here, I've washed out.
-- 
merl the perl




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

Date: Wed, 18 Jul 2007 17:43:51 +0200
From: "Ekki Plicht (DF4OR)" <df4or@web.de>
Subject: Re: uncleared data on serial port problem
Message-Id: <f7lcfn$mg5$02$1@news.t-online.com>

hl wrote:

> Hello all,
>       I am trying to write a simple perl script communicate with my
>       serial port.  Every one second, it will send a command to a
>       specific device(keithley 2400); and the device will response
> with
>       some data.  The problem I have right now is after the correct
> first
>       command, the code will precede the command with the previous
> data
>       from the device.

My first aasumption would be that the serial port has 'echo' turned on. If
thatis at all possible under Windows. 
Try to find out how the serial port is configured outside of Perl (way back
at DOS times that was done with the 'mode' command). 

> send: read?..
> receive: 1.82331,3.1201,8.3883,1384,0120..
> 
> this is the problem--->send: 1.82331,3.1201,8.3883,1384,0120read?..
> receive: 1.9339,3.8504,9.8383,1808,3930

If the wrong data is actually transmitted, it's probably another problem.
Then you really take the incoming data and somehow pipe it back to the
transmit buffer... however you do this :-)

Rgds,
Ekki



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

Date: 18 Jul 2007 18:36:53 GMT
From: xhoster@gmail.com
Subject: Re: XML::Twig segfault on solaris
Message-Id: <20070718143655.848$lD@newsreader.com>

Thomas Peter <braindumped@expires-31-07-2007.news-group.org> wrote:
>
> but on solaris[1] i get a "Segmentation Fault (core dumped)".
> This seg-fault appears when everything is done, the files are written
> and the very last statement in my script (print finished) is processed.

I would strace (or struss, as I think it is called on Solaris) the program
to see what is the very last system call made before the seg-fault.

If that didn't seem informative, then I'd try using POSIX::_exit to abort
the program after the print finished, and if it exits that way without
segfault, then that suggests the problem is in the END blocks or DESTROY
routines.

If that didn't narrow it down, I would remove the _exit and try adding
$SIG{SEGV}=sub {die @_};
Then running the program through the profiler (perl -d:DProf),
then dump the call tree to see what was the last thing that perl
did before triggering the SEGV handler:

dprofpp -t |tail

(The sig handler is necessary, because if Perl gets blown away by an
uncaught seg-fault then DProf might not completely write things out into
the tmon file, so dprofpp wouldn't give accurate output.)

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 V11 Issue 660
**************************************


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