[9142] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2760 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 29 13:07:33 1998

Date: Fri, 29 May 98 10:00:28 -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           Fri, 29 May 1998     Volume: 8 Number: 2760

Today's topics:
    Re: 500 Internal Server Error (newbie) (Chris Hamilton)
        RE: A new comer to PERL <ejc@mitre.org>
    Re: Advanced Perl Programming Book <dorr@cetrel.lu>
    Re: Advanced Perl Programming Book (I R A Aggie)
        Call for Papers: 7th International Python Conference <jeremy@cnri.reston.va.us>
        children processes <cshupp@entergy.com>
    Re: Converting 31.12.1998 -> 12/31/1998 (I R A Aggie)
    Re: Don't Know how to decrypt using PERL <lr@hpl.hp.com>
    Re: Don't Know how to decrypt using PERL (Bbirthisel)
        Eeek, How do I use HTML::Parser? <fozz@mail.xmission.com>
    Re: filtering input for security / newbie (Jeff Dickens)
    Re: getpwnam, $gcos (Mike Stok)
    Re: getpwnam, $gcos <lr@hpl.hp.com>
    Re: getpwnam, $gcos <Dave.Cross@gb.swissbank.com>
    Re: Good with pattern matches? wizord@my-dejanews.com
        Help, please, with ODBC and named ranges in Excel (Robert Watkins)
    Re: How can I catch a segv, etc. in a process created f <aqumsieh@matrox.com>
    Re: HOW? : Using MacPERL/Navigator/My Local Machine (Chris Nandor)
    Re: Perl DBI and MySQL (Matt Knecht)
    Re: perl monger tshirt??? <dorr@cetrel.lu>
    Re: Perl question abotu Leap year pinetree@my-dejanews.com
        Problem with Socket.pm/Socket.sl on  HPUX 10.20 <Greg.Thomas@atmosenergy.com>
    Re: Question on Text Widget Update <krutibas.biswal@sun.com>
        Serial Ports - Toggling Pins andrew@ugh.net.au
    Re: Serial Ports - Toggling Pins andrew@ugh.net.au
    Re: simple question <Dave.Cross@gb.swissbank.com>
    Re: simple question <lr@hpl.hp.com>
    Re: Statistics for comp.lang.perl.misc jimbo@soundimages.co.uk
    Re: Statistics for comp.lang.perl.misc <upsetter@ziplink.net>
    Re: Unix "file" function in perl? (LONG) (Joel Coltoff)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 May 1998 15:18:59 GMT
From: chrish@squonk.net (Chris Hamilton)
Subject: Re: 500 Internal Server Error (newbie)
Message-Id: <6kmjl3$a6i$1@duke.squonk.net>

Tom Phoenix (rootbeer@teleport.com) wrote:
: On 27 May 1998 dirt@xworld.com wrote:
: 
: > Subject: 500 Internal Server Error (newbie)
: 
: When you're having trouble with a CGI program in Perl, you should first
: look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
: such problems. It's available on CPAN.
: 
:    http://www.perl.com/CPAN/
:    http://www.perl.org/CPAN/
:    http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
:    http://www.perl.org/CPAN/doc/manual/html/pod/
: 
: Hope this helps!
: 
: -- 
: Tom Phoenix       Perl Training and Hacking       Esperanto
: Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
: 

-- 
---
Chris Hamilton                 C7 F9 1E FF 4F D8 F8 87  
chrish@squonk.net              F8 13 5F 69 63 B5 EB A8

"You're just jealous because the 'voices' talk to me."



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

Date: Fri, 29 May 1998 11:56:16 -0400
From: Ellen Cohn <ejc@mitre.org>
Subject: RE: A new comer to PERL
Message-Id: <356EDAA0.F8F4B8D2@mitre.org>

I am working for the Mitre Corporation in Bedford, Ma.  I was asked to
setup a web-database application.  I have been thinking SQL Server would
be a good place to start but I cannot find any resources on connecting
to a database from within a PERL script.  I understand that to many this
may seem easy but I am a new comer to the PERL language.  Please respond
to < npetty@mitre.org >.  I will check in later.........

Mustafa


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

Date: Fri, 29 May 1998 15:14:09 +0200
From: Denis DORR <dorr@cetrel.lu>
Subject: Re: Advanced Perl Programming Book
Message-Id: <356EB4A1.A4957312@cetrel.lu>

Andrew Johnson wrote:
> 
> Christopher R. Redinger wrote:
> !
> ! Okay, I've searched the FAQ, I've read the groups, and I can't
> ! seem to find the answer to this FAQ (at least around here). We've
> ! got the "Camel Book," we've got the "Llama Book," heck we've even
> ! got the "Hip Owls" book. The question of the month around here as
> ! been, what the heck is on the cover of Advanced Perl Programming
> ! by O'Reilly?? We've been calling it the "Puma Book." But, I'm not
> ! too sure about the accuracy of that one. Any ideas?

