[6589] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 214 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 1 12:27:17 1997

Date: Tue, 1 Apr 97 09:00:22 -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           Tue, 1 Apr 1997     Volume: 8 Number: 214

Today's topics:
     Re: 'flock' equivalent for NT <minaret@sprynet.com>
     Re: Dates before epoch (Steffen Beyer)
     Re: Debugger probs in 5.003_91/5.003_93 <larry@lccinc.com>
     Re: Debugger probs in 5.003_91/5.003_93 (Ilya Zakharevich)
     Re: Deleting a line from a file (Nathan V. Patwardhan)
     Re: Finding first day of a month (Steffen Beyer)
     Re: Functions and operators <tchrist@mox.perl.com>
     Re: gethostbyaddr ? (Matthew D. Healy)
     Re: Has anyone heard the rumour that Microsoft have bou <joneil@is.ssd.k12.wa.us>
     HELP!!!!!my cgi-bin don't work (Reye S A)
     Re: Help: date and time (Steffen Beyer)
     How do I terminate Notepad? <agavurin@ix.netcom.com>
     How to get an interactive socket? <vegardb@knoll.hibu.no>
     Re: interesting text formatting problem <bouletj@netrover.com>
     Re: Live Randal Schwartz interview <merlyn@stonehenge.com>
     Log base 10 <morronij@cse.psu.edu>
     Re: Oraperl CGI Problem! Help... (Garth Kennedy)
     overloading methods with xsubpp (Andreas Schmidt)
     Perl Syslog Problem <jeremy@xxedgexx.com>
     Re: Static compile on AIX ()
     Re: Static compile on AIX <minaret@sprynet.com>
     substituting with /g and simulating "lookbehind" (Michael Krell)
     Re: Where do I get 'h2n' perl script for unix <david@ti.com>
     Re: Why is no subscripting allowed in custom sort routi <dbenhur@egames.com>
     Re: win32 sendmail buckinm@nfric.nesusa.com
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 1 Apr 1997 15:54:32 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: 'flock' equivalent for NT
Message-Id: <01bc3eb4$d871bfe0$27a0aec7@cactus>

If the NT version of PERL supports the File IO package, you can create the
lock file using the EXCL (exclusive) flag.  It works the same as in 'C'. 
This would insure that only one program creates the lock file.  There are
problems, however.  The worst being a process that dies without removing
the lock file (you could check the file creation time and remove the file
if it gets more than so many minutes or seconds old).  The other problem is
with queuing.  If a few processes are competing to create the lock file,
any one of them might succeed and not the process that has been waiting the
longest.  Still, it generally works and it's the technique that a lot of
UNIX programs use (uucp, print spooler, serial ports, etc.).

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: 1 Apr 1997 14:40:04 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Dates before epoch
Message-Id: <5hr6o4$1n3$2@en1.engelschall.com>

Scott M. Crevier <smc@smcnet.com> wrote:
> I'm looking for suggestions on how to deal with dates before
> 01-Jan-1970. I've boiled down my needs into two practical examples:

> 1. If I was born on Nov 7, 1962, how can I calculate my age?
> 2. How can I find out what day of the week I was born on?

> Now, I can do both of the above with dates after the Nixon era, but
> I'm working with the Kennedy years.

Get the "Date::DateCalc" module from CPAN!

Then use the following:


use Date::DateCalc qw( day_of_week dates_difference );

$weekday = day_of_week(1962,11,7);
$days = dates_difference(1962,11,7,1997,4,1);


$weekday will be 1 = monday, 2 = tuesday, ..., 7 = sunday.

&day_name_tab($weekday); returns the names (in english) of the
corresponding days, i.e., "Monday", "Tuesday" etc.

$days will be the difference between both dates in days.

Hope this helps.

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


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

Date: Tue, 01 Apr 1997 09:48:24 -0500
From: Larry Prall <larry@lccinc.com>
Subject: Re: Debugger probs in 5.003_91/5.003_93
Message-Id: <33412038.32D2@lccinc.com>

