[25228] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7473 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 2 00:10:33 2004

Date: Wed, 1 Dec 2004 21:10:09 -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           Wed, 1 Dec 2004     Volume: 10 Number: 7473

Today's topics:
        POST'ing XML from VB ASP to Perl (Bob)
    Re: POST'ing XML from VB ASP to Perl <spamtrap@dot-app.org>
    Re: Problem parsing tcpdump tcp[13] output (Michael Fuhr)
    Re: Sockets, gui, threading questions <billyray@REVERSE-THISbbthgisni.moc>
    Re: Sockets, gui, threading questions <apeiron@coitusmentis.info>
    Re: split function syntax <1usa@llenroc.ude.invalid>
    Re: split function syntax <tadmc@augustmail.com>
    Re: Transiting from Perl: Learn Python or Ruby? <ceo@nospam.on.net>
    Re: What is 1; <makbo@pacbell.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 1 Dec 2004 18:49:23 -0800
From: schoeby@yahoo.com (Bob)
Subject: POST'ing XML from VB ASP to Perl
Message-Id: <17fbd518.0412011849.492cfc72@posting.google.com>

I have a client that is trying to post XML data to my Perl script
using the following VB code and I am having difficulty getting the XML
data.  I do not see it in the normal ENV.  My side is an apache server
running mod_perl.  I have run tcpdump and can see the XML is making it
to my server.  I have no control over the VB code.  Can anyone point
me in the right direction?  I have looked into HTTP::Request but I can
not seem to make it work properly.


-------VB CODE-------
<%
        Set objdom = CreateObject("Microsoft.XMLDOM")
        objdom.async = False
        objdom.Load ("d:\inetpub\wwwroot\myxml.xml")

        destination = "http://myserver.com/cgi-bin/XMLReceive.pl"
        Set http = CreateObject("MSXML2.ServerXMLHTTP")
        With http
            .Open "POST", destination, False
            .send objdom
        end with

%>
-------END VB CODE-------


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

Date: Wed, 01 Dec 2004 22:08:42 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: POST'ing XML from VB ASP to Perl
Message-Id: <duKdnS5sJZ2nGjPcRVn-1A@adelphia.com>

Bob wrote:

> I have a client that is trying to post XML data to my Perl script
> using the following VB code and I am having difficulty getting the XML
> data.  I do not see it in the normal ENV.  My side is an apache server
> running mod_perl.  I have run tcpdump and can see the XML is making it
> to my server.  I have no control over the VB code.  Can anyone point
> me in the right direction?  I have looked into HTTP::Request but I can
> not seem to make it work properly.

I don't do VB, so I'm unclear on what this example is doing exactly.