[ ... I had to cut some interesting stuff about panthers here because my
newswriter complains about the bad original/quoted text ratio ...

I have another related question. (hope it's not a FAQ ...)
I didn't want to post it in this group because it has *nothing* to do
with Perl, but :

- it seems there is no comp.books.ora group,
- some people here seem to be involved in some of those books,
- now that the thread is open (and the ween-end comes), let's go :

does anyone here know if there is a relationship between the animal on
the cover and the contents of ORA books ? Why a Llama, a Camel, a
panther (& soon a "mouflon" -sorry, I don't know the English word) for
Perl ?

I can't stand being ignorant of this ...

-- 

dorr@cetrel.lu


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

Date: Fri, 29 May 1998 11:06:51 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Advanced Perl Programming Book
Message-Id: <fl_aggie-2905981106510001@aggie.coaps.fsu.edu>

In article <1998052913443400.JAA23970@ladder01.news.aol.com>,
bbirthisel@aol.com (Bbirthisel) wrote:

+ Which is Kaa (who will be portrayed today by $$Bill_G)

Do not reference the Evil One...

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 29 May 1998 12:21:49 -0400
From: Jeremy Hylton <jeremy@cnri.reston.va.us>
Subject: Call for Papers: 7th International Python Conference
Message-Id: <51zpg159pe.fsf@bitdiddle.CNRI.Reston.Va.US>

We are happy to announce the availability of the call for papers for:

7th International Python Conference
South Shore Harbour Resort, Houston, Texas
November 10-13, 1998

Call for Papers at:
http://www.foretec.com/python/workshops/1998-11/cfp.html
Papers due: July 27, 1998
 
We invite authors to submit papers describing new and useful
applications and tools that use Python. In addition to traditional
research papers, we have a special interest in papers that describe
approaches to practical programming problems and experience reports
that provide lessons for Python programmers.

Specific paper topics include, but are not limited to: 

-Experience with large systems written in Python or that use Python as
    scripting or glue language  
-Internet applications, including Web content and administration,
    network programming, distributed objects (ILU) 
-Scientific, engineering, and numeric applications 
-Integration with other languages and systems, including Java, CORBA,
    COM, embedded systems,  etc. 
-Python on Windows, including Active Scripting, NT system administration 
-Extension modules and new developments for the core language 
-Applications and systems using JPython 
-Programming patterns and OO design strategies 
-Software engineering techniques, practical programming advice, and
    tools for programmers  
-GUI programming 
-Database and ODBC applications 
-Use of Python in education 
 
We also welcome proposoals for tutorials and demonstrations.
Information about the poster session and short talks is available at
the conference Web site.

http://www.foretec.com/python/workshops/1998-11/

Jeremy Hylton, CNRI
Program Chair, 7th International Python Conference


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

Date: Fri, 29 May 1998 10:34:11 -0500
From: Cris Shupp <cshupp@entergy.com>
Subject: children processes
Message-Id: <356ED573.8B952969@entergy.com>

Is there a way to have Perl spawn x number of processes and allow them
to only use up to y number of cpu seconds before killing the process?
The purpose of this is to prevent run away processes from consuming to
much of our systems resources.


Thanks
Cris Shupp



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

Date: Fri, 29 May 1998 11:05:39 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Converting 31.12.1998 -> 12/31/1998
Message-Id: <fl_aggie-2905981105400001@aggie.coaps.fsu.edu>

In article <356EC204.8EDA77FC@matrox.com>, Ala Qumsieh
<aqumsieh@matrox.com> wrote:

+ ak wrote:
+ 
+ > Hi !
+ > I want to convert european dates to american dates. Has anyone a
+ > solution for this problem ?
+ 
+ You can probably find a module to do this. But a quick and easy way using
+ regexps would be:
+ 
+ $date = '31.12.1998';
+ $date =~ s!^(\d+)\.(\d+)\.!$2/$1/!g;

Strikes me as being somewhat obsfucated. Why not:

$date='31.12.1998';
($day,$mon,$year)=split /\./, $date;
$date=join('/',$mon,$day,$year);
print "$date\n";

Result: 12/31/1998

May be less efficient. A little easier to read. And I'm sure that
three months from now, I'd look at this and go "huh? why did I do
it this way??"

:)

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Fri, 29 May 1998 07:48:32 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Don't Know how to decrypt using PERL
Message-Id: <6kmhse$rqu@hplntx.hpl.hp.com>

Bbirthisel wrote in message
<1998052914093100.KAA21704@ladder03.news.aol.com>...
 ...
>If someone really DOES need a copy of the crypt(3) manpage, I can send
it
>via email.


I think you are missing my point, which was about behavior modification.
Significant bandwidth could have been saved here if the responder had
simply cut-and-pasted the relevant paragraph out of the crypt(3)
manpage, instead of blowing the question away with "RTF Unix manual".
It's a question of courtesy and newsgroup policy.

The Unix manual is not a Perl manual or a Perl FAQ; it does not come
with the Perl distribution; it is not available on-line or to a growing
(we should hope) number of Unix-deprived Perl users.  In answering
questions here, we should consider this and act accordingly.

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: 29 May 1998 15:18:18 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Don't Know how to decrypt using PERL
Message-Id: <1998052915181800.LAA26795@ladder03.news.aol.com>

Hi Larry:

A quick followup to my earlier post. The linux manpages
are available for download as a set (tar.gz) from:

    ftp://ftp.win.tue.nl/pub/linux/man

I got there via the Linux Documentation Project at

    http://sunsite.unc.edu/LDP

sunsite has lots of mirrors. It has links to various documentation
resources in a variety of formats. Crypt(3) is included in the
manpage set.

Good luck,

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Fri, 29 May 1998 09:47:41 -0600
From: "Doran L. Barton" <fozz@mail.xmission.com>
Subject: Eeek, How do I use HTML::Parser?
Message-Id: <356ED89D.7DF92411@mail.xmission.com>

I recently asked about using RegEx's to break up some HTML into a list.
Now I realize I should be using HTML::Parser. That's cool... but how do
you use the damn thing. The documentation could use a couple of
implementation examples. I'll be sure to mail the author.

In the meantime, does anyone have any code they could show me?
Specifically, creating a subclass of HTML::Parser and overriding the
start() method.

I've done it... but when I print out the values $tag and $origtext, I
get this:

TAG: MyParser=HASH(0x80baa98)
ORIGTEXT: ARRAY(0x80e6b48)
TAG: MyParser=HASH(0x80baa98)
ORIGTEXT: ARRAY(0x80e6b30)

-=Fozz
-- 
========================================================================
Doran L. Barton = fozz@xmission.com && http://www.xmission.com/~fozz/;
"Where do you want Microsoft to go today?" --Ron Barry <ronb@cc.usu.edu>
"This may seem a bit weird, but that's okay, because it is weird."
  -- Larry Wall <lwall@sems.com> in the Perl v5 man page


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

Date: Fri, 29 May 1998 16:03:53 GMT
From: jeff.dickens@digital.com (Jeff Dickens)
Subject: Re: filtering input for security / newbie
Message-Id: <356edb3d.6669129@nntpd.bb.dec.com>

On Mon, 18 May 1998 16:38:20 -0700, "W. Hellberg"
<bhellbrg@u.washington.edu> wrote:

>
>I'm a beginner trying to use Perl to make an interactive form.  
>My problem is about putting in a security filter so that only legal 
>alphanumeric characters get to the server (I've read that this is more 
>secure than filtering out possible illegal characters).

I used this little snippet recently:

s/[^\w\.]//g;	

It says "replace any characters that are not either 'word' characters
or '.' with nothing".  "word characters" are defined in "man perlre".

This is in keeping with my philosophy of avoiding error recovery logic
by just pretending the user didn't type those nasty characters.  This
approach works for my purposes.



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

Date: 29 May 1998 16:01:52 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: getpwnam, $gcos
Message-Id: <6kmm5g$ak3@news-central.tiac.net>

In article <6kmeui$916@fidoii.cc.Lehigh.EDU>,
Phil R Lawrence <prl2@lehigh.edu> wrote:
>This works:
>@passwd = getpwnam($<);
>$real_name = $passwd[6], "\n";
>
>but I want to do it in one line, like:
>$real_name = ${ getpwnam($<) }[6];

  $real_name = (getpwuid $<)[6];

might be what you want as $< is the numeric user ID (getpwnam uses a
supplied usr name to do the lookup).

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 29 May 1998 07:52:02 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: getpwnam, $gcos
Message-Id: <6kmi40$rrn@hplntx.hpl.hp.com>

[posted and emailed]
Phil R Lawrence wrote in message <6kmeui$916@fidoii.cc.Lehigh.EDU>...
>This works:
>@passwd = getpwnam($<);
>$real_name = $passwd[6], "\n";
>
>but I want to do it in one line, like:
>$real_name = ${ getpwnam($<) }[6];
>
>That, of course, doesn't work.  Anyone know how to do this?

$real_name = (getpwnam($<))[6];

or just

$real_name = (getpwnam $<)[6];

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: Fri, 29 May 1998 14:45:14 GMT
From: David Cross-cmt <Dave.Cross@gb.swissbank.com>
Subject: Re: getpwnam, $gcos
Message-Id: <eq0ra1d9lvp.fsf@gb.swissbank.com>

"Phil R Lawrence" <prl2@lehigh.edu> writes:

> 
> This works:
> @passwd = getpwnam($<);
> $real_name = $passwd[6], "\n";
> 
> but I want to do it in one line, like:
> $real_name = ${ getpwnam($<) }[6];
> 
> That, of course, doesn't work.  Anyone know how to do this?

Assuming that you meant getpwuid instead of getpwnam,

$real_name = (getpwuid($<))[6];

hth,

Dave...

-- 
If I wasn't so busy writing status reports,
my status report might just become a progress report.

Dave.Cross@gb.swissbank.com


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

Date: Fri, 29 May 1998 15:40:54 GMT
From: wizord@my-dejanews.com
Subject: Re: Good with pattern matches?
Message-Id: <6kmku8$6sk$1@nnrp1.dejanews.com>

In article <356b7c31.1515779@news.poptel.org.uk>,
  ed@vtrad.com (Ed Egan) wrote:
> I need a patern match to match:
>
> "D*****"  or "****\D\*****" or "*****\D"
>
> where * is a any alphanumeric and the "\" is a character to be
> matched.
>
> It mustn't match anything else though!

How about this:  /(D\w{5})|(\w{4}\\D\\\w{5})|(\w{5}\\D)/

You said alphanumeric, and \w includes "_" as well, so you may want to
use [A-Za-z0-9] instead of \w in the above expression.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 29 May 1998 15:45:18 GMT
From: r-watkinsNOSPAM@worldnet.att.net (Robert Watkins)
Subject: Help, please, with ODBC and named ranges in Excel
Message-Id: <6kmle2$9cg@bgtnsc03.worldnet.att.net>

I'm using Win32::ODBC to read and write to an Excel spreasheet via a CGI 
script (Perl 5.004.02 standard win32 port on NT). The spreadsheet is a 
directory of names, phone numbers and e-mail addresses.

While I can read with no problem, I've encountered something I can't figure 
out when I write to the spreadsheet. I can add a record to the spreadsheet 
alright, but the record is added just below the named range. As such, I cannot 
then read this added record as the DSN looks only to the "table" which, if I 
am not mistaken, is simulated by the named range. My INSERT command in SQL 
does indeed "INSERT INTO <table name> ...", but it just writes to the file, 
not to the "table".

Any ideas?

Robert Watkins
r-watkins@worldnet.att.net


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

Date: Fri, 29 May 1998 10:54:43 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How can I catch a segv, etc. in a process created from Perl?
Message-Id: <356ECC33.BB109DC7@matrox.com>

Brian J. Sayatovic wrote:

> Is there a way to catch, say, a segv, that occurs in a process that is
> started by a perl script?  I'd like to monitor the batch of processes my
> script starts so I can log such signals.  Right now I'm hoping that its
> children will have the same signal handlers as the perl script.

Check out

perldoc sigtrap

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Fri, 29 May 1998 16:42:49 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: HOW? : Using MacPERL/Navigator/My Local Machine
Message-Id: <pudge-2905981237090001@dynamic265.ply.adelphia.net>

In article <dolph6-2905980819320001@209.66.12.229>, dolph6@jersey.net
(Christopher Soeffing) wrote:

# I have sent the last few hours searching the web, the CD that came with my
# PERL 5 book and newsgroups and I still don't have a simple answer to my
# question.
# 
# For testing purposes I want to run a Perl script inside Navigator on my
# machine.  I think I need an interpreter that runs on my Mac (like an
# interpreter need to be able to run on the same platform as the browser). 
# I will be using Netscape Navigator (I'll using MS Internet Explorer is
# neccessary) and a plain text cgi text file.
# 
# So, what do I need ?  I have MacPerl 5.1.3r2 and I have been saving my
# scripts as text files (so they are interpreted).  I have seen options to
# save as CGI scripts from within MacPerl, but that saved them as
# applications, which I have no idea how to use from within the browser.
# 
# Is there an interpreter for the Mac?  Where can I find it, and how do I
use it 

First, upgrade to MacPerl 5.2.0r4.

Second, consider buying the MacPerl book (see my web site below).

Third, consider joining the mac-perl list (at http://www.ptf.com/macperl/).

Fourth, if you are using CGI.pm you can test CGIs from the MacPerl
terminal window by running the script with command-r and tpying into the
window as:

 value=param
 value2=param2

And hitting ctrl-D when done (just like in Unix).

Fifth, if you want to test it in your browser, you need a web server, just
like in Unix.

Sixth, see the CGI or webserver newsgroups for more information about
testing CGIs in a local web server.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Fri, 29 May 1998 16:19:02 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Perl DBI and MySQL
Message-Id: <WdBb1.376$_3.2968154@news2.voicenet.com>

On Fri, 29 May 1998 00:30:04 -0500, dippity <dippitydog@hotspot.com> wrote:
>The following script fails with must import package name for $username, and
>the same error for $dbh.

>#!/usr/bin/perl
>use DBI;
>use strict;
 ^^^^^^^^^^
>my $database = "contacts";
>my $data_source = "DBI:mysql:$database"
>my $username = "fty";
>my $password = "password";
>my $dbh = DBI->connect( $data_source, $username, $password)
>or die "Can't connect to $data_source: $dbh->errstr\n";
>$dbh->disconnect;
>exit(0);

Since you 'used strict', you have to tell Perl exactly what variables
you want to use, and where they're from.

So, you have to declare you variables before they are used.  Something
like "my ($database, $data_source, $username ... etc...)".  For
variable that come your way by using a module, you don't want to
declare them (Since the module does).  You have to add a line like:
use vars qw($dbh);

Check out 'perldoc strict' and look for 'strict vars'.  

-- 
Matt Knecht + <hex@voicenet.com>


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

Date: Fri, 29 May 1998 15:22:05 +0200
From: Denis DORR <dorr@cetrel.lu>
Subject: Re: perl monger tshirt???
Message-Id: <356EB67D.106F8012@cetrel.lu>

brian d foy wrote:
 
> Perl Mongers has plans for different t-shirts as well :)
                                               ^^^^^^^^^^^^^
I suppose you meant : "as wall" here ...


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

Date: Fri, 29 May 1998 16:13:07 GMT
From: pinetree@my-dejanews.com
Subject: Re: Perl question abotu Leap year
Message-Id: <6kmmqj$9b5$1@nnrp1.dejanews.com>

In article <356CF703.7B6EB9A0@mindspring.net>,
  Billy Strader <straderb@mindspring.net> wrote:
>
> Now how do I write that in perl..  I got it so it subtracts the day and
> everything but I am stuck on the leap year part.  How do I get perl to
> see if it is a real number or not (a year divisable by 4).  If anyone
> can help it will be greatly appricaited.

Actually, the rule for leap years is a bit more detailed.

A year is a leap year if:
 1. It is divisible by 4 (1996 was a leap year) and
 2. It is not a multiple of 100 (2100 will NOT be a leap year)unless
 3. It is divisible by 400 (2000 WILL be a leap year).

&LeapYear($year)

sub LeapYear {
# Return 1 if a leap year, 0 is not
    my($year) = @_ if @_;
    my($test);

    if ($year%4 == 0) { # test rule 1
        if ($year%100 == 0) { # test rule 2
            if ($year%400) { # test rule 3
                $test = 1; # ok because rule 3 overrides rule 2
            }
            else { $test = 0; } # fails by rule 2
        }
        else { $test = 1; } ok because rule 1
    }
    else {
        $test = 0; # fails rule 1
    }

    return $test;
}

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 29 May 1998 10:15:59 -0500
From: "Thomas, Greg N." <Greg.Thomas@atmosenergy.com>
Subject: Problem with Socket.pm/Socket.sl on  HPUX 10.20
Message-Id: <4CE0AF51242AD111BE0F00805F15404E4A671B@dfw1wn05.atmosenergy.com>

I get the following error when running an application that uses a perl
script which uses 
the SNMP_Session.pm and Socket.pm modules (I have installed Perl 5.004
using the 
default configuration when running the install Configure script and HP's
ANSI C compiler:

/usr/lib/dld.sl: Unresolved symbol: inet_ntoa (code) 
from /opt/perl5/lib/PA-RISC1.1/5.00404/auto/Socket/Socket.sl
Abort(coredump)

This error occurs immediately upon starting the application (actually
the application does not
even load completely I don't think because of the error from the dynamic
library loader.

The inet_ntoa symbol is undefined in the Socket.sl library after Perl
installation, below is the listing of 
nm on the Socket.sl library with respect to the inet_ntoa and inet_aton
symbols:

#nm /opt/perl5/lib/PA-RISC1.1/5.00404/auto/Socket/Socket.sl | grep inet
inet_aton           |          |undef |code   |
inet_aton           |     12696|uext  |stub   |
inet_ntoa           |          |undef |code   |
inet_ntoa           |     13392|uext  |stub   |
XS_Socket_inet_aton |     10472|extern|entry  |
XS_Socket_inet_aton |     10544|extern|code   |$CODE$
XS_Socket_inet_ntoa |     10928|extern|entry  |
XS_Socket_inet_ntoa |     11000|extern|code   |$CODE$


How do I fix this or can someone point me to some information that might
help? Also, I have 
no HPUX Programming Documentation (going off what I know and what little
information HPUX 
support was able to give me).
 
I am assuming I will have to recompile the Socket.sl manually, since it
needs to use inet symbols that are in 
libc.sl for the socket functions, or is there something that I missed
when installing Perl to begin with. 
The libc.sl and the other shared HPUX system libraries are in the
default location of /usr/lib. 
I do not seem to have problems running other simple scripts with just
file IO.

The inet_ntoa and inet_aton symbols are defined in my system's libc.sl,
located at /usr/lib. Here is the 
nm output on that library:

#nm /usr/lib/libc.sl | grep inet
#nm /usr/lib/lic.sl | grep inet
_inet_aton          |    335552|uext  |stub   |
_inet_aton          |    380104|extern|entry  |
_inet_aton          |    380200|extern|code   |$CODE$
_inet_lnaof         |    381048|extern|entry  |
_inet_lnaof         |    381096|extern|code   |$CODE$
_inet_makeaddr      |    353784|uext  |stub   |
_inet_makeaddr      |    381152|extern|entry  |
_inet_makeaddr      |    381200|extern|code   |$CODE$
_inet_netof         |    381280|extern|entry  |
_inet_netof         |    381328|extern|code   |$CODE$
_inet_network       |    360744|uext  |stub   |
_inet_network       |    381400|extern|entry  |
_inet_network       |    381448|extern|code   |$CODE$
_inet_ntoa          |    382176|extern|entry  |
_inet_ntoa          |    382248|extern|code   |$CODE$
_inet_ntoa          |    383032|uext  |stub   |
_inet_ntoa_r        |    338504|uext  |stub   |
_inet_ntoa_r        |    424328|extern|entry  |
_inet_ntoa_r        |    424376|extern|code   |$CODE$
inet_addr           |    380024|extern|entry  |
inet_addr           |    380048|extern|code   |$CODE$
inet_aton           |    380128|extern|entry  |
inet_aton           |    380200|extern|code   |$CODE$
inet_lnaof          |    381072|extern|entry  |
inet_lnaof          |    381096|extern|code   |$CODE$
inet_makeaddr       |    381176|extern|entry  |
inet_makeaddr       |    381200|extern|code   |$CODE$
inet_netof          |    381304|extern|entry  |
inet_netof          |    381328|extern|code   |$CODE$
inet_network        |    381424|extern|entry  |
inet_network        |    381448|extern|code   |$CODE$
inet_ntoa           |    382200|extern|entry  |
inet_ntoa           |    382248|extern|code   |$CODE$
inet_ntoa_r         |    424352|extern|entry  |
inet_ntoa_r         |    424376|extern|code   |$CODE$

Any help would be geatly apprreciated, even if it is just pointers to
other informational sources. 
I looked over many piles of PERL information, but I saw nothing relating
to problems with 
Socket.pm/Socket.sl or the other shared libararies PERL creates/usess to
implement 
system dependent functions.


Gregory Thomas
System Programmer
greg.thomas@atmosenergy.com




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

Date: Fri, 29 May 1998 09:31:45 -0700
From: Krutibas Biswal <krutibas.biswal@sun.com>
Subject: Re: Question on Text Widget Update
Message-Id: <356EE2F1.1F54FBA8@sun.com>

I figured out a solution to this problem myself.

I used the filevent mechanism :

open TEXTF, "RunProg |";
$root->fileevent(TEXTF, 'readable', sub {
                     $tmpStr = <TEXTF>;
                     if (eof(TEXTF)) {
                         $root->fileevent(H, 'readable', '');
                     } else {
                         $logText->insert('end', $tmpStr);
                         $logText->yview('end');
                     } 
              } );

If I don't check for the eof in the subroutine, it seems to be
getting into some kind of loop...

By the way, where is the documentation for PERL/TK Fileevent stuff ??
I could get only the TK filevent docs.

Regards,
Krutibas Biswal
Mountain View,
CA
                           


Krutibas Biswal wrote:

> 
> $logText = $root->Text (-borderwidth => '1', -height => '1', -width =>
> '1' );
> 
> $textScroll = $root->Scrollbar( -borderwidth => '1',-relief => 'flat');
> 
>    $logText->configure(-yscrollcommand => ['set', $textScroll]);
>    $textScroll->configure( -command => ['yview', $logText] );
> 
> FORK: {
>    if ( $child = fork ) {
>      ## Parent Does nothing
>    } elsif (defined $child) {
>        open TEXTF, "RunProg |";
>        while(<TEXTF>) {
>           $logText->insert(end, $_);
>        }
>        close(TEXTF);
>    } elsif ($! =~ /No more process/) {
>        sleep 5;
>        redo FORK;
>    } else {
>        die "Can't fork: $!\n";
>    }
> 
> }


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

Date: Sat, 30 May 1998 01:25:11 +1000
From: andrew@ugh.net.au
Subject: Serial Ports - Toggling Pins
Message-Id: <Pine.BSF.3.96.980530012037.18589B-100000@house.key.net.au>

Hi,

I am trying to control a serial device in Perl (under FreeBSD). I can read
and write from it, set flow control and baud rate etc with system("stty")
but how do I do things like detect CD or RI? Can I control DTR et al?

I think I might need to do this in C and write a perl extention but I'm
not sure how to do itin C either :-(

Anyone got any ideas (including which man page to read to do it in C if
all else fails)?

Thanks,

Andrew

Please CC me in followups...



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

Date: Sat, 30 May 1998 01:57:35 +1000
From: andrew@ugh.net.au
Subject: Re: Serial Ports - Toggling Pins
Message-Id: <Pine.BSF.3.96.980530015643.18589F-100000@house.key.net.au>

Sorry to follow up to my own post but am I on the right track with ioctl?
If so any good references? man ioctl is a bit lite...

Thanks,

Andrew



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

Date: Fri, 29 May 1998 15:37:05 GMT
From: David Cross-cmt <Dave.Cross@gb.swissbank.com>
Subject: Re: simple question
Message-Id: <eq0pvgx9jha.fsf@gb.swissbank.com>

a <mvn@euroforum.nl> writes:

> I'm new and using perl4.0m3 for DOS in a dosshell under Win95.

Please don't do that. Perl 4 is buggy, insecure and unsupported.

Get a version of Perl that isn't four years old.

> What I want is check for a directory "c:\perl\scripts" and if it's not
> there, create it.
> 
> How could I do that?

'perldoc perlfunc' might give you a clue. The first functions in the
alphabetical list are the file test functions.

-e filename tests if a file exists.
-d filename tests if a file is a directory

so somehing like

	my $dir = 'c:\perl\scripts';
	mkdir $dir, 0777 unless -e $dir;

might be a good start, tho' it doesn't handle the case when a normal
(i.e. non-directory) file exists with the same name.

Dave...

-- 
If I wasn't so busy writing status reports,
my status report might just become a progress report.

Dave.Cross@gb.swissbank.com


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

Date: Fri, 29 May 1998 09:28:00 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: simple question
Message-Id: <6kmnm8$d8@hplntx.hpl.hp.com>

a wrote in message <356EC833.C36BF228@euroforum.nl>...
>I'm new and using perl4.0m3 for DOS in a dosshell under Win95.
>
>What I want is check for a directory "c:\perl\scripts" and if it's not
>there, create it.
>
>How could I do that?


You can check whether a directory exists by testing the expression
-d $dir_name

The name you give above will not work.  It should be either
"c:\\perl\\scripts" or (better, I think), 'c:/perl/scripts';

If you want to create a directory, use the function mkdir.  To learn
about this, do
perldoc -f mkdir
(assuming perl is correctly in your DOS path).

There is an excellent book, "Learning Perl" from O'Reilly & Associates
<URL:http://www.ora.com>, which should help you get through these
basics.

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: 29 May 1998 17:12:54 +0100
From: jimbo@soundimages.co.uk
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <un2c1qcmx.fsf@JIMBOSNTSERVER.i-have-a-misconfigured-system-so-shoot-me>

gbacon@cs.uah.edu (Greg Bacon) writes:

>  In article <pudge-2805981533440001@dynamic265.ply.adelphia.net>,
> 	pudge@pobox.com (Chris Nandor) writes: : Advocacy issues do
> not belong on clp.moderated.  Any arguments about free : vs. free
> belongs on clp.misc if anywhere, not clp.moderated.
>  I've reread Tom's article, and I don't believe that it was
> primarily an advocacy post (although when anyone dares to speak out
> against the FSF, it usually results in an ugly flame war).
>  This is a quote from the recently posted RFD:
> The moderators will decide which posts are of general interest to
>     the worldwide Perl community.  > I believe the issue Tom brought
>     to the table was of interest to the > Perl community.  Further,
>     I think had it been posted to a moderated > group, the flamefest
>     might have been easier to control.  > Greg


Bullshit. Why should this newsgroup have to endure the copyright
issues relating to ONE man? Tom's faq's do not perl documentation
make. Indeed without pod faq is gibberish. Relating to YOU is what you
meant, Mister Two X-Terms is what REAL users are made of. What a load
of crap. Oh gee, Tom is a Guru-cum-God, his personal rights, liberties
and freedoms are at stake, let's crosspost and whine and winge until
we make our point! When will this happen for one of the regular
readers of the group? ANSWER: NEVER.

The hell with PERL questions. You know, Perl, the tool? I'm sure
you've heard of it? You must have. You've made your I'm a command-line
man so piss-off-the-rest-of-you speeches before on the subject. What's
wrong with an IDE? What's right with one? I'm tuff as nails and your
not.

You hit the nail on the head, CONTROL. YOU, and YOU alone believe you
are qualified to determine what is relevant and what is not. Thanks,
but no thanks. We've done the Hitler, Mussolini thing before. 1984 is
not dead, not with you and your mentality running free and wild and
unfettered.

The issue Tom brought was of interest to EVERYONE indulging in the
Intellectual Property arena. NOT Perl alone. Why didn't he take the
discussion elswhere, to groups discussing the relevant issues? Because
he is a 'GOD', a 'GURU', a 'MASTER'. More importantly because
somewhere else he is a small fish is a big pond, in a bloody ocean in
fact. Here, we all hang on his every word. Oh yes, Tom. You must BE
right, Tom. WE ALL SUPPORT YOU Tom. Question: Tom, I'm having an
intellectual property problem, can you spare HALF the words, nay, a
quarter, of the words you spared the other day regarding the problem
of interest the the Perl Community? No way, no how.

You, Greg Bacon, are an intrinsically selfish person. Any position
taken, any thing said, ANYTHING, so long as it supports MY
position. This WAS NOT and IS NOT about the Perl Community. This WAS
and IS about Tom and his position on HIS faq. No thing else. Just
that.

Tom should know by now, if you don't want to get burnt, don't light a
fire.If the risks are too great, don't write anything which is not
published through traditional printed means. No copyright worries
there, none whatsoever. Well documented and litigated that place
is. If you don't want the risks, or the hassles, or the EFFORT
required to PROTECT your rights, don't make yourself avaialble to such
risks. That IS THE PRICE OF FREEDOM. ETERNAL VIGILANCE. The free or
open or whatever software community is not immune or exempt. Nor are
it's authors.

A tired and weary and hope this shit will come to an end reader.

Jim Brewer


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

Date: 29 May 1998 16:25:35 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <6kmnhv$hv9@fridge.shore.net>

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

: It certainly justfies complaining.   That their Faithful responded
: to the complaint with nuclear blasters is not something you can 
: hold me responsible for.

No offense, Tom, but considering which side of the flamewar used terms
like "unspeakable evil" to describe the other, I'm not sure it's accurate
to say that it was the FSF's "Faithful" who were using "nuclear blasters". 

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: Fri, 29 May 1998 15:44:15 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: Unix "file" function in perl? (LONG)
Message-Id: <6kml3j$kj2@netaxs.com>

In article <356DB9C0.B1FBFE5@cray.com>,
Andrew Hamilton  <hamiltaj@cray.com> wrote:
>sometimes files of certain formats are not saved with the correct file
>extensions).

Correct file extensions. Ack! Some of my files have extensions that
by CONVENTION say what they are. I find it helpful not to annoy
gcc because it just gets in the way of getting work done. A lot of
the programs I use deal with them correctly even when there is no
extension.

Here is a script that has been kicking around for a while. It
uses the /etc/magic idea and if it can't resolve the file then
calls the system file program for help.


#! /usr/local/bin/perl -w
#
# This is a perl version of unix file
# To add test to a type of file, just put a sub at the
# end of this program which test the file type.
# 
# It reads the first 512 bytes into $head, change all '\n' to ' '
# and put the result to $HEAD. Then you can do regexp match on any
# one of these two strings.
#
# creator: yufan@cs.keele.ac.uk (Yufan Hu)
#

use Time::localtime;

open(PROG, $0) || die "$0 cannot open database\n";
while(<PROG>){
	if(/sub\s+(\w+)\s*{/){
		push(@magic, $1);
	}
}
close PROG;

$|=1;
for $f (@ARGV){
	$fstr = sprintf("%-15s\t", "$f:");
	undef $head; undef $HEAD;
	if ( !open(FILE, $f))
	{
	    $err = $fstr . $!;
	    warn "$err\n";
	    next;
	}
	$head = "";
	$r = read(FILE, $head, 512);
	if(!$r){ push(@unread, $f); next;}
	$yes = 0;
	$HEAD = $head;
	$HEAD =~ s/\n/ /g;
	for $try (@magic){
		if( eval "&$try" ){
			$yes = 1; last;
		}
	}
	if(!$yes){ push(@unread, $f);}
	close(FILE);
}

if(@unread){ system "/usr/bin/file @unread"; }

sub isgif {
        if($head =~ /^GIF8[79]a/){
#	   	print $fstr, unpack("aaaaa",$head), " image file\n";
#		($gif, $width, $height) = unpack('a5x1vv', $head);
		($gif, $a,$b,$c,$d) = unpack( 'a6C4', $head);
		$width = $b<<8|$a;
		$height = $d<<8|$c;
	   	print "$fstr $gif ", $width, "x$height image file\n";
	}
}

sub isjpeg {
	if($head =~ /^......JFIF/){
	    print $fstr, "JPEG compressed image file\n";
	}
}

sub isppm {
	if($head =~ /^(P[1-6])\s+/){
		local($type);
		if($1 eq 'P1'){$type = 'PBM';}
		if($1 eq 'P2'){$type = 'PGM';}
		if($1 eq 'P3'){$type = 'PPM';}
		if($1 eq 'P4'){$type = 'PBM "rawbits"';}
		if($1 eq 'P5'){$type = 'PGM "rawbits"';}
		if($1 eq 'P6'){$type = 'PPM "rawbits"';}
		print $fstr, "PPM $type image file\n";
	}
	elsif($head =~ /^P6\s/){
		printf $fstr, "Raw PPM image file\n";
	}
}

sub iscmd {
	if(-x $f && $head =~ /^#!(\s*)([\w\/-]*)/){
		print $fstr,"executable $2 commands text\n";
	}
}

sub iscompressed {
	if($head =~ /^\037\235/)
	{
		print $fstr, "compressed data";
		$c = unpack("x2C", $head);
		if ( $c & 0x80 )
		{
			$d = sprintf( "%d", $c & 0x1f);
			print " block compressed $d bits";
		}
	print "\n";
	}
}

sub isuudecode {
	if($head =~ /^begin/){ print $fstr, "uuencoded file\n";}
}

sub isbtoa {
	if($head =~ /^xbtoa/){print $fstr, "btoa'd file\n";}
}

sub isSunrasterfile {
	if($head =~ /^\131\246\152\225/){print $fstr, "Sun rasterfile\n";}
}

sub tiff {
	if($head =~ /^\115\115/){
		print $fstr, "TIFF file, big-endian\n";
	} elsif($head =~ /^\111\111/){
		print $fstr, "TIFF file, little-endian\n";
	}
}

sub ImageMagick {
	if($HEAD =~ /^\s*\{\s*(Imp.*)\}\s*id=ImageMagick/){
		print $fstr, "ImageMagic MIFF image file\n";
	}
}

sub PostScript {
	if($head =~ /^%!(PS-Adobe)*|TeXDict begin|\/showpage|\/\w+.*\sdef/){
		print $fstr, "PostScript file";
		local($creator) = $HEAD =~ /Creator:\s*([^%]*)\s+%%/;
		if ( defined($creator) )
		{
			print " (Created by $creator)";
		}
		print "\n";
	}
}

sub xfig {
	if($head =~ /^#FIG\s+([\d.]+)/){print $fstr, "xfig $1 data file\n";}
}

sub iv_doc {
	if($head =~ /^%(Doc-\d+\.\d+)/){print $fstr, "InterViews $1 file\n";}
}

sub ibuild {
	if($head =~ /^%I Unidraw/)
	{
	    print $fstr, "InterViews ibuild data file\n";
	}
}


sub mail_news {
	if($HEAD =~ /From:.*Newsgroups:\s*([^:]+)\s[A-Z]/)
	{
	   print $fstr, "Usenet news article ($1)\n";
	}
	elsif($HEAD =~ /From:.*To:/){print $fstr, "Email \n";}
}

sub ispic {
	if($head =~ /^\x34\x12/){ print $fstr, "PIC image file\n";}
}

sub isrcs {

	if ($head =~ /^head\s*([\d]+\.[\d]+);/ )
	{
		print $fstr, "RCS file (version $1)\n";
	}
}

sub iself {

	local(%format, %machine);
	local($offset);

	%format = (
	    0, ' unknown type',
	    1, ' relocatable',
	    2, ' executable',
	    3, ' dynamic lib',
	    4, ' core file'
	);

	%machine = (
	    0, ' unknown machine',
	    1, ' WE32100',
	    2, ' SPARC',
	    3, ' 80386',
	    4, ' M68000',
	    5, ' M88000',
	    6, ' 80486',
	    7, ' Intel 80860',
	    8, ' MIPS',          # RS3000_BE
	    9, ' UNKNOWN',
	   10, ' PSOS',          # RS3000_LE
	   11, ' RS6000',
	   12, ' UNKNOWN',
	   13, ' UNKNOWN',
	   14, ' UNKNOWN',
	   15, ' PA_RISC',
	   16, ' nCUBE',
	   17, ' VPP500',
	   18, ' SPARC32PLUS'
	);

	($type, $size, $endian, $format, $machine, $version, $mau) =
		unpack( "a4CCx10ssll", $head);

	if ( $type =~ /ELF/ )
	{
		print $fstr, "ELF";
		if ( $size == 1 )
		{
			print " 32-bit";
		}

		if ( $endian == 1 )
		{
			print " LSB";
		}
		elsif ( $endian == 2 )
		{
			print " MSB";
		}
		else
		{
			print " Invalid data encoding";
		}

		print $format{$format};
		print $machine{$machine};
		print " Version $version";

		if ( $format == 4 )
		{
			$fname = '';
			$offset = unpack("x56l", $head);
			$offset += 104;
			seek(FILE, $offset, 0);
			read(FILE, $fname, 16);
	    		$fname =~ s/\0.*//o;
			print ", from '$fname'";
		}

		if ( $mau == 1 )
		{
			print " MAU Required";
		}
		print "\n";
	}

}

sub isticoff {
	local($x, $y);

	#$x = unpack( "I", $head);
	#if ( $x == hex(93000900) )
	($x, $y) = unpack( "S2", $head);
	#if ( $x == hex(9300) && $y == hex(900))
	if ( $x == hex(9300) )
	{
	    print $fstr, "TI DSPC31 COFF file";
	    $x = unpack( "i", reverse substr($head,4,4));
	    print " - ", ctime($x), "\n";
	}
	elsif ( $x == hex(9200) )
	{
	    print $fstr, "TI DSPC51 COFF file";
	    $x = unpack( "i", reverse substr($head,4,4));
	    print " - ", ctime($x), "\n";
	}
}

sub isexe {
	local($x, $y);

	$x = unpack( "S", $head);
	if ( $x == hex('0x4d5a') )
	{
	    print $fstr, "DOS EXE file\n";
	}
}

sub ispdf {

	if ( $head =~ /%PDF/ )
	{
	    print $fstr, "PDF document\n";
	}

}

sub iscore {

#Sun OS style core files
	local($fname, $magic);
	$magic = unpack( "L", $head );
	if ( $magic == hex(80456) )
	{
	    $fname = unpack("A*", substr($head, 132));
	    $fname =~ s/\0.*//o;
	    print $fstr, "core file from '$fname'";
	    $signal = unpack("x116l", $head);
	    print " killed by $signal\n";
	}

}

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

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

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