[6767] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 392 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 29 16:17:11 1997

Date: Tue, 29 Apr 97 13:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Apr 1997     Volume: 8 Number: 392

Today's topics:
     Re: 'C' structure passing (Andreas Schmidt)
     Beeping sound when use cgi/perl script with apple mac (Robert Davis)
     Changing FORMAT filehandles - <mcmurry@openmarket.com>
     Re: Extracting pseudo HTML from string (Matthew Cravit)
     Re: Genetic programming (revisited) (Bennett Todd)
     handling runtime errors <stephen+usenet@farrell.org>
     MacPerl <-> text editor? (Adam Schneider)
     Milli-second timer <pjones@glenayre.com>
     Need URL Encode and Decode Functions <micah@db.com>
     Need URL Encode and Decode Functions <micah@db.com>
     Re: Network Programming and Sockets (Neil Briscoe)
     Re: Notice to antispammers <usenet-tag@qz.little-neck.ny.us>
     Re: Notice to antispammers <rsi@lucent.com>
     Re: Notice to antispammers <rsi@lucent.com>
     Re: Notice to antispammers <togtog@writeme.com>
     Re: Object IDs are good ( was: Object IDs are bad ) (Patrick Doyle)
     Re: Object IDs are good ( was: Object IDs are bad ) (Patrick Doyle)
     Re: Perl auto-replier (Neil Briscoe)
     Re: PERL Editor (Luigi Mattera)
     Re: Perl5 script on sunOS 4.x and Solaris 2.x <pcunnell@csfp.co.uk>
     Re: Pointing a Filehandle _AT_ a Subroutine (Andy Wardley)
     Re: pre-RFD: comp.lang.perl.{data-structure,inter-proce <rra@stanford.edu>
     Problem with CGI form processing <sondrejw@stud.hitos.no>
     Signal processing in Perl <paula@cta-challenge.com.au>
     Re: Signal processing in Perl <eryq@enteract.com>
     Syntax checking? (TCM Online)
     Windows 95 and FTP <joey@Sun.COM>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Apr 1997 18:36:35 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
To: ohlund@industry.net
Subject: Re: 'C' structure passing
Message-Id: <5k5f3j$5h1$1@nz12.rz.uni-karlsruhe.de>

In article <33661599.33DE@industry.net>, Mark Ohlund <ohlund@industry.net> writes:
|> I have a 'C' application which has defined a type XLong as:
|> 
|> typedef struct XLong {
|> 	long high;
|> 	long low;
|> } XLong;
|> 
|> I'm trying to pass this back to Perl and I can't figure out what entry
|> to put in the 'typemap' file for the XS compiler. Anyone have any ideas
|> about this?
|> 
|> Please reply to ohlund@netsinc.com. Thanks.
|> 
|> ~Mark.
|> 

hi mark,

for a c-struct there exists predefined types in the perlobject.map file from
the CookBook examples on the CPAN server. you can use O_OBJECT or T_OBJECT
for blessed/unblessed objects. an example how this works exactly can be seen 
in the CookBookA example Ex1 of this tutorial.

the two types are defined as follows:

OUTPUT

O_OBJECT
        sv_setref_pv( $arg, CLASS, (void*)$var );

T_OBJECT
        sv_setref_pv( $arg, Nullch, (void*)$var );


INPUT

O_OBJECT
        if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
                $var = ($type)SvIV((SV*)SvRV( $arg ));
        else{
                warn( \"${Package}::$func_name() -- $var is not a blessed SV reference
\" );
                XSRETURN_UNDEF;
        }

T_OBJECT
        if( SvROK($arg) )
                $var = ($type)SvIV((SV*)SvRV( $arg ));
        else{
                warn( \"${Package}::$func_name() -- $var is not an SV reference\" );
                XSRETURN_UNDEF;
        }


hope that helps and good luck
smiff

========================================================================
andreas schmidt                                email: schmidt@iai.fzk.de 
institut fuer angewandte informatik (iai)        phone: +49 7247 82 5714
forschungszentrum karlsruhe gmbh
    - technik und umwelt -       
postfach 3640                                  76021 karlsruhe (germany)




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

Date: 29 Apr 1997 19:17:01 GMT
From: rjdavis@bhl3hc9.bnr.co.uk (Robert Davis)
Subject: Beeping sound when use cgi/perl script with apple mac
Message-Id: <5k5hfd$7qv@bcrkh13.bnr.ca>


Hi,
  I have written a cgi perl script which processes input from
  a HTML form in a web browser.
  
  This works fine on HP (HPUX) workstations. It also works
  an apple mac, but after the form has been processed,
  a succession of about 50 beeps is sounded.
  
  Has anyone else experienced this problem?
  
  Could someone tell me how to solve this problem?
  
  Please e-mail me at rjdavis@nortel.ca as well
  as posting to the newsgroup.
Regards, Rob Davis.


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

Date: Tue, 29 Apr 1997 13:06:45 -0400
From: John McMurry <mcmurry@openmarket.com>
Subject: Changing FORMAT filehandles -
Message-Id: <33662AA5.2A0F@openmarket.com>


I am attempting to change the format that 
STDOUT uses so that a HEADER can be written.


I have:

format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<  @<<<<<<<<<<<<<<<<<<<<<
$data1 ,                 $data2
 .

format HEADER =
FILENAME: @<<<<<<<<<<<<<<<<<<<<<<<<<<<
 .

I keep getting err msg about trying to write to
a closed file handel.

if ( $HEADER ) {
	select (HEADER) ;
	write HEADER ;
}
else {
	select (STDOUT);
	write STDOUT ;
}

Any insights would be appreciated.

Thanks.
John McMurry


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

Date: 29 Apr 1997 10:28:25 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Extracting pseudo HTML from string
Message-Id: <5k5b3p$hff@shell3.ba.best.com>

In article <5k4v78$52h@intra.icma.org>,
Todd Wallace <twallace@nicom.com> wrote:
>
>I have a string that looks like 
>"asdfafasdf<FNAME>Tom</FNAME>sdfsdfsfsd"
>and I want to extract the text between the <FNAME> and </FNAME> tags.

Regular expressions are your friend here. :) The following code will
do what you are asking. (And, yes, I know, there's probably several more
compact ways of writing it, but this way it's (at least, I think) clear 
what is going on:

	#!/usr/bin/perl
	$string = "asdfafasdf<FNAME>Tom</FNAME>sdfsdfsfsd";
	if ($string =~ /<FNAME>(.*)<\/FNAME>/)
	{
	        $result = $1;
	}
	print "Result: $result\n" if $result;

Hope this helps.

/MC
-- 
--
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: 29 Apr 1997 14:15:37 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Genetic programming (revisited)
Message-Id: <slrn5mc0k8.n6q.bet@waltz.rahul.net>

On 29 Apr 1997 09:05:52 -0400, Zachary Brown <zbrown@lynx.dac.neu.edu> wrote:
>[...] Perl is an ideal genetic programming environment.

I'm not so sure about that. It seems to me like the sort of algorithms
you're interested in will fare poorly in an environment where compilation is
expensive. At a guess, the best high-level language would be Scheme, for which
compilation is cheap.

I'm imagining a program that is repeatedly mutating and re-running a patch
of code, evaluating the results based on some heuristic. In this setting, a
language with perl's rich depth of arcane little special cases won't be a
benefit, quite the contrary; and I'd expect it to run hundreds or thousands of
times slower than Scheme, where the language itself is syntactically trivial,
deliberately identical to its standard data structure, and where "compilation"
is very little more than a several-machine-instructions-per-input-character
lexical analysis.

-Bennett


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

Date: Tue, 29 Apr 1997 19:40:22 GMT
From: stephen farrell <stephen+usenet@farrell.org>
Subject: handling runtime errors
Message-Id: <87zpuhk47t.fsf@phaedrus.uchicago.edu>


i'm interested in handling all runtime errors.  i have a class which
copes with errors the way i want it to.  currently, it has to be called
for each error.  so, for example, it has a method called assert(),
another called oops(), and so on.

the problem is that it doesn't know how to catch "real" problems --
i.e., ones that i haven't thought of.  typically, these are of two
varieties (though i might notice others in the future):

1. invalid method names
2. attempt to call a method from a unblessed/nonexistent reference 
"Can't call method "foo" without a package or object reference at ..."

now, i've looked in the FAQ and found i can use AUTOLOAD to catch #1.
but any way to catch #2?

is there a more universal way of handling all perl show-stopper
errors?

thanks,
	steve farrell


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

Date: Tue, 29 Apr 1997 13:12:30 -0600
From: acs@bitstream.net (Adam Schneider)
Subject: MacPerl <-> text editor?
Message-Id: <acs-2904971312300001@port117.bitstream.net>

I just installed MacPerl 5 (I'd been using version 4).  My text editor of
choice is Tex-Edit 1.8.5, and I'm getting a "Tex-Edit" menu in MacPerl,
but when I select the items under that menu (Edit... or Update...), all
that happens is that Tex-Edit is opened.  I thought the script I was
currently working on in MacPerl would be opened in my editor.

I can't find ANY mention of this menu in any of the MacPerl 5 notes, so I
can't begin to figure out why it doesn't work.  I'd love to be able to use
this Edit/Update feature, because MacPerl's editor leaves a lot to be
desired.

Thanks in advance for any help!


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Adam Schneider * schneider@pobox.com * http://pobox.com/~schneider/adam.html
Co-author of "The Web Server Handbook": http://www.prenhall.com/~palmer/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


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

Date: Tue, 29 Apr 1997 11:37:56 -0700
From: Pam Jones <pjones@glenayre.com>
Subject: Milli-second timer
Message-Id: <33664004.79FF@glenayre.com>


I am writing a load-testing program and need to time my calls in
milli-seconds (or at least something smaller then seconds). I am using
5.003 on a Sun Sparc 5, Solaris 2.5

Any and all ideas would be greatly appreciated

Thanks

Pam


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

Date: Tue, 29 Apr 1997 12:53:42 -0400
From: Micah <micah@db.com>
Subject: Need URL Encode and Decode Functions
Message-Id: <33662794.D7A6991A@db.com>


Does anyone know where I can get the functions that encode and
decode URL's ?

Many thanks in advance.

Micah

--
_________________________________________________________________________

: Datacraft Systems, Inc.-Data-Driven Web Sites! Top Quality Web Hosting

: URL: http://www.db.com  - Multi-user Database Development and Design
: On-line Database Systems - Web Catalog Stores - Package Priced Options

: Tel 609.227.0202 Fax 609.374.1704  (mailto:micah@db.com)



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

Date: Tue, 29 Apr 1997 12:54:20 -0400
From: Micah <micah@db.com>
Subject: Need URL Encode and Decode Functions
Message-Id: <336627BC.ABD692B0@db.com>


Does anyone know where I can get the functions that encode and
decode URL's ? (im new to perl btw)

Many thanks in advance.

Micah

--
_________________________________________________________________________

: Datacraft Systems, Inc.-Data-Driven Web Sites! Top Quality Web Hosting

: URL: http://www.db.com  - Multi-user Database Development and Design
: On-line Database Systems - Web Catalog Stores - Package Priced Options

: Tel 609.227.0202 Fax 609.374.1704  (mailto:micah@db.com)



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

Date: 29 Apr 1997 19:08:57 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Network Programming and Sockets
Message-Id: <memo.19970429200913.23725B@skep.compulink.co.uk.cix.co.uk>

In article <3364E172.2CA9@sysdeco.no>, lpa@sysdeco.no (Luca Passani)
wrote:

> Actually, I think I understand the spirit of the first poster.
>  I have the Camel5 and Unix Network Programmin by R. Stevens.
> The latter is full of C code and it really takes hard studying to get
> into it (which I still haven't).
>  I wanted to see how things worked in Perl and (even though I managed to
> make a nice server which helps me debug a parser) I think that
> Perl only adds a very thin layer on the original C-TCP/IP interface.

Oh, I understood the spirit of his posting, but that isn't going to help
him when he's battling down the wrong path.

Take it from one who has battled down many a wrong path - its really nice
when someone takes the time to explain without *just* pointing you at some
manual.

> I wonder if:
>
> 1) wouldn't it be possible for Perl to offer some higher-level interface
> to TCP/IP (even Socket.pm requires a rather deep understanding of
> C/TCP/IP stuff)
>

You're correct, of course, socket.pm doesn't add much - and thats good -
because it enables those from a Perl background to suss C should they need
it, and vice versa.

Oh, I can program in C - but I prefer to have code there that needs
modifying.  I can write something from scratch in Perl.  That explains, to
my mind, the subtle differences between the two.

> 2) The Camel shouldn't explain more about how the server and the client
> really work in the examples. This could turn out to be an introduction
> to Network programming for many.
>

How thick a camel do you want?  Before I gave away my old Camel to a
friend - who is now a Perl aficionado [and rushed out and bought the
second hump on Saturday] - I had both the old and new Camel's to hand.  I
was surprised by how the new book was both thicker, and a larger format.
That much has been added to Perl over the years.  Trying to make it into a
tutorial for [Unix] network programming too will add another half an inch
or so.  I think not.  Better that *specific* subject be handled by other
tomes.

Regards
Neil
 



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

Date: 29 Apr 1997 17:27:37 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Notice to antispammers
Message-Id: <5k5b29$5ue$1@news.netusa.net>


Rajappa Iyer  <rsi+usenet@earthling.net> wrote:
>How long have I been sleeping? Who died and put you in charge of the
>Usenet? The only legitimate responses you can have to *POSTS* with

This gets debated in news.software.readers regularly. Tom is not
alone in his feelings.

>un-replyable mail addresses is to either not reply at all or just
>follow up. Period.

I now follow the policy that any mail I try to send which bounces
will not be resent. Even if the bounce is of the form: "I don't
know who you are. Please put xyzzy in the subject to send me mail"
they are not going to hear from me. If they don't want email,
fuck 'em, they shouldn't be asking people to help them with their
problems for free.

>The fact that people are taking the trouble to munge their From:
>addresses should indicate to you the magnitude of the spamming problem
>and the fact that courtesy copies sent by mail are not really
>perceived as being very courteous.

All it indicates to me is that many people have very crude ways
to filter their mail which put the brundt of the work on those they
ask favors of. Like you, I use a usenet mail address and I have
made a considerable effort to help others do the same (see my
nearly ready for 1.0 FAQ:
<URL:http://www.netusa.net/~eli/faqs/addressing.html>). People
who still wish not to receive my email can live their precious
isolated lives.

Elijah
------
echo '"|cat >/dev/null"' > ~/.forward # for 100% spam-free email


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

Date: 29 Apr 1997 13:30:11 -0400
From: Rajappa Iyer <rsi@lucent.com>
Subject: Re: Notice to antispammers
Message-Id: <xnyu3kphh3w.fsf@placebo.hr.lucent.com>

Tom Christiansen <tchrist@mox.perl.com> writes:

>  [courtesy cc of this posting sent to cited author via email]

Not a courtesy.

> In comp.lang.perl.misc, rsi@lucent.com writes:
> :Whatever you do, stop acting like you own comp.lang.perl.misc or the
> :mailboxes of people who post there. No matter how useful your
> :contributions are, you do not.
> 
> Bye.

Not an answer.
-- 
Rajappa Iyer <rsi+usenet@earthling.net>	   #include <std_disclaimer>
	They also surf who only stand on the waves.


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

Date: 29 Apr 1997 13:54:08 -0400
From: Rajappa Iyer <rsi@lucent.com>
Subject: Re: Notice to antispammers
Message-Id: <xnysp09hfzz.fsf@placebo.hr.lucent.com>

Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:

> Rajappa Iyer  <rsi+usenet@earthling.net> wrote:
> >How long have I been sleeping? Who died and put you in charge of the
> >Usenet? The only legitimate responses you can have to *POSTS* with
> 
> This gets debated in news.software.readers regularly. Tom is not
> alone in his feelings.

Sure... and if all Tom said was "This really pisses me off" I would
have no argument. But when he threatens to hand addresses on a platter
for spambots to harvest, he oversteps a line.

> >un-replyable mail addresses is to either not reply at all or just
> >follow up. Period.
> 
> I now follow the policy that any mail I try to send which bounces
> will not be resent. Even if the bounce is of the form: "I don't
> know who you are. Please put xyzzy in the subject to send me mail"
> they are not going to hear from me. If they don't want email,
> fuck 'em, they shouldn't be asking people to help them with their
> problems for free.

That's your privilege and no one is asking you to persist in
contacting someone who doesn't want to be contacted. On the other
hand, I fail to see why you feel compelled to mail your response. I
mean, the whole point of the newsgroup is so that all participants can
discuss relevant topics. Why did people suddenly *have* to send mail?
Whatever happened to just following up on the newsgroup?

> >The fact that people are taking the trouble to munge their From:
> >addresses should indicate to you the magnitude of the spamming problem
> >and the fact that courtesy copies sent by mail are not really
> >perceived as being very courteous.
> 
> All it indicates to me is that many people have very crude ways
> to filter their mail which put the brundt of the work on those they
> ask favors of. 

Excuse me, but who tapped you on your shoulder and asked you for a
favor?  The whole point of posting on the net is that if someone is so
inclined, s/he may, of his/her own, free will, respond. Nice of you to
help out really and it is most appreciated, but please don't look for
medals. And if you really want to help, why don't you just post your
follow up instead of insisting on sending a Cc by mail?

> Like you, I use a usenet mail address and I have
> made a considerable effort to help others do the same (see my
> nearly ready for 1.0 FAQ:
> <URL:http://www.netusa.net/~eli/faqs/addressing.html>). People
> who still wish not to receive my email can live their precious
> isolated lives.

That's fine... but people who do not wish to receive your email may
not consider themselves isolated or diminished for that lack. So long
as you go about doing whatever you want in a way that doesn't affect
my mailbox, I can't and won't complain.
-- 
Rajappa Iyer <rsi@lucent.com>	   #include <std_disclaimer.h>
	They also surf who only stand on the waves.


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

Date: Tue, 29 Apr 1997 15:24:59 -0300
From: Paul Ramsey <togtog@writeme.com>
Subject: Re: Notice to antispammers
Message-Id: <33663CE8.4F60@writeme.com>

> People who use invalid email addresses to thwart spammers have made
> a decision to shift their problem of wanting to avoid spam from
> themselves to the persons who want to legitimately correspond with
> them.  They have decided that the inconvenience to spammers
> outweighs the inconvenience to legitimate users, and they have
> decided on this without regard to the legitimate users.

I for one, think Tom is an asshole. I have an unlisted phone number, why
do I have one? Because I don't want people I don't know to eMail me or
people calling me to say "Would you like to get USA Today for $5 off?".

I use fake eMail addresses some times, why do I use fake addresses?
Because I don't want people I don't know or people trying to sell
something to mail me. I pay $20 a month for MY eMail, Tom doesn't pay me
a penny for My eMail address. I can do what ever I damn well please with
it as long as I don't break the law with it.

I can already sue spammers $500 for each message, I haven't had to yet,
I complain to there ISP and the ISP stops me from getting anything from
them. I wonder what I can do about a person helping spammers...


Side note: If you get spam eMails then just forward a copy of the
message to the spammer and to his/her ISP and Include the text below at
the top of the message...

------------------
Offence under US code Title 47, Sec 227(b) (1) (C)
I have recently received UNSOLICITED and UNWANTED junk e-mail from an
individual who appears to be using your site.  A copy of that mail is
attached herewith.  Junk Mail is now regarded as the same as unwanted
and unsolicited junk faxes and telemarketing calls - all of which are
now ILLEGAL under US federal law:

     By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
     meets the definition of a telephone fax machine. By Sec.227(b)
     (1)(C), it is unlawful to send any unsolicited advertisement to
     such equipment, punishable by action to recover actual monetary
     loss, or $500, whichever is greater, for EACH violation.

Please ensure this is stopped NOW.  You have been put on notice.  If you
confirm to me promptly that effective action has been taken against
those
persons responsible, I will not take the matter further on this
occasion.

If you do not provide me with such confirmation in a timely manner, or
if
ANY further UNSOLICITED or UNWANTED junk mail should be received from
your
site, I will instruct my attorney to issue a writ WITHOUT FURTHER
NOTICE,
and the matter will then be pursued under federal law.  I will
separately
notify your upstream providers as they may also be liable for violations
originating from your site.

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


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

Date: Tue, 29 Apr 1997 18:11:24 GMT
From: doylep@ecf.toronto.edu (Patrick Doyle)
Subject: Re: Object IDs are good ( was: Object IDs are bad )
Message-Id: <E9Evv0.I8z@ecf.toronto.edu>

In article <5k1j3f$fp3@roar.cs.utexas.edu>,
Paul Wilson <wilson@cs.utexas.edu> wrote:
>In article <E9AxB1.7nA@ecf.toronto.edu>,
>Patrick Doyle <doylep@ecf.toronto.edu> wrote:
>>
>>I think if a language has the concept of mutability, then it should also
>>have the concept of object identity because both the cases presented in
>>the previous paragraph are very useful in different curcumstances.
>>
>>Of course if a language has no mutability, then object identity is
>>unnecessary.
>
>I'm not sure that even the latter is right.  It seems to me that it
>can be reasonable to use object identity to represent conceptual-level
>identities, even in purely functional programs.

  Can you give an example of two immutable objects, alike in every way,
which need to be distinguished?

 -PD
-- 
--
Patrick Doyle
doylep@ecf.utoronto.ca


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

Date: Tue, 29 Apr 1997 18:09:36 GMT
From: doylep@ecf.toronto.edu (Patrick Doyle)
Subject: Re: Object IDs are good ( was: Object IDs are bad )
Message-Id: <E9Evs1.I4D@ecf.toronto.edu>

In article <izpvvgcn5a.fsf@mocha.CS.Princeton.EDU>,
Matthias Blume <blume@mocha.cs.princeton.edu> wrote:
>In article <E9AxB1.7nA@ecf.toronto.edu> doylep@ecf.toronto.edu (Patrick Doyle) writes:
>
>   In article <izhggvrukk.fsf@mocha.CS.Princeton.EDU>,
>   Matthias Blume <blume@mocha.cs.princeton.edu> wrote:
>   >
>   >   - Things that _actually_ look the same in each and every
>   >     respect_are_ the same.  Things that we can distinguish between
>   >     do _not_ look the same (by definition -- this is what we mean by
>   >     being able to distinguish).
>
>   I wouldn't necessarily agree.  The difficulty lies in mutable objects.  If
>   I have two mutable objects, alike in every way, and I change one, then the
>   other doesn't change.  [ ... ]
>
>Sorry, you are right, but you missed my point.  If there is an
>operation (here: modify one object and observe the change -- or
>rather: non-change -- in the other), that lets you distinguish between
>the two things, then they don't look the same (and never did).  It's a
>matter of what one means by "they look the same".

  Sounds a bit Orwellian to me.  :-)

>And moreover, if the language has both mutable _and_ immutable things,
>then it should support the concept of identity for the former and not
>for the latter.  Since that was what started the thread: ML is such a
>language, and it gets this issue exactly right.

  Interesting.  I must look into that language.

 -PD
-- 
--
Patrick Doyle
doylep@ecf.utoronto.ca


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

Date: 29 Apr 1997 19:08:58 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Perl auto-replier
Message-Id: <memo.19970429200916.23725C@skep.compulink.co.uk.cix.co.uk>


In article <5k58aa$bg1$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:


> It got to be too much for him.  When something's too much for him,
> he bails.  I, on the other hand, got pissy and tried to stick with it.
> I was wrong, twice, but I'm through with those mistakes.  I go now to
> join Larry in that great Perl heaven far removed from Usenet.
>

Well, I'll miss you both.

I took a long break from Usenet - and then, another shorter one.  I'm back
for now.  I happen to have a news reader that will only download headers
to start with.

Someone here does (or used to, havn't seen any in the past fortnight), a
warning about picking a good subject.  Well, thats [mostly] how I pick
what I download.

Of course, I've had to get an Enter key with an enforced spring, so I can
just zoom through most of the garbage. ;-))

I'll miss Larry's prosaic style - I'll just have to emulate the damn fool
comments [that British for amusing] in his C now, as I hone my own.

Regards
Neil



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

Date: 29 Apr 1997 17:13:51 GMT
From: mattera@ssga.ssb.com (Luigi Mattera)
Subject: Re: PERL Editor
Message-Id: <5k5a8f$31q@svna0001.clipper.ssb.com>

Peter G. Martin (peterm@zeta.org.au) wrote:
: emacs.pl, potatoes, vi, ed....
: So none of you own a pencil, huh ?

  Pencils?  Bah, who needs pencils?  You should manually punch out
holes in punch cards to feed into a punch card reader.


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

Date: Tue, 29 Apr 1997 09:07:03 +0100
From: Paul Cunnell <pcunnell@csfp.co.uk>
To: Hitesh Patel <hpatel1@csfp.co.uk>
Subject: Re: Perl5 script on sunOS 4.x and Solaris 2.x
Message-Id: <3365AC27.172A@csfp.co.uk>

This is almost certainly due to the fact that your SYBASE environment
variable points the Sybase libraries to an SunOS version of the Sybase
interfaces file, which is radically different for Solaris. Here's a 
simple little script which will (given a hostname and port number 
from the 'old-style' interfaces file) print out the correct magic
number for you...

Hope this helps.

#!/usr/local/bin/perl -w
printf "\\x%04x%04x%02x%02x%02x%02x%016x\n",
        2,$ARGV[1],unpack('C4',(gethostbyname($ARGV[0]))[4]),0;

Paul.


Hitesh Patel wrote:
> 
> I have a very simple perl5 script which uses the Sybase CTlib package.
> When I run it on sunOS it works OK, but on Solaris I get the following
> error, with diagnostics turned on :
> 
> Open Client Message:
> Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
> Message String: ct_init(): network packet layer: internal net library
> error: Netlib state error - Netlib initialization may have failed
> Uncaught exception from user code:
>         Sybase::CTlib initialize: ct_init() failed at
> /usr/local/lib/perl5/DynaLoader.pm line 153.
>         DynaLoader::bootstrap called at
> /usr/local/lib/perl5/site_perl/Sybase/CTlib.pm line 862
>         require Sybase/CTlib.pm called at t7 line 22
>         main::BEGIN called at /usr/local/lib/perl5/DynaLoader.pm line 0
>         eval {...} called at /usr/local/lib/perl5/DynaLoader.pm line 0
> BEGIN failed--compilation aborted at t7 line 22.
> 
> The line 22 in my perl5 script (called t7) is : "use Sybase::CTlib;"
> 
> When I use DBLib by including the Sybperl package, i.e. "use
> Sybase::Sybperl;" , I get :
> 
>         DB-Library: Unknown network type found in interface file.
> 
> In both cases the scripts dont even get to the stage of running the
> simple SQL statement. Is this a Perl OR Sybase CT lib Problem or Sun
> Solaris???
> 
> Any help or ideas on this.
> 
> --
> Hitesh Patel



-- 
Paul Cunnell CSFB RDG (pcunnell@csfp.co.uk) +44 171 888 2946


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

Date: 29 Apr 1997 19:09:47 +0100
From: abw@peritas.com (Andy Wardley)
Subject: Re: Pointing a Filehandle _AT_ a Subroutine
Message-Id: <5k5dhb$pqo@aoxomoxoa.peritas.com>


automan  <automan@umich.edu> wrote:
>
>Anyway, disclaimer aside, What I'd like to do is to create a filehandle to
>a pseudo-pipe that is really a subroutine internal to my script.

If you open a filehandle to "|-" it implicitly forks a new process.
So you now have two processes simultaneously running the same script.
In the parent process, the return from the open() is the process id
of the child process.  In the child process, the return value is 0.
By examining this process ID, you can execute different code for the
parent and child processes.

Now the clever part.  Anything written to the filehandle in the parent
process automagically gets piped to the STDIN of the child process.

This is described in Camel II on page 193, although it suggests using
defined($pid) to determine the parent/child-ness of the process.  This
is actually incorrect as defined($pid) returns true in both cases.

The following example demonstrates:

#!/usr/bin/perl -w

my $pid = open (INPIPE, "|-");

if ($pid) {
	# parent process - write to INPIPE
	print INPIPE "hello world\n";
}
else {
	# child process - read from STDIN
	while (<STDIN>) {
		print "READ: $_";
	}
}


You can take the basic principle above and apply a few shortcuts to get 
the following:

#!/usr/bin/perl -w

open (INPIPE, "|-") || &printcmd;

print INPIPE "hello world\n";

sub printcmd {
	while (<STDIN>) {
		print "READ: $_";
	}
	exit;   # exit from the child process
}


Hope this helps.

A


-- 
Andy Wardley <abw@peritas.com>  **NEW** http://www.peritas.com/~abw 
A responsible and professional individual who has no need for silly 
comments, inane banter or bizarre "in-jokes" in his signature file.  


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

Date: 29 Apr 1997 11:01:45 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: pre-RFD: comp.lang.perl.{data-structure,inter-process,porters,regex}
Message-Id: <qum67x5lncm.fsf@cyclone.stanford.edu>


Douglas Seay <seay@absyss.fr> writes:

> Is it possible to make one usenet group an alias of another?  Just make
> this new c.l.p.www be a "symbolic reference" to c.i.w.a.cgi might do the
> trick.  I've never heard of such a thing, so I doubt if it is already in
> a RFC.

It's possible with some news servers, but there is no way to set up an
alias Usenet-wide (like one can request a newsgroup be created
Usenet-wide).  Each site has to do it separately.

However, that wouldn't be a bad thing for people to request that their
individual sites do....

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Mon, 28 Apr 1997 19:09:22 +0200
From: Sondre Johan Walla <sondrejw@stud.hitos.no>
Subject: Problem with CGI form processing
Message-Id: <3364D9C2.6ED0@stud.hitos.no>

Ive been trying to get a perl script CGI to run correctly. It is
supposed to process a form and then send a mail to me. The problem is
that the mail I get is totally empty. Can anyone help?? 
TIA

Sondre J. Walla
http://samson.stud.hitos.no/~sondrejw/main.htm

Perl procedure for mail enclosed:

sub do_mail
{
  local($filename) = "/tmp/cf-$$";
  open(TFILE,">$filename");
  @filetext = <TFILE>;

#<...print a lot of shit to file...>

close(TFILE);

  open (MAIL, "|/usr/lib/sendmail $mailreceiver") || die "No can
do!!\n";
  print MAIL "Subject: Membership application\n\n";
  print MAIL "$filetext\n";
  close MAIL;
  unlink("$filename\n");
}


# The variable $mailreceiver is declared in the main prog.


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

Date: Wed, 30 Apr 1997 03:27:24 +1000
From: Paula Blick <paula@cta-challenge.com.au>
Subject: Signal processing in Perl
Message-Id: <33662F7C.6CB4@cta-challenge.com.au>


This is a multi-part message in MIME format.

--------------1845D446DD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've run into a problem with signal processing that causes a
"segmentation fault".  I found some related info on CPAN, where Jack
Shirazi (author of EventServer) explains it's Perl having a problem
because a malloc is interrupted by the signal.

Is there a fix for this?  Or a way to work around it?

I've attached the sample code (courtesy of Jack's package) that fails
after a couple of minutes.

Thanks and best regards,
Wayne Blick

--------------1845D446DD
Content-Type: application/x-perl; name="sig.pl"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="sig.pl"

Cgp1c2Ugc3RyaWN0Owp1c2UgUE9TSVg7CgpteSBAYSA9IHF3KCAxIDIgMyA0KTsKbXkgJHNp
Z19oYXBwZW5lZCA9IDA7CgokU0lHe0FMUk19ID0gJ3NpZ19oYW5kbGVyJzsKUE9TSVg6OmFs
YXJtKDEpOwoKd2hpbGUgKDEpIHsKCiAgICBteSAkejsKICAgIGZvcmVhY2ggJHogKCBAYSkg
ewoKICAgICAgICByZXNldF9oYW5kbGVyKCkgICAgaWYgJHNpZ19oYXBwZW5lZDsKICAgIH0K
fQoKCnN1YiByZXNldF9oYW5kbGVyIHsKCiAgICBwcmludCAiUmVzZXQgaGFuZGxlclxuIjsK
ICAgICRzaWdfaGFwcGVuZWQgPSAwOwojICAgICRTSUd7QUxSTX0gPSAnc2lnX2hhbmRsZXIn
OwogICAgUE9TSVg6OmFsYXJtKDEpOwp9CgoKc3ViIHNpZ19oYW5kbGVyIHsKCiAgICAkc2ln
X2hhcHBlbmVkID0gMTsKfQoK
--------------1845D446DD--



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

Date: Tue, 29 Apr 1997 13:12:50 -0500
From: Eryq <eryq@enteract.com>
To: Paula Blick <paula@cta-challenge.com.au>
Subject: Re: Signal processing in Perl
Message-Id: <33663A22.4792CB61@enteract.com>


Paula Blick wrote:
> 
> I've run into a problem with signal processing that causes a
> "segmentation fault".  I found some related info on CPAN, where Jack
> Shirazi (author of EventServer) explains it's Perl having a problem
> because a malloc is interrupted by the signal.
> 
> Is there a fix for this?  Or a way to work around it?

As far as I can see, your code is as safe as can be.  You say:

   my $sig_happened = 0;

   sub sig_handler {
       $sig_happened = 1;
   }

and that's great; I don't see any mallocs you can be avoiding...
in fact, I don't see why Perl should need to do any at all, since
the scalar already exists, and you're only slinging integers. 
One thing I'd change stylistically is to say:

   $SIG{ALRM} = \&sig_handler;

Maybe some Perl internals guru knows what's happening... next time,
be sure to tell us what OS and version of Perl you're using.
 
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 29 Apr 1997 19:08:51 GMT
From: tcm@wcl.on.ca (TCM Online)
Subject: Syntax checking?
Message-Id: <5k5h03$snh@nr1.toronto.istar.net>

I'm a Perl newbie here.... just learning by example and hacking
existing code..

I've started off on a new project from the ground up and now get a
run error stating I'm missing a right bracket... is there any good
freeware syntax checkers that will find this for me?

Thanks!

Ernie Johnson
TCM Online

email tcm@tcmd.com


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

Date: Tue, 29 Apr 1997 12:37:24 -0700
From: Joe Lempkowski <joey@Sun.COM>
Subject: Windows 95 and FTP
Message-Id: <33664DF4.4C51@Sun.COM>

Does anyone have a pointer on how to use PERL to download files via
ftp on a Windows 95 platform?

Thanks,

Joe


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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