Ilya Zakharevich wrote:
> Currently $_ is set to the executed code when <-actions are processed,
> so you basically got self-printing action ;-).
> 
> --- lib/perl5db.pl~     Tue Mar  4 17:15:47 1997
> +++ lib/perl5db.pl      Mon Mar 31 18:42:25 1997

Sorry, Ilya.  Missed the dates when I read this at home.  I thought you
were just showing me the change that caused the behavior, not showing me
how to fix it.  Took another look this morning at work, made the fix,
and it looks good.

The other problem I mentioned in the original post (the complete failure
of the debugger) went away when I took "tkRunning" out of my
environment.  (In earlier versions, I was able to leave it set with
impunity, though.)

Again, thanks for the fix.

Larry


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

Date: 1 Apr 1997 16:54:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger probs in 5.003_91/5.003_93
Message-Id: <5hrejr$ajp$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Prall 
<larry@lccinc.com>],
who wrote in article <33412038.32D2@lccinc.com>:
> The other problem I mentioned in the original post (the complete failure
> of the debugger) went away when I took "tkRunning" out of my
> environment.  (In earlier versions, I was able to leave it set with
> impunity, though.)

Ehjoy,
Ilya

--- lib/perl5db.pl~	Tue Mar  4 17:15:47 1997
+++ lib/perl5db.pl	Tue Apr  1 11:51:28 1997
@@ -1370,6 +1374,7 @@ sub setterm {
     if ($term->Features->{setHistory} and "@hist" ne "?") {
       $term->SetHistory(@hist);
     }
+    tkRunning($postponed_tkRunning) if defined $postponed_tkRunning;
 }
 
 sub readline {
@@ -1522,12 +1527,16 @@ sub ReadLine {
 }
 
 sub tkRunning {
+  if ($term) {
     if ($ {$term->Features}{tkRunning}) {
-        return $term->tkRunning(@_);
+      return $term->tkRunning(@_);
     } else {
-	print $OUT "tkRunning not supported by current ReadLine package.\n";
-	0;
+      print $OUT "tkRunning not supported by current ReadLine package.\n";
+      0;
     }
+  } else {
+    $postponed_tkRunning = shift;
+  }
 }
 
 sub NonStop {


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

Date: 1 Apr 1997 16:30:28 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Deleting a line from a file
Message-Id: <5hrd74$2v1@fridge-nf0.shore.net>

THIAM YEO (n1835173@sparrow.qut.edu.au) wrote:
:   Can anybody tell me how do I seach for a particular word in a text files
: and delete that whole line?

You don't delete it.  You skip it.  next if $line =~ /.../;

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 1 Apr 1997 14:51:28 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Finding first day of a month
Message-Id: <5hr7dg$1n3$3@en1.engelschall.com>

[mailed && posted]

Scott Kinard <skinnard@vcd.hp.com> wrote:
> Greetings,

>   I need a method to get the first day of the week for a given month
> during
> a year. There is a nifty way I found to do this in JavaScript, but I'm
> not
> using it for this particular problem, I'm using Perl.
> Here's the JavaScript method I'd like to emulate:

>  Start = new Date("March 1,1997");
>  Day = Start.getDay();

> In this case, Start.getDay() will return the day of the week as an
> integer
> where 0=Sunday, 1=Monday, etc. I know I could use the current day/date
> info
> returned from the Unix date command and count backwards and such to
> determine
> this value, however, I need this to work for any month/year, not just
> the 
> current one.

> Please email your suggestions to kinards@teleport.com

> Your help is appreciated,
> Scott

Solution in Perl:


use Date::DateCalc qw(:all);


(see http://www.engelschall.com/u/sb/download/ for this module!)


With help of the expression

    ($year,$mm,$dd) = first_in_week(week_number($year,$mm,$dd));

it is possible to easily calculate the date of the Monday belonging
to the week in which the given date lies.

(However, a fatal Perl error will occur if the given date is invalid!)

Alternatively, the expression

    ($year,$mm,$dd) =
    calc_new_date($year,$mm,$dd,-day_of_week($year,$mm,$dd)+1);

can be used to achieve the same effect.

(An empty list is returned if the given date is invalid.)


Hope this helps.

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


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

Date: 1 Apr 1997 15:14:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Functions and operators
Message-Id: <5hr8oq$91r$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    abigail@ny.fnx.com writes:
:On Mon, 31 Mar 1997 06:11:16 GMT, Mark wrote in comp.lang.perl.misc:
:++ The comma is a syntactic element, the same way a paren or a dollar
:++ sign is syntactic in certain contexts.  Comma is part of the syntax of
:++ a function/sub/etc
:
:Did you report it as an entry for the Camel errata list? The Camel
:thinks it's an operator. It even has a section about it.

Comma certainly can be an operator:

    $x = (3,10);

In a list context, of course, it's a list composer.  Interestingly, the
C language also has the distinction of comma in a sclar context acting
differently than it does in a list one, but no one seems to complain
much about it there.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


Hi, this is Ken. What's the root password?


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

Date: Tue, 01 Apr 1997 10:43:59 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: gethostbyaddr ?
Message-Id: <Matthew.Healy-0104971043590001@pudding.med.yale.edu>

In article <333F8279.2463@lustudat.student.lu.se>,
LGR96JAL@lustudat.student.lu.se wrote:

> Hi!
> 
> Anyone know of how to invoke and print out the result for 
> gethostbyaddr?

[The Perl script I use for this]

#!/usr/local/bin/perl
while (<STDIN>) {
$ip_address = $_;
chop($ip_address);
print "$ip_address \t";
@numbers = split(/\./, $ip_address);
$ip_number = pack("C4", @numbers);
($name) = (gethostbyaddr($ip_number, 2))[0];
print "$name \n";
}

[from the gethostbyaddr manpage on a SunOS system]

          struct    hostent {
               char *h_name;  /* official name of host */
               char **h_aliases;   /* alias list */
               int  h_addrtype;    /* address type */
               int  h_length; /* length of address */
               char **h_addr_list; /* list of addresses from name server */
          };

     The members of this structure are:

     h_name              Official name of the host.

     h_aliases           A zero  terminated  array  of  alternate
                         names for the host.

     h_addrtype          The  type  of  address  being  returned;
                         currently always AF_INET.

     h_length            The length, in bytes, of the address.

     h_addr_list         A pointer to a list of network addresses
                         for  the named host.  Host addresses are
                         returned in network byte order.


[From /usr/include/sys/socket.h on a SunOS box]

/*
 * Address families.
 */
#define AF_UNSPEC       0               /* unspecified */
#define AF_UNIX         1               /* local to host (pipes, portals) */
#define AF_INET         2               /* internetwork: UDP, TCP, etc. */
#define AF_IMPLINK      3               /* arpanet imp addresses */
#define AF_PUP          4               /* pup protocols: e.g. BSP */
#define AF_CHAOS        5               /* mit CHAOS protocols */
#define AF_NS           6               /* XEROX NS protocols */
#define AF_NBS          7               /* nbs protocols */
#define AF_ECMA         8               /* european computer manufacturers */
#define AF_DATAKIT      9               /* datakit protocols */
#define AF_CCITT        10              /* CCITT protocols, X.25 etc */
#define AF_SNA          11              /* IBM SNA */
#define AF_DECnet       12              /* DECnet */
#define AF_DLI          13              /* Direct data link interface */
#define AF_LAT          14              /* LAT */
#define AF_HYLINK       15              /* NSC Hyperchannel */
#define AF_APPLETALK    16              /* Apple Talk */
#define AF_NIT          17              /* Network Interface Tap */
#define AF_802          18              /* IEEE 802.2, also ISO 8802 */
#define AF_OSI          19              /* umbrella for all families used
                                         * by OSI (e.g. protosw lookup) */
#define AF_X25          20              /* CCITT X.25 in particular */
#define AF_OSINET       21              /* AFI = 47, IDI = 4 */
#define AF_GOSIP        22              /* U.S. Government OSI */
#define AF_MAX          21

Hope this helps!

---------
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
"But I thought it was pointed at the rabbit *between* my feet!"


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

Date: Tue, 01 Apr 1997 08:17:20 -0800
From: Jerome O'Neil <joneil@is.ssd.k12.wa.us>
Subject: Re: Has anyone heard the rumour that Microsoft have bought Perl?
Message-Id: <33413510.2246@is.ssd.k12.wa.us>

Jonathan Tracey wrote:
> 
> The good authority is a Manager at Microsoft in the  US, maybe more to this
> than meets the eye.

HAHAHAHAHAHAHAHAHAHAHAH!!!!!!!!!!

Hey, I have a bridge in New York for sale.  Interested?

Jerome


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

Date: 25 Mar 1997 23:10:40 GMT
From: c9608753@alinga.newcastle.edu.au (Reye S A)
Subject: HELP!!!!!my cgi-bin don't work
Message-Id: <5h9m1g$jot@seagoon.newcastle.edu.au>

cgi-bin, perl:

--- 
I am having trouble setting up my cgi-bin directory.  It is currently
set to drwxr_xr_x and the perl scripts are set the same (minus the d of
course) but browsers only read them as test files and fail to execute
them.  Could someone please help.


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

Date: 1 Apr 1997 14:28:25 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Help: date and time
Message-Id: <5hr629$1n3$1@en1.engelschall.com>

Alex Mak <amak@ernie.eecs.uic.edu> wrote:

> I am hoping to write a sub that would take
> a year and a month as parameters and return the
> day of the week of that month.

> i.e:

>    print 'first day of month: ', &firstDayOfMonth(3,1997);  

> would return 6 for saturday.

> what is my best approach?

Get yourself the module "Date::DateCalc" from CPAN!

Then go about your problem as follows:


use Date::DateCalc qw(day_of_week);

sub firstDayOfMonth
{
    croak "Usage: $weekday = firstDayOfMonth($month,$year);"
      if (@_ != 2);

    my($month,$year) = @_;

    return(day_of_week($year,$month,1)-1);
}


"day_of_week($year,$month,$day)" returns:
1 = monday, 2 = tuesday, ..., 7 = sunday.

(this is the reason for the "-1" above)

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


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

Date: Tue, 01 Apr 1997 10:19:45 -0500
From: Arnold Gavurin <agavurin@ix.netcom.com>
Subject: How do I terminate Notepad?
Message-Id: <33412791.78AF@ix.netcom.com>

Using perl 5 on win32, I am trying to open notepad, then 

close it after a certain amount of time.  I can 

successfully open notepad, but I cannot get it to close.  

How can I force notepad to close?

The code that is supposed to close notepad is:

   
        $ProcessObj->Wait(10000) || die &Error;

# Set to wait 10 seconds (10000 ms) and then quit


The entire piece of code is the example given in the win32 

doc file in 'win32mod.htm'

Help!

Arnold Gavurin


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

Date: Tue, 01 Apr 1997 17:13:44 +0200
From: Vegard Bakke <vegardb@knoll.hibu.no>
Subject: How to get an interactive socket?
Message-Id: <33412628.3C3@knoll.hibu.no>

I'd like to programm a Server, where a human Client should be able to
write commands, and get some interactive response.

The script I have written lets the user type _all_ the commands, before
it prints all the output.

I'm using perl 5.003 on HP-UX 10.10.

Here's a znipped version of my script:

  socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
  setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l",1)) 
                                           or die "setsockopt: $!";
  bind(Server, sockaddr_in($port, INADDR_ANY))   or die "bind: $!";
  listen(Server, SOMAXCONN)                     or die "listen $!";
 ...
  while ( $shutdwn == "0" ) {
    $paddr = accept(Client,Server); 
    my($port,$iaddr) = sockaddr_in($paddr);
    my $name = gethostbyaddr($iaddr,AF_INET);

    print Client "Hello $name!\nIt's now ", scalar localtime, "\n";
    $string = <Client>;
    chomp($string);
    print Client "Your input: $string\n";
 ...


I'v just started learning socket programming, so any help would be
appreciated.


Vegard

-- 
                           Vegard Bakke,
                       vegard.bakke@hibu.no
               Kirkegata 9, 3600 Kongsberg, Norway

   "My spelling is Wobbly.  It's good spelling but it Wobbles, 
and the letters get in the wrong places."      --  Winnie the Pooh


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

Date: Tue, 01 Apr 1997 11:17:42 -0500
From: meJane <bouletj@netrover.com>
Subject: Re: interesting text formatting problem
Message-Id: <33413526.4C85@netrover.com>

Paul Havemann wrote:
> 
> Phil Stripling (philip@remove.crl.com) wrote:
> : On 26 Mar 1997, Eric Litman wrote:
> :
<snip>
> : > What I'd like to do is remove the HTML codes while retaining the
> : > original paragraph "shape" (i.e. formatted to 75 columns).
<snip>
> 
> Or try one of the HTML to Text converters referenced at
> 
>  http://www.w3.org/pub/WWW/Tools/html2things.html

> 
> Paul Havemann, VP     (paul@hsh.com)


Or, what would happen if you used a generic text printer and printed to
file.  We do this with Word Perfect files and it converts the entire
document, including headers and line numbering, into an exact duplicate
ascii file, substituting spaces for the codes.  Might it not work for
HTML.  Have not tried it but plan to soon.
-- 
meJane - for return mail, remove one of the stuttering j's
         http://www.netrover.com/~bouletj/


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

Date: 01 Apr 1997 06:32:26 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "J. Trudel" <jdt@insight.att.com>
Subject: Re: Live Randal Schwartz interview
Message-Id: <8cu3lq7tsl.fsf@gadget.cscaper.com>

>>>>> "J" == J Trudel <jdt@insight.att.com> writes:

J> For some reason, I saw this and wondered what a Dead Randal
J> Schwartz interview would be like.

About 14 fewer bad puns, but no change in the overall quality of the
jokes.

:-)
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 01 Apr 1997 11:39:38 -0500
From: Lawrence Morroni Jr <morronij@cse.psu.edu>
Subject: Log base 10
Message-Id: <33413A4A.6C5E@cse.psu.edu>

I need to use the Log base 10 function for an experiment I am doing
using perl.  I see that Log base e is built in to the language, but
can't seem to find anythign on base 10.  Any suggestions?


thanx in advance.

Larry Morroni 
lam170@psu.edu
http://www.cse.psu.edu/~morronij


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

Date: Tue, 1 Apr 1997 13:30:20 GMT
From: garth@viola.comm.mot.com (Garth Kennedy)
Subject: Re: Oraperl CGI Problem! Help...
Message-Id: <1997Apr1.133020.21208@schbbs.mot.com>

How about giving it a Database name, login ID and password ?

You may also want to switch to perl5 using DBI and DBD-Oracle.
Better performance and more flexibility (on the perl side).
You should not have to change your oraperl code. 

Garth

In article <33402945.68F2@globalserve.net>,
Angus Lai  <orange@globalserve.net> wrote:
>Dear friends,
>
>        I using oraperl to retrieve data from oracle, the following code
>work
>well on unix prompt (By typing ./ScriptName to test). 
>-----------------------------------------------------------
>#!/usr/local/bin/oraperl
>
>require 'cgi-lib.pl';
>print &PrintHeader;
>
>$CityGetBrife = "select address from TABLE where upper(city)  like
>%TORONTO%";
>#Connect  Oracle 
>  $lda = &ora_login($DataBase, $ID, $Pass)||print "login error
>:$ora_errstr<p>\n";
>
>  #open and send SQL
>  $csr = &ora_open($lda, $CityGetBrife, 6)||print "Open Error :
>$ora_errstr<p>\n";  
>  while(($tra) = &ora_fetch($csr)) {
>        push(@BranchList, $tra);
>  }
>  print @BranchList;
>
> do ora_close($csr) || die "can't close cursor";
> do ora_logoff($lda) || die "can't log off Oracle";
>------------------------------------------------------------
>But When I run the program with web
>broswer(http://domain/ScriptName.pl), It cannot login Oracle. 
>$ora_errstr is : Error while trying to retrieve text for error ORA-12546
>
>Dear friend, What is this error message means? can u think of some
>solution? What's happening? 
>   Thanks A LOT.
>
>-Angus




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

Date: 1 Apr 1997 15:24:29 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
Subject: overloading methods with xsubpp
Message-Id: <5hr9bd$1hd$1@nz12.rz.uni-karlsruhe.de>
Keywords: method overloading, xsubpp, c++

hi,

i'am currently developing an interface for the objectstore database (c++ - api).
i wrote some perl-scrips that parse the objectstore include files to build the
xs-files for me. my problem is now, that the xsubpp-compiler does not allow
method overloading. so i have for example three methods to open a database with
different parameters:

	void 
	os_database::open(para_0= 0)
	        os_boolean                       para_0
	        CODE:
	        THIS->open(para_0);

	static os_database * 
	os_database::open(para_0,para_1= 0,para_2= 0)
	        const char *                     para_0
	        os_boolean                       para_1
	        os_int32                         para_2
	        CODE:
	        RETVAL=os_database::open(para_0,para_1,para_2);
	        OUTPUT:
	        RETVAL


	static os_database * 
	os_database::open(para_0,para_1,para_2,para_3)
	        const char *                     para_0
	        os_boolean                       para_1
	        os_int32                         para_2
	        os_database *                    para_3
	        CODE:
	        RETVAL=os_database::open(para_0,para_1,para_2,para_3);
	        OUTPUT:
	        RETVAL

in this case, all the methods have different numbers of parameters, so perhaps i
could them distinguish with the 'item' variable. but in other cases, the number
of parameters is equal to differnt methods.

has anyone experience with this kind of problem?

any help or workaround would be helpfull

thanks in advance
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)
          http://miserv1.iai.fzk.de/Institut/MI/mitarbeiter/schmidt.html



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

Date: 1 Apr 1997 14:27:30 GMT
From: Jeremy Hansen <jeremy@xxedgexx.com>
Subject: Perl Syslog Problem
Message-Id: <33411B52.5E40@xxedgexx.com>

I'm having a problem with syslog().  It's pretty straight forward.  I
have
a server program and I would like connect messagesand log messages to go
to syslog as info, and I'm having problems with this for some reason.
 
First, here's my code for the server:
 
#!/usr/local/bin/perl -Tw
#
#jeremy@xxedgexx.com
 
require 5.002;
#use strict;
BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
use Socket;
use Carp;
use FileHandle;
use Sys::Syslog;
 
sub spawn; # forward declaration
  sub logmsg {
#       print "$0 $$: @_ at ", scalar localtime, "\n";
        syslog('info', "$0 $$: @_"); # Here's my syslog call which
                                     # according to others, should work
                                     # fine.
  } 
my $port = shift || 2345;
my $proto = getprotobyname ('tcp');
socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))
                                        or die "setsockopt: $!";
bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";   
listen(Server, SOMAXCONN)               or die "listen: $!";
                                     
logmsg "server started on port $port";
 
my $waitedpid = 0;
my $paddr;
 
sub REAPER {
   $waitedpid = wait;
   $SIG{CHLD} = \&REAPER; # if you don't have sigaction(2)
   logmsg "reaped $waitedpid" . ($? ? " with exit $?" : "");
}                                    
$SIG{CHLD} = \&REAPER;
 
for( ; $paddr = accept(Client, Server); close Client) {
        my($port,$iaddr) = sockaddr_in($paddr);
        my $name = gethostbyaddr($iaddr, AF_INET);
 
        logmsg "connect from $name [", inet_ntoa($iaddr), "] at port
$port";
   
    spawn sub {
        print "Hello $name, it's now ", scalar localtime, "\n\n";
        exec '/usr/bin/who'
          or confess "can't exec fortune: $!";
   };
}
 
sub spawn {
   my $coderef = shift;
   
   unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') {
      confess "usage: spawn CODEREF";
   }
 
   my $pid;
   if (!defined($pid = fork)) {
      logmsg "cannot fork: $!";
      return;
   } elsif ($pid) {
      logmsg "begat $pid";
      return; # i'm the parent
   }
   #else i'm the child -- go spawn
 
   open(STDIN, "<&Client")      or die "can't dup client to stdin";
   open(STDOUT, ">&Client")     or die "can't dup client to stdout";
   STDOUT->autoflush();
   exit &$coderef();
}
   
      
Now here's the error I receive when executing this program.
   
