[11520] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5120 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 12 14:07:21 1999

Date: Fri, 12 Mar 99 11:00:18 -0800
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, 12 Mar 1999     Volume: 8 Number: 5120

Today's topics:
    Re: 1000 thread limit? archon16@my-dejanews.com
    Re: About Mail List <cassell@mail.cor.epa.gov>
    Re: beginner problem with a test condition <juex@my-dejanews.com>
        Binary Coded Decimal ( BCD ) (Kent Kling)
        Check IP address to see if its accepting connection on  (Neil Jedrzejewski)
    Re: Check IP address to see if its accepting connection (I R A Aggie)
    Re: command-line CGI (Jonathan Stowe)
    Re: does perl discourage obfuscated code? (was Re: Perl <dhenders@cpsgroup.com>
    Re: FAQ 3.21: How can I hide the source for my Perl pro <cassell@mail.cor.epa.gov>
        how to output in the desired order? du_bing@my-dejanews.com
    Re: pearl interperter for windows <cassell@mail.cor.epa.gov>
    Re: pearl interperter for windows <alex@kawo2.rwth-aachen.de>
        perl interpreter for windows 95 ? <haantje@multiweb.nl>
        Perl, Java, Tcl/Tk, C/C++ federico_ramirez@my-dejanews.com
    Re: Perl, Java, Tcl/Tk, C/C++ (Tramm Hudson)
    Re: Perl, Java, Tcl/Tk, C/C++ <cassell@mail.cor.epa.gov>
        Perl, Tcl/Tk, Java, C/C++ federico_ramirez@my-dejanews.com
    Re: perl-to-c converter for linux? Where do I find it? (I R A Aggie)
        Printing a Copyright character <underdog@erols.com>
    Re: Problems writing data to files (Jonathan Stowe)
    Re: Problems writing data to files <cobalt@dircon.co.uk>
    Re: regexp gurus help! Parsing HTML (Tad McClellan)
        Regular expression question <thomas.wood@wichita.boeing.com>
    Re: Shopping Cart with Email Encryption? (Effie Rover)
        Unpack question (Kent Kling)
        why doesn't this script modify the actual file? (David Kirwan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 12 Mar 1999 18:11:23 GMT
From: archon16@my-dejanews.com
Subject: Re: 1000 thread limit?
Message-Id: <7cblc1$of4$1@nnrp1.dejanews.com>

In article <7c9qju$l3c$1@news.NERO.NET>,
  Dan Sugalski <sugalskd@netserve.ous.edu> wrote:
> archon16@my-dejanews.com wrote:
> : I'm playing with the Thread module...  and I was dismayed to discover a
> : limit of about 1000 threads allowed at a time (on my machine, at least.)
> : After hitting this limit, the program simply dumps core.  Does anyone know
> : of a way to get around this limitation?  (Without recompiling the Linux
> : kernel, that is.)  I really, really need to have about 30,000 simultaneous
> : threads.  (Don't ask.  I just do. ;-)
>
> IIRC, Linux creates a new process (more or less) for each thread, so you
> need to up the total # of processes allowed on the system. (I think
> there's a text file someplace you can twiddle with to do this)

That is good advice ... however, I don't own the machine I'm using.  :-( My
home machine's net connection doesn't have the necessary bandwidth for 30,000
simultaneous connections (see below).

> However.... Are you really sure you want to do this? You may find that
> Linux gets a bit cranky with that many threads. (Heck, it wouldn't
> surprise me if most OSes got cranky with a single process that had 30k+
> threads in it) It might be better to consider using a thread pool or
> something like that.

Well, then I'm stumped.  I don't see how using a thread pool would help ... I
mean, the pool itself would still be constrained by the same 1000 thread
limit, right?  Well, maybe you can think of a better way to do what I'm
doing.

Basically, I'm trying to connect to several million machines and perform a
complex dialogue with each machine.  Naturally, this means I need to open as
many simultaneous connections as possible, and it's critical that none of
them block.  This may sound daunting, but it actually only takes a couple
hours in my current implementation.  I'm currently doing this using a state
machine approach:  each connection has a state, and each time through my
program's outer loop I update the state of each connection.  However, I keep
having to add more states as I develop the program, and the transition rules
from one state to the next are growing heinously complex as I refine my
understanding of the dialogue carried out over these connections.  The
frustrating thing is that I can see how very simple the program would be to
write if I were only worrying about one connection -- no states or transition
tables, no non-blocking sockets (which never seem to work right on some
platforms), just one simple, small routine with a couple nested if's!  That's
when it suddenly occured to me that, if I were to use threads, then I could
just write that one simple small routine and hand it off to multiple threads!
 Much easier code to maintain.

But then I ran into the 1000 thread limit (which is much reduced from my
current capability of about 30,000 simultaneous connections), and now you
tell me that even if I could increase the thread limit, it still might thrash
Linux...  Well, then, I'm all out of ideas.  I guess I'll just have to stay
with the increasingly heinous state-machine implementation, unless anyone can
think of another way to do it.	Hey, if you do, let me know!

Thanks,

Archon

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Mar 1999 09:42:28 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: About Mail List
Message-Id: <36E95204.FA8F9DCC@mail.cor.epa.gov>

Eric Sze wrote:
> 
> Hi Guys, I am new in here so pls help me with this problem.
> I am planning to write a program that can update my email address
> database once I have receive a email address from the client side.
> 
> I have try to write it by myself for awhile but still cannot figure it
> out how to do it...?? Could anyone kindly tell me where can I find these
> kind of scripts.

Eric, there are a lot of Perl programs out there on the Web, but many of
them are not the best examples of programming.  I suggest that you post
some of your code here and then we may be able to help.  Since you had
the foresight not to mung your e-mail address, you should receive an
extremely helpful e-mail from gnat, telling you about a host of useful
Perlish ideas and sources.  Apply them to your programming problem, and
you may find that your difficulties clear up faster than you expected.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 11 Mar 1999 14:44:08 -0800
From: "J|rgen Exner" <juex@my-dejanews.com>
Subject: Re: beginner problem with a test condition
Message-Id: <7cbma4$mke@news.dns.microsoft.com>

<branboles@netscape.net> wrote in message
news:7c69i3$9v$1@nnrp1.dejanews.com...
> Hello all,
>
> Can someone help me out with this bit of code?  This is what I have setup:
>
> if ( $prevmedrec == ($medrec | 1) ) {
>   if ( $prevmedrec == 1 ) {
>     #do some processing
>   }
>   else {
>     #do some processing
>   }
> }
>
> The variables $medrec and $prevmedrec may contain a combination of letters
> and numbers.  What I want to happen with the outside "if/then" is if
> $prevmedrec is equal to $medrec or the character "1", then continue.  For
> some reason, this isn't currently happening.

Well, let's see:
First you are doing a bitwise "or" of a string and a number ($medrec | 1).
Hell knows what type conversions might happen there but the result will be
rather random.
And then you are numerically comparing (==) a string with that random
result.

Why don't you try the proper operators first?
You want to compare strings, so use "eq" instead of "==". Second you want to
'or' the boolean results of the individual test instead of compute a bitwise
'or' of a string and a number. So try

    if (( $prevmedrec eq $medrec) or ($prevmedrec eq "1") ) {

jue
--
J|rgen Exner





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

Date: Fri, 12 Mar 1999 18:42:30 GMT
From: kkling@tnsi.com (Kent Kling)
Subject: Binary Coded Decimal ( BCD )
Message-Id: <36e95fea.105414703@proxy.reston.tnsi.com>

Does anyone have any examples or routines that do int to bcd and bcd
to int?


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

Date: Fri, 12 Mar 1999 16:53:17 GMT
From: jed@grafx.co.uk (Neil Jedrzejewski)
Subject: Check IP address to see if its accepting connection on a port.
Message-Id: <36e9460c.11648179@news.dircon.co.uk>

Hi All,

Does anyone have a snippet of code in Perl5 that will check an IP
address to see if it is accepting connections on a certain port?

I need a variable to either be 1 or 0 for yes or no as a result.

I guess this is similar to a port scanner.

I'd appreciate a reply via e-mail as well as to the group as I've got
a dodgy newsfeed.

Regards

- Jed


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

Date: 12 Mar 1999 17:21:25 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Check IP address to see if its accepting connection on a port.
Message-Id: <slrn7eijqb.5c1.fl_aggie@stat.fsu.edu>

On Fri, 12 Mar 1999 16:53:17 GMT, Neil Jedrzejewski <jed@grafx.co.uk> wrote:

+ Does anyone have a snippet of code in Perl5 that will check an IP
+ address to see if it is accepting connections on a certain port?

>From the Net::Ping document:

         use Net::Ping;
 
         $p = Net::Ping->new();
         print "$host is alive.\n" if $p->ping($host);
         $p->close();

+ I need a variable to either be 1 or 0 for yes or no as a result.

+ I guess this is similar to a port scanner.

Nope.

+ I'd appreciate a reply via e-mail as well as to the group as I've got
+ a dodgy newsfeed.

Haven't figured out how to make slrn do that, yet...but I'll send a
copy, if I can.

James


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

Date: Fri, 12 Mar 1999 16:43:27 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: command-line CGI
Message-Id: <36e9436a.8675249@news.dircon.co.uk>

On Fri, 12 Mar 1999 11:04:32 -0500, Dave Heaney
<dave@peon.oit.umass.edu> wrote:

>I'm writing some CGI programs for work, and I would like to be able to
>test them from a command line, rather than having to test them on the
>web.  Is there any way to simulate the QUERY_STRING from the command
>line?  Thank you very much.
>

If you are using the module CGI.pm (as recommended by 9 out of 10 Perl
breeders :)  you can just run it - you will get something like:

jns [pigment] $ perl cgt.pl
(offline mode: enter name=value pairs on standard input)


and then you just enter
blah=woof
thing=garabablablah
^D

/J\


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

Date: 12 Mar 1999 11:11:24 -0600
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <87n21iws3n.fsf@camel.cpsgroup.com>

>>>>> "Greg" == Greg Bacon <gbacon@itsc.uah.edu> writes:

    Greg> See <URL:http://www.lysator.liu.se/c/pikestyle.html>

     When I first saw this I got excited thinking it had something to
     do with the pike programming language (It was written by a
     student at lysator I think). Buy that page is at:
     http://pike.idonex.se/ 

-- 
Dale Henderson <mailto:dhenders@cpsgroup.com> 

"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..."  -- G. H. Hardy


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

Date: Fri, 12 Mar 1999 09:48:39 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 3.21: How can I hide the source for my Perl program?
Message-Id: <36E95377.D6532904@mail.cor.epa.gov>

I agree with everything Ronald said, except:

Ronald J Kimball wrote:
[immense snip of insightful comments]
> though everybody knows about most of the security measures, it's not
> easy to rob a bank.

I think you meant to say that it's not 'safe' to rob a bank.  Based
on what I have seen on televison and read in the papers, it is still
painfully easy to rob a bank, although not for large amounts.  Even
people who should be elided from the gene pool have robbed banks.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 12 Mar 1999 17:32:47 GMT
From: du_bing@my-dejanews.com
Subject: how to output in the desired order?
Message-Id: <7cbj3u$m7k$1@nnrp1.dejanews.com>

Hello there,

There is an array:

%array=(age,20,gender,female,name,guest);

I need to output each attribute/value pair in the following order:

             name: guest
             age:  20
             gender: female

I tried coercing the order by running the following code:

%array=(name,guest,age,20,gender,female);
foreach $key (keys %array)
{
  print "$key: $array{$key}\n";
}

But it did not output in the desired order.  Still

              age: 20
              gender: female
              name: guest

Any idea?  Thanks in advance.

Bing

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Mar 1999 10:10:42 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
To: acores3866@my-dejanews.com
Subject: Re: pearl interperter for windows
Message-Id: <36E958A2.A70C2D83@mail.cor.epa.gov>

[courtesy cc: also sent to author]

acores3866@my-dejanews.com wrote: 
> I want to use a  Pearl  program  on my PC, but i guess i need an interperter.
> Where can i get one?

Umm, I assume you mean Perl.  I believe Pearl is also a programming language,
although not as useful.  If you want a compiled program to run your Perl 
programs on your PC, your best bet is probably www.activestate.com .  When
you download it, be sure to look over all the incredibly useful docs you get
for free.  You'll be surprised how many of your questions are already answered
and waiting for you there.

> Tank you.

You're velcome.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 12 Mar 1999 19:39:32 -0500
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: Re: pearl interperter for windows
Message-Id: <36E9B3C4.D6E57988@kawo2.rwth-aachen.de>

acores3866@my-dejanews.com wrote:
> I want to use a  Pearl  program  on my PC, but i guess i need an interperter.

Peawhat?

;-)
Alex

--
http://www.simplex.ru/pref.html


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

Date: Fri, 12 Mar 1999 17:36:46 +0100
From: "Marcel de Haan" <haantje@multiweb.nl>
Subject: perl interpreter for windows 95 ?
Message-Id: <7cbimb$dt1$1@news.news-service.com>

hello,

does anyone know if a perl excuting engine exists for windows 95/nt ?
i want to be able to test my perl scripts under this operating system.

the scripts will meant to be running when they done under linux/apache
server.

hope someone can help me.

regards,

marcel




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

Date: Fri, 12 Mar 1999 16:55:04 GMT
From: federico_ramirez@my-dejanews.com
Subject: Perl, Java, Tcl/Tk, C/C++
Message-Id: <7cbgt1$k0h$1@nnrp1.dejanews.com>



Whats is Perl main strength? Is it robust enough to be used in the
server side of client/server distributed applications?
Is Java and/or Tcl/Tk more suitable for UI development?
Is C/C++ to be used to connect to third party libraries and/or OS API's or
whenever speed and/or performance is the primary concern?

What i'm trying to find out is a generally accepted design or scheme that uses
these all or some of these technologies to develop client/server distributed
applications. Just to know where these pieces (Perl, Java, Tcl/Tk) fit in the
big picture.

Has anybody used any of these for factory automation?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Mar 1999 10:50:42 -0700
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: Perl, Java, Tcl/Tk, C/C++
Message-Id: <7cbk5i$juu@boofura.swcp.com>

In article <7cbh0m$kbe$1@nnrp1.dejanews.com>: Perl, Tcl/Tk, C/C++
In article <7cbgt1$k0h$1@nnrp1.dejanews.com>: Perl, Java, Tcl/Tk, C/C++

I like the second ordering more.  Definitly Java over Tcl/Tk.
What is this new language "C/C++" -- does it combine the worst of C
and C++?

> Whats is Perl main strength?

Its three main strengths are:

  - Powerful regexes
  - Closures with lexical scoping and deep binding (yeah!)
  - Enormous module library selection (CPAN)
  - And,

Damn!  Its four (FOUR!) main strengths are:

  - Powerful regexes
  - Closures with lexical scoping and deep binding (yeah!)
  - Enormous module library selection (CPAN)
  - Cool mascot
  - Cute red uniforms

Among Perl's many strenghts are such diverse qualities as:

  - Powerful regexes
  - Closures with lexical scoping and deep binding (yeah!)
  - Enormous module library selection (CPAN)
  - Cool mascot
  - Expressive built in types
  (And a fanatical devotion to the Pope)

> Is it robust enough to be used in the
>server side of client/server distributed applications?

How many clients?  How many TPS do you need to handle?  What sort
of servers?  Are you trying to optimize TPS with small transactions
or do you want a few TPS with enormous transactions?

>Is Java and/or Tcl/Tk more suitable for UI development?

Java's AWT as an interface?  Uhm, go for it.

If Tk suits your fancy you can get Tk bindings for Perl and write
that sort of UI code to your heart's content.

>Is C/C++ to be used to connect to third party libraries and/or OS API's or
>whenever speed and/or performance is the primary concern?

"Thou shalt use C or C++ to connect to third party libraries".  It is
certainly easier to use C, since all major libraries have C language
bindings and are designed for use with C linkage.  You can wrap them
into XS code, however and call them from Perl.

As to the speed issue, you should check out the results of _The Practice
of Programming_'s Markov chain generator.  On identical input and hardware,
the perl version took 1.0 seconds while the C++ version was 11 seconds.
Certainly, this has more to do with the crappy STL's that are shipped
with most C++ compilers.  YMMV.

>Has anybody used any of these for factory automation?

My CNC lathe just complained "Not a CODE reference".  Damn -- anyone
have another billet of aluminum?
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.266.59.96   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Fri, 12 Mar 1999 10:38:35 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Perl, Java, Tcl/Tk, C/C++
Message-Id: <36E95F2B.8668B9@mail.cor.epa.gov>

Note: this is addressed by several of the answers on perlfaq1.  Look at the
Perl FAQ, or if you have perldoc you can type 'perldoc perlfaq1' and read 
there.

federico_ramirez@my-dejanews.com wrote:
> Whats is Perl main strength? Is it robust enough to be used in the
> server side of client/server distributed applications?

Yes.  But to be fair, the other mentioned laguages are too.  Still,
robustness is only one aspect to consider.

> Is Java and/or Tcl/Tk more suitable for UI development?

In general I would prefer to start with Perl and Tk, but that's my personal
preference.  I think you'll find that the Perl implementation will usually
be faster and more maintainable than an equivalent Java implementation.

> Is C/C++ to be used to connect to third party libraries and/or OS API's or
> whenever speed and/or performance is the primary concern?

In theory, yes.  In reality, not unless you're a really good C programmer.
Bad algorithms implemented in lightning-fast code are not usually your
best choice.  Kernighan and Pike's latest book has an example comparing
C, C++, Java, Perl, and [oh rats, I can't remember!].  The Perl program
was the shortest (by far) of these, and ran 2nd fastest, behind only C. 
 
> What i'm trying to find out is a generally accepted design or scheme that uses
> these all or some of these technologies to develop client/server distributed
> applications.

I don't think there is one.  You may find that the Perlites in this newsgroup
are more rational about the use of Perl than most programmers.  But you can go
to www.perl.org and find some pages comparing Perl to several other languages.
Still, you can find people who will insist that all pieces of your app MUST
be written in their personal favorite language.  Some of them will even tell
you that you have to write everything in assembler.  (Sorry, that's an obscure 
ref to a troll in comp.lang.c)

>                Just to know where these pieces (Perl, Java, Tcl/Tk) fit in the
> big picture.

They all fit in one way or another.  Sometimes the only way to decide is to
do the comparison.  Code something up in Perl and Java and C++ and C and Tcl.
Look at how well the proggies work.  How fast are they on your different 
architectures?  How portable is the code?  I mean, *really* portable?  How
maintainable is the code?  How easily can the code be modified or extended in
future, when your users tell you that they want something different?  How
well does your code integrate with other chunks of code in your system?

In my experience (which is noticeably less than the experience of most of the
gurus in this ng), Perl is going to be a winner on a lot of these features.
Granted, I don't use Perl for everything.  We use some expensive 4GLs to do
statistical analysis and GIS work here.  But Perl also makes a good glue 
language for some of the ghastly GIS->stat->GIS->stat->GIS work we need to 
get done.  I wouldn't dream of using Java or C or C++ for that.

> Has anybody used any of these for factory automation?

I would be surprised if all of them have not been used for factory automation
*somewhere*...  Well, maybe not Java.  :-)

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 12 Mar 1999 16:57:01 GMT
From: federico_ramirez@my-dejanews.com
Subject: Perl, Tcl/Tk, Java, C/C++
Message-Id: <7cbh0m$kbe$1@nnrp1.dejanews.com>



Whats is Perl main strength? Is it robust enough to be used in the
server side of client/server distributed applications?
Is Java and/or Tcl/Tk more suitable for UI development?
Is C/C++ to be used to connect to third party libraries and/or OS API's or
whenever speed and/or performance is the primary concern?

What i'm trying to find out is a generally accepted design or scheme that uses
these all or some of these technologies to develop client/server distributed
applications. Just to know where these pieces (Perl, Java, Tcl/Tk) fit in the
big picture.

Has anybody used any of these for factory automation?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Mar 1999 16:11:13 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: perl-to-c converter for linux? Where do I find it?
Message-Id: <slrn7eifmn.4sf.fl_aggie@stat.fsu.edu>

On Thu, 11 Mar 1999 06:26:51 +0000, Scott Harvey <sbharvey@syv.com> wrote:

+ If this option/module is not available  how do you compile perl into
+ machine executable form?

You don't?

James


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

Date: Fri, 12 Mar 1999 12:11:38 -0500
From: "Dave Abramowitz" <underdog@erols.com>
Subject: Printing a Copyright character
Message-Id: <7cbi0h$jha$1@winter.news.rcn.net>

Is there a way to print the copyright character (the c inside a circle)?
Please reply to underdog@erols.com.

Thanks,
Dave




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

Date: Fri, 12 Mar 1999 16:56:18 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Problems writing data to files
Message-Id: <36e946ed.9573596@news.dircon.co.uk>

On Fri, 12 Mar 1999 16:53:52 -0000, "Paul Davies"
<cobalt@dircon.co.uk> wrote:

>I'm on Linux 2.0.36.
>
>Tried binmode but it did not work.  Another other ways to write binary data
>to a file??
>

Weeeell you shouldnt need binmode there anyhow then ...  

could you be a bit more explicit and show us some code perhaps ..

/J\


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

Date: Fri, 12 Mar 1999 16:53:52 -0000
From: "Paul Davies" <cobalt@dircon.co.uk>
Subject: Re: Problems writing data to files
Message-Id: <36e9446c.0@newsread3.dircon.co.uk>

I'm on Linux 2.0.36.

Tried binmode but it did not work.  Another other ways to write binary data
to a file??

Jonathan Stowe wrote in message <36e92509.896800@news.dircon.co.uk>...
>On Fri, 12 Mar 1999 13:43:31 -0000, "Paul Davies"
><cobalt@dircon.co.uk> wrote:
>
>>The problem is NOT file priviliges as text data works just fine.
>>
>>Paul Davies wrote in message <36e8fa1f.0@newsread3.dircon.co.uk>...
>>>I'm trying to write binary data from a variable to a file.
>>>
>>>The simple:
>>>
>>>print FILE <$var>; or print FILE $var is not working.
>>>
>
>I guess you are on some MS platform right ?
>
>binmode() your filehandle -
>
>perldoc -f binmode
>
>/J\




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

Date: Fri, 12 Mar 1999 06:31:21 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regexp gurus help! Parsing HTML
Message-Id: <9utac7.ls9.ln@magna.metronet.com>

mct@moviefone.com wrote:

: Subject: Re: regexp gurus help! Parsing HTML
               ^^^^^^             ^^^^^^^^^^^^

   You must realize that you are throwing all rigor out the
   window when you attempt to use regular expressions to
   do a real parse.

   That is, whatever you do, there will be legal HTML that it
   won't work on, or illegal HTML that it will work on, or both.

   If you don't mind a solution that works "sometimes", or if
   you are *certain* that the particular HTML that you will
   be working with doesn't use the HTML constructs that can
   break your code, then have at it!

   But know that what you are doing is a dirty hack and won't
   work for all aribitrary HTML...


: I've killed two perfectly good evenings trying to do this:


   Probably could have learned how to use a Real Parser in
   that amount of time.

   The HTML::Parser module will process HTML *much* more reliably
   than you could ever hope for with only regexen...


: INPUT TYPE="checkbox" NAME="NotListed" VALUE="Not Listed"

: Split the elements so that I can store them in an array. Like this;

: INPUT
: TYPE="checkbox"
: NAME="NotListed"
: VALUE="Not Listed"


: Please, deliver me from my mental block! Thank You!


   OK, but keep in mind that this is a dirty hack that won't 
   always work. Good Enough for messing around, but unprofessional
   and not appropriate for paid work...


---------------------------
#!/usr/bin/perl -w
use strict;

$_ = 'INPUT TYPE="checkbox" NAME="NotListed" VALUE="Not Listed"';

# all on one line
#my @parts = grep $_ !~ /^\s*$/, split /([a-zA-Z0-9.-]+(?:="[^"]*")?)/;

my @parts = grep $_ !~ /^\s*$/,          # discard elements that contain
                                         # only spaces and newline
                 split /([a-zA-Z0-9.-]+  # a "name"
                                         # wrap the whole thing in parens
                                         # so split() won't discard them
                         (?:="[^"]*")?   # optional spec of attribute value
                        )/x;

foreach (@parts) {
   print "'$_'\n";
}
---------------------------

   I could not bring myself to call the array @attributes when
   it contains non-attributes (INPUT is a Generic Identifier,
   not an attribute).


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 12 Mar 1999 16:55:21 GMT
From: Tom Wood <thomas.wood@wichita.boeing.com>
Subject: Regular expression question
Message-Id: <36E946F9.38DDAA3@wichita.boeing.com>

I am trying convert all upercase character to lowercase unless they are
quote encapsulated.

for example:

strings such as "THIS", 'THIS SENTENCE' and " THAT " would be excluded
from the conversion.

I've tried using the tr function and match and substitution operators.
I can convert the case were a single word is quoted but not multiple
words or words with leading or trailing spaces.

Any help would be appreciated.


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

Date: Fri, 12 Mar 1999 17:58:23 GMT
From: null@effierover.com (Effie Rover)
Subject: Re: Shopping Cart with Email Encryption?
Message-Id: <36ea54d5.11044189@news.iinc.com>

On Fri, 12 Mar 1999 03:51:21 GMT, mtbdude1999@yahoo.com (Brantley
Smith) wrote:

>Does anyone know of a PERL Shopping Cart program that encrypts order
>data before sending to the merchant? I'm thinking of something that
>processes orders, encrypts them with PGP or something similar, and
>emails the encrypted data to the merchant. I'm trying to get something
>more secure than normal email, but without the expense and hassle of a
>secure server. Any help would be appreciated.

My current experience with this problem:

1) You need SSL to encrypt the transaction between the customer's
browser and the server so cc info isn't being sent in the clear there.

2) You need file encryption to encrypt any order tracking files you
save to the server - this can be any encryption method that you like
and that is safe since you'll be doing any decrypting yourself.

3) If you intend to email cc info to the merchant along with the
order, you need email encryption of a type that can be integrated into
a standard clueless-user POP3 email program.