Is it using a standard HTTP post, like a browser would do when 
submitting an HTML form? If that's the case, you need to use either 
CGI.pm or (since you're using mod_perl) Apache::Request. Looking in %ENV 
and trying to parse what you find there is *not* the "normal" way to 
parse form data. Using one of the standard modules is.

If the VB is sending something via XML-RPC, it looks like there's a CPAN 
module that will help with that too: Apache::RPC::Server. I haven't used 
it though, so I can't help you with it.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 1 Dec 2004 20:26:05 -0700
From: mfuhr@fuhr.org (Michael Fuhr)
Subject: Re: Problem parsing tcpdump tcp[13] output
Message-Id: <41ae8b4d$1_1@omega.dimensional.com>

romain.lorenzini@laposte.net (Romain) writes:

> $command = 'tcpdump -vvni eth0 tcp[13] == 18'

There are a couple of things wrong here (aside from the fact that
the code you posted doesn't run, as Tad already pointed out).  You
can discover one problem by executing "touch tcp1" and then running
the script without changing directories.  That you haven't already
hit this bug is luck.

You can find the second problem by running the tcpdump command from
the shell prompt and make a connection that tcpdump should show,
then run the same test again but pipe tcpdump's output into cat.
If you see a difference in behavior then read the tcpdump manual
page and look for a solution.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

Date: Thu, 02 Dec 2004 02:20:49 GMT
From: Billy Ray Padgett <billyray@REVERSE-THISbbthgisni.moc>
Subject: Re: Sockets, gui, threading questions
Message-Id: <pan.2004.12.02.02.20.05.811880@REVERSE-THISbbthgisni.moc>

On Wed, 01 Dec 2004 21:34:31 +0000, Dad wrote:

> I'm really new to Perl so any help or direction on where to look is
> welcomed.
> 
> I used the server example from the Perl Cookbook and modified it to accept
> SNMP trap messages from a Linksys router on UDP port 162, process the
> message as inbound, outbound, or unknown and store in the appropriate
> mysql database table.  I want to add a gui to the application and display
> real-time statistics about traffic, etc.  I used QTDesigner to build the
> gui seprately and puic to create the final Perl code.  The gui now works
> great but only without the "server" code to get/process the traps.  I'm
> using IO::Socket for the network interface.
> 
> My problem seems to be the while ($sock->receive($trap,$MAX)) loop is
> blocking and the program hangs until a trap comes in and the buttons on
> the gui are essentially useless.  Is there a better way to handle incoming
> udp messages?  How can I multi-thread so that the gui continues to
> function and the displays are updated when a message is received?  Is
> there a call-back feature I can use?
> 
> Thanks,

Maybe you can find yourself an answer in BVA's tutorial!


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

Date: 2 Dec 2004 03:26:58 GMT
From: Christopher Nehren <apeiron@coitusmentis.info>
Subject: Re: Sockets, gui, threading questions
Message-Id: <slrncqt2s2.2kf0.apeiron@prophecy.dyndns.org>

On 2004-12-02, Billy Ray Padgett scribbled these
curious markings:
> Maybe you can find yourself an answer in BVA's tutorial!

*snarf*

 ... thankfully, I wasn't drinking anything.

-- 
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated".  -- Ken Thompson
Linux: "How rebellious ... in a conformist sort of way."
Unix is user friendly. However, it isn't idiot friendly.


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

Date: 2 Dec 2004 01:29:29 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: split function syntax
Message-Id: <Xns95B2D0742D58Aasu1cornelledu@132.236.56.8>

mohammad.munir@gmail.com (Mostafa) wrote in
news:c3c09310.0412011124.6e6caa03@posting.google.com: 

[ Snipped full-quote of previous message. Don't do that. Please read the 
posting guidelines for comp.lang.perl.misc ]

> but i am getting some warnings , how can i get rid of this warnings .
> i also add following codes with my program ---
> use strict;
> 
> my %Name;
> my %Phone;
> my %Email;
> my $name;
> my $number;
> my $email;
> my $address;
> 
> 
> i am giving u the list of warnings for the line 17,18,19. i add those
> lines right  below the warnings.------
> 
> C:\mp>perl customer.pl
> Use of uninitialized value in hash element at customer.pl line 17,
> <PH> line 2.

What is the point of posting a bazillion lines of essentially the same 
warning without posting the actual runnable code that is producing it 
along with a sample of the data? 

Please read the posting guidelines for help on formulating your questions 
so as to elicit useful answers.

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Wed, 1 Dec 2004 20:29:07 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: split function syntax
Message-Id: <slrncqsvfj.8r0.tadmc@magna.augustmail.com>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> mohammad.munir@gmail.com (Mostafa) wrote in
> news:c3c09310.0412011124.6e6caa03@posting.google.com: 
> 
> [ Snipped full-quote of previous message. Don't do that. 


Because it will get you killfiled.

That's what I did when I saw it.


>> i am giving u the list of warnings 
               ^
               ^

> Please read the posting guidelines 


And use actual English.


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


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

Date: Thu, 02 Dec 2004 04:24:11 GMT
From: ChrisO <ceo@nospam.on.net>
Subject: Re: Transiting from Perl: Learn Python or Ruby?
Message-Id: <LNwrd.36632$Qv5.722@newssvr33.news.prodigy.com>

Goh, Yong Kwang wrote:
> Hi.
> 
> I've got this problem which may of us could have faced before. I must
> first emphasize that I'm not trying to provoke any kind of unnecessary
> debates over which language is better.
> 
> Let me explain my situation and why I'm trying to move away from Perl
> for a particular application I'm developing. I've got an application
> that I've built to automate the updating and generation for my
> personal web site (text replacement and templating task) and I've
> added in features such as incremental build (not re-generating files
> that are not modified), automatic organization of files and
> contemplating FTP upload feature. Hence it has grown from a 100 lines
> script to 700+ lines file. In a way, it has outgrown Perl, which seems
> to be getting less suitable for it. Making it object-oriented seems to
> be the solution to the overly long and complex program.
> 

Some have already commented that this is not a problem with Perl but a 
problem related to style and initial development.  It sounds a lot like 
a refactoring issue to me, which I'll admit isn't always as easy to do 
in Perl as I would like at times.  But then again, from looks of 90% of 
the Perl code I see, I'd say it's not usually Perl; it's the programmer 
trying to use it (most of the present company excluded since most 
posting here are pretty decent Perl coders, IMO.)  In most languages, 
any future refactoring effort is certainly affected by the design and 
implementation of initial effort.  But your issue sounds like a 
refactoring issue since you're initial effort has grown to 7x its 
original size.

> But Perl's approach to OO is making the program messy and hard to read
> as well, using a lot of arcane manipulation of @ISA and shift and
> unshift for methods' parameters, clever but hard-to-read references
> for class variables. It's support for OO looks more of clever hack and
> a temporary ugly workaround rather than a consistent, clean and
> elegant syntax for OO. I know this sounds offensive to Perl fans out
> there but just my personal opinion, I may be wrong. Perhaps Perl 6
> will address all these but I've yet to go check it up yet.
> 

It's not "offensive" and I'll be the first to admit Perl's OO approach 
is a bit "forced."  But again, I've seen plenty of so called "Perl OO 
code" that could have been written much better within the confines of 
Perl itself, my own code included.

> Not saying that Perl is bad and Python or Ruby is better. Nope that's
> not my point. Perl is good for a quick, and short script that you want
> to hack up in an hour to do something useful; hence flexibility in its
> syntax is its strength. But for larger program which demands code to
> be easily comprehensible and clean, Perl's flexibility becomes its
> liability.

A while back, I contemplated making a shift to Ruby and asked a question 
concerning moving from Perl to Ruby over in comp.lang.ruby and got a 
very insightful thread going:

http://groups.google.com/groups?hl=en&lr=&threadm=8x%251d.2604%24Qv5.529%40newssvr33.news.prodigy.com&rnum=4&prev=/groups%3Fq%3Dperl%2Bruby%2Bchris%2Bgroup:comp.lang.ruby%26hl%3Den%26lr%3D%26selm%3D8x%25251d.2604%2524Qv5.529%2540newssvr33.news.prodigy.com%26rnum%3D4

I think you'll find that Ruby refactors much more nicely and quickly 
than Perl and I consider it an excellent choice for Perl replacement. 
My one lone stike against Ruby is still that I can code in Perl much 
quicker, even in OO, than I can in Ruby (which is *entirely* OO -- you 
don't have a choice), and I just can't afford to take the time to get as 
up-to-speed in Ruby as I am in Perl.  (Time is $$$.)  But Ruby is an 
incredible language, esp. for what you say you need to accomplish.  I 
can't say that it's better than Python because I know very little about 
Python (I've probably written a total of 100 lines of Python ever).  But 
from the feedback I've gotten (esp. in the thread above), I'd give Ruby 
the nod over Python; it's really super nice.

--ceo


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

Date: Thu, 02 Dec 2004 03:46:32 GMT
From: Mark Bole <makbo@pacbell.net>
Subject: Re: What is 1;
Message-Id: <sewrd.27278$zx1.1223@newssvr13.news.prodigy.com>

KKramsch wrote:
> The use of 1 (or any other Perl true value)[..]
 > The reason is that when I run a program in the Perl
> debugger quite often it happens that even when I issue a debugger
> command such as "c 50" the debugger will advance the program up to
> line 50, but instead of stopping, it executes line 50 and proceeds
> past it without stopping.  I've never understood why this is, but
> I've found that if I insert a line such as
> 
> 1;
> 
> right before (the former) line 50, then "c 50" does bring the
> program up to line 50 (i.e. the new "1;" line) and no further, as
> desired.  Klugey and clueless but functional.  If there's a more
> civilized way to deal with this situation I'd love to hear about
> it.
> 
> 	Karl
> 

Hmm, I've never had this experience, even since version 4.  The line 
referenced by "c" in debugger has to be executable, no?

-mark bole



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

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


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