Undefined subroutine &Sys::Syslog::hostname called at
/usr/lib/perl5/Sys/Syslog.pm line 92.
BEGIN failed--compilation aborted at ./ser2.pl line 11.
 
Any help would be appreciated.


I'm using Redhat 4.1, perl5.003

Thanks


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

Date: 1 Apr 1997 14:36:10 GMT
From: mhm@dax.austin.ibm.com ()
Subject: Re: Static compile on AIX
Message-Id: <5hr6gq$1bq2$1@ausnews.austin.ibm.com>

jason kruse (jason.kruse@teldta.com) wrote:
: Good day.  I am attempting to link in the DBD module to create a
: statically linked perl for a program which will access an oracle
: database (7.2.3) and be called from within a C program.  I know there is
: an easier way to do this, but I want the C and perl to be separate to
: allow others in my group to be able to modify the program as needed.

: I created first a statically linked perl with the DBI module in the
: perl_home/ext directory.  This seemed to work fine.  However, when I now
: try to add in the DBD module I get unknown symbol errors, most of which
: I have tracked down properly.

: The symbols I can't access are the following:

: 0706-317 ERROR: Unresolved or undefined symbols detected:
:                  Symbols in error (followed by references) are
:                  dumped to the load map.
:                  The -bloadmap:<filename> option will create a load map.
: .__mulh
: .__divus
: .__quous
: .__divss
: .__quoss