We're not having any luck with #3 - finding an alternative to PGP,
which is expen$ive. I'd be interested in hearing if anyone else has an
alternative. We're using a perl-based shopping cart with source
included, so perl-compatible solutions are preferred :-)

  -- Loy

Loy Ellen Gross AKA Effie Rover
The email address above goes straight to /dev/null :-)
effie -at- effierover -dot- com * http://www.effierover.com
Effie Rover's Fantasy Role Playing Gamer's Library
---------------------------------------------------------------
Protect privacy, boycott Intel: http://www.bigbrotherinside.org
---------------------------------------------------------------


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

Date: Fri, 12 Mar 1999 17:12:38 GMT
From: kkling@tnsi.com (Kent Kling)
Subject: Unpack question
Message-Id: <36e949e7.99778814@proxy.reston.tnsi.com>

I have a shared memory segment on a unix box that I need to read.  It
was created with the following C struct

struct {
	int numdnis;
	unsigned char dnis[1000][4];
	char cust[8];
} dialed_numbers;



shmread( $hdrid, $hdrdata, 0, $hdrsize )   
	or die "Can't read from Header shared mem $! ";

( $numdnis, @dnis, $cust ) = unpack( "I ?????? c8", $hdrdata );



I am somewhat new to perl and I am not sure what template to use so
that I can access the dnis.