These symbols are part of the common mode compiler, which indicate that your perl 
was probably built on an AIX 4.x system and moved down or that the compiler from 
the 4.x system was used to upgrade the 3.x system.  Create the file 
"/usr/lib/lowsys.exp" and the following:

   #!
   __mulh			0x3100
   __mull			0x3180
   __divss			0x3200
   __divus			0x3280
   __quoss			0x3300
   __quous			0x3380

(indented for clarity) or copy /usr/lib/lowsys.exp from your neighborhood 4.x
machine.

: osndfn
: osntab


These two symbols are probably defined with the rest in libsqlnet.a but are
not referenced before they are seen, as such the linker will not include
them in the current object.  Simpliest option is to link against the 
library a second time.

Mike
--
----------------------------------------------------------------------
Michael H. Moran                  | Standard Disclaimer:  The content 
mhm@austin.ibm.com                | of this posting is independent of 
IBM Corporation, Austin, Texas    | official IBM position.


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

Date: 1 Apr 1997 16:06:24 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Static compile on AIX
Message-Id: <01bc3eb6$83be7b80$27a0aec7@cactus>

> Good day.  I am attempting to link in the DBD module to create a
> statically linked perl for a program which will access an oracle
> database (7.2.3) and be called from within a C program.  I know there is
> an easier way to do this, but I want the C and perl to be separate to
> allow others in my group to be able to modify the program as needed.

The Bull Group has a site with AIX binaries at http://www.bull.de/pub/ that
may be of help.

-- 
Geoff Mottram
minaret@sprynet.com



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

Date: Tue, 1 Apr 1997 15:02:18 GMT
From: mk2h@clove.cs.Virginia.EDU (Michael Krell)
Subject: substituting with /g and simulating "lookbehind"
Message-Id: <E7ysFu.K0H@murdoch.acc.Virginia.EDU>

I'm trying to write a regex that will strip out all occurances of the "{"
character from a string, unless the brace is immediately preceded by a
backslash. 

My first stab at this is:  $string =~ s|([^\\])\{|$1|g;

However, this fails in a couple of ways (that I know of).  The first way it
fails is when the brace is the first character in the string, e.g., "{abc".
I understand why this fails (there is no match of the pattern since the brace
is always consumed by the character class).

I'm confused by the second failure case, as illustrated by the code snippet
below: 

$string="a{{bc";
print "string is $string\n";
$string =~ s|([^\\])\{|$1|g;
print "after substitution, string is $string\n";

Which prints:

string is a{{bc
after substitution, string is a{bc

Why aren't both braces stripped?  It's as if the regex engine thinks the
second brace is at the beginning of the string and is consuming it with the
character class as in the first failure case.  But why should this happen?  I
would expect the substitution to take place, so that the character class
matches the "a" for the second brace.  Even if the substitution doesn't
immediately take place, then shouldn't the first brace match the character
class for the second brace?

Can someone explain this? 

What I really would like to do is simulate a "negative lookbehind" assertion.
Can someone help me with a regex that covers these cases?

BTW, I'm using ActiveWare's perl for win32 port build 302, based on
perl 5.003_07.

    Thanks,
    Mike
    mk2h@virginia.edu




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

Date: Tue, 01 Apr 1997 07:58:58 -0600
From: "David P. Huff" <david@ti.com>
To: michael <mike_hayden@inetuk.wang.com>
Subject: Re: Where do I get 'h2n' perl script for unix
Message-Id: <334114A2.4D1F@ti.com>

michael wrote:

  Dear All,

  I'm trying to locate the 'h2n' hosts-to-name perl tool for use in
  publishing DNS files on a Unix system.

Michael,

I found a copy on Andras Salamon's "DNS Resources Directory" Web page in
the "tools" section:

  http://www.dns.net/dnsrd/tools.html

You might also check one of the CPAN sites...

Regards,
David Huff
Texas Instruments, Inc.
david@ti.com



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

Date: Sun, 30 Mar 1997 11:39:38 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: "Eric D. Friedman" <friedman@medusa.acs.uci.edu>
Subject: Re: Why is no subscripting allowed in custom sort routines?
Message-Id: <333EC17A.2120@egames.com>

[mail&post]
Eric D. Friedman wrote:
> Consequently the following does not work:
> my $routine = sub { $a cmp $b };
> my @sorted_foo = sort &$routine @foo;

How about:
  my @sorted_foo = sort {&$routine} @foo;

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"It's better to be lucky than good."  -- Elizabeth Bourne



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

Date: Tue, 01 Apr 1997 09:51:21 -0600
From: buckinm@nfric.nesusa.com
Subject: Re: win32 sendmail
Message-Id: <859909721.18569@dejanews.com>

In article <3340b0a5.118988218@news.gte.net>,
  vkoser@biggun.com (Vincent Koser) wrote:
>
> I have many scripts from unix that I am openeing a file to sendmail
> like so.
>
> open(SENDMAIL, "|/usr/sbin/sendmail $email")|| die "Can't use
> sendmail!\n";
>
> is there a way to accomplish this functionality in win32?  I guess if
> there were an smtp mail module or something that would do it.
>
> any help is greatly appreciated.
> thanks, please cc email on reply if you can.
> vince

You can use Blat for Win32.  It's sendmail-like at least, and works
pretty good for me.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

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

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