I want to be able to print out the dnis like:

	print "Dnis 1 $dnis[0]\n"
	print "Dnis 2 $dnis[1]\n"


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

Date: Fri, 12 Mar 1999 17:17:28 GMT
From: DKirwan@BaltimoreInc.com (David Kirwan)
Subject: why doesn't this script modify the actual file?
Message-Id: <36e94b2b.94823108@news>

The following script only spits out the correct result to the standard output stream, i.e. the screen and not the file.

Can someone tell me why it's wrong, so I won't have to pull my hair out on Monday morning.

It's supposed to get the file name (just the root) and then use that for a search.
I think the problem has to do with the 'inplace' editing option. Not really sure.
I only started Perl today.

Thanks,
David

#!/usr/local/bin/perl -i.bak


($location) = @ARGV;
$_ = $location;

if ( /.*\/.*\w.cpp$/ ) {
    ($thefilename) =/.*\/(.*\w).cpp$/ ; 
   # print ("figured out the name of the file: ", $thefilename , "\n");
}

open (SRCFILE, $location) || die "couldn't open : $location\n";
#print {SRCFILE} "some shit";
while (<SRCFILE>) {

    print;

    if (/\$thefilename::$thefilename/) {
	$line = 0;
    }
    elsif (/^\s*{\s*$/ && $line == 1) {
	print "         CONSTRUCTOR\n";
    }
    $line++
}

----
David Kirwan
Senior Software Engineer
Baltimore Technologies
Global e-security


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5120
**************************************

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