[10709] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4308 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 27 13:07:23 1998

Date: Fri, 27 Nov 98 10:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 27 Nov 1998     Volume: 8 Number: 4308

Today's topics:
    Re: directory content with files size (Tad McClellan)
    Re: directory content with files size (Tad McClellan)
    Re: directory content with files size <jdporter@min.net>
    Re: HELP! need help in regex for multiple word search <rick.delaney@shaw.wave.ca>
    Re: HELP! need help in regex for multiple word search <andy@focus-consulting.co.uk>
    Re: HELP! need help in regex for multiple word search <andy@focus-consulting.co.uk>
    Re: HELP! need help in regex for multiple word search <r28629@email.sps.mot.com>
    Re: HELP!!! REAL simple script doesn't work! (Larry Rosler)
    Re: Help..I'm Way Over My Head <plynch@bbss.com>
    Re: HTMLgen for perl... dave@mag-sol.com
    Re: Lexical var in nested sub <jdporter@min.net>
        Newbie: Need to split comma-delimited data into scalars tcpeter@iname.com
    Re: Obfuscation of perl scripts <peter.shea@parkside.demon.co.uk>
    Re: Obfuscation of perl scripts <jeromeo@atrieva.com>
        Password Protected Sites ? <philip.class@popcorn-studio.ch>
    Re: Perl Scripting Error (I.J. Garlick)
        problem with syslog.pl under Windos NT <akara@cybernet-ag.net>
    Re: problem (Tad McClellan)
    Re: read from a program ? (Luc Rosier)
        Running Perl scripts as NT services <carvdawg@patriot.net>
    Re: Running Perl scripts as NT services (David Cantrell)
    Re: Serial programming question dan_stefura@mad.scientist.com
        Threads/Solaris/Compile/Perl-5.005_02 <dstaggs@vumclib.mc.vanderbilt.edu>
    Re: Threads/Solaris/Compile/Perl-5.005_02 <qdtcall@esb.ericsson.se>
    Re: Timeout on CGI-scripts that may block (Bernie Cosell)
        Trouble using format (newbie) <pauljr@nt.com>
    Re: trying to print ALL keys in symbol table <r28629@email.sps.mot.com>
    Re: writing to a 9-track tape w/perl <lusol@Pandora.CC.Lehigh.EDU>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 26 Nov 1998 21:41:26 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: directory content with files size
Message-Id: <617l37.8t9.ln@flash.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <n6oh37.cv.ln@flash.net> on Wed, 25 Nov 1998 14:09:59 -0600, 
: Tad McClellan <tadmc@flash.net> says...
: > Mike Quin (m.r.quin@stir.ac.uk) wrote:
: ....
: > : $filesize=(-s "$filename");
: > 
: >    You have four characters there that serve no purpose other
: >    than obfuscating what is going on.
: > 
: >       $filesize = -s $filename;
: .... 
: >    The parenthesis are even worse, they build a list.
: > 
: >    When used in a scalar context (as they are in this example),
: >    the last element is returned. Still works because the list
: >    you are building has only one element in it. But why build
: >    a list when you don't need a list?
: > 
: >       $filesize=(-s $filename, -s $some_other_filename);
: > 
: >    $filesize gets the size of $some_other_filename...

: Can anyone support the contention that a list is built by these 
: parentheses in scalar context?  I have never used the debugger, let 
: alone to trace the actions of the compiler.

: I think that parentheses in scalar context affect binding precedence 
: only.  Thus:

:         $filesize = -s $filename, -s $some_other_filename;

:      $filesize gets the size of $filename, and the second expression is 
: evaluated and discarded.  With the parentheses, the first expression is 
: evaluated and discarded, and $filesize gets the size of 
: $some_other_filename.  No list.


   That may be true.

   Anybody? Anybody? Buehler?

   Too bad most of Those Who Would Know aren't here anymore reading
   Frequently Asked Questions and questions about server setup
   and other silly stuff  ;-(


   Let's name the two alternatives here:

   1) parens for controlling precedence with the 'C' style comma operator

   2) parens for constructing a list with commas to separate list elements


   If #1 is how perl interprets it, then does the act of taking a 
   slice change the interpretation of the parens into #2?

      $filesize=(-s $filename, -s $some_other_filename)[1];

   Hmmm. I dunno...



   Reading the below excerpts from the perldata man page, 
   it sounds like #1 and #2 are the same thing! ??
   

--------------------
If you evaluate a named array in a scalar context, it returns the length of
the array.  (Note that this is not true of lists, which return the
last value, like the C comma operator, nor of built-in functions, which return
whatever they feel like returning.)  The following is always true:
--------------------


--------------------
=head2 List value constructors

List values are denoted by separating individual values by commas
(and enclosing the list in parentheses where precedence requires it):

    (LIST)

In a context not requiring a list value, the value of the list
literal is the value of the final element, as with the C comma operator.
--------------------


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


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

Date: Fri, 27 Nov 1998 08:56:44 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: directory content with files size
Message-Id: <cjem37.g1c.ln@flash.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <n6oh37.cv.ln@flash.net> on Wed, 25 Nov 1998 14:09:59 -0600, 
: Tad McClellan <tadmc@flash.net> says...
: > Mike Quin (m.r.quin@stir.ac.uk) wrote:
: ....
: > : $filesize=(-s "$filename");
: > 
: >    You have four characters there that serve no purpose other
: >    than obfuscating what is going on.
: > 
: >       $filesize = -s $filename;
: .... 
: >    The parenthesis are even worse, they build a list.
: > 
: >    When used in a scalar context (as they are in this example),
: >    the last element is returned. Still works because the list
: >    you are building has only one element in it. But why build
: >    a list when you don't need a list?
: > 
: >       $filesize=(-s $filename, -s $some_other_filename);
: > 
: >    $filesize gets the size of $some_other_filename...

: Can anyone support the contention that a list is built by these 
: parentheses in scalar context?  


   No, but I think I can disprove my own contention...


: I have never used the debugger, let 
: alone to trace the actions of the compiler.

: I think that parentheses in scalar context affect binding precedence 
: only.  Thus:

:         $filesize = -s $filename, -s $some_other_filename;

:      $filesize gets the size of $filename, and the second expression is 
: evaluated and discarded.  With the parentheses, the first expression is 
: evaluated and discarded, and $filesize gets the size of 
: $some_other_filename.  No list.


---------------------------
#!/usr/bin/perl -w

$x = (foo(1), foo(1));

@x = (foo(2), foo(2));

$x = (foo(3), foo(3))[1];


sub foo {
   if ( wantarray() )
      {print "$_[0]: list context\n"}
   else
      {print "$_[0]: scalar context\n"}
}
---------------------------

outputs:

1: scalar context
1: scalar context
2: list context
2: list context
3: list context
3: list context



   Parens must NOT be constructing a list in case #1.


   Looks like you are right Larry. (again!)


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


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

Date: Fri, 27 Nov 1998 11:28:25 -0500
From: John Porter <jdporter@min.net>
Subject: Re: directory content with files size
Message-Id: <365ED329.AE10501E@min.net>

I would like to point out that it is legitimate (IMHO) for "list"
to mean, in some contexts, a *lexical* list, vs. an actual run-time
data structure.  It is very difficult to talk about the paren-enclosed,
comma-separated lexical elements in the following line, without calling
it a "list":  $a = ( foo(), $bar, $x*$y );

John Porter


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

Date: Fri, 27 Nov 1998 13:37:34 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: HELP! need help in regex for multiple word search
Message-Id: <365EACD1.10ECEEE3@shaw.wave.ca>

[posted & mailed]

Kenneth Ban wrote:
> 
> Hi,
> 
>     I'm a novice user of Perl, and I'm trying very hard to get a regex 
> for searching 2 words in a line of test.. i.e.
> 
> in line of text 'nature scenery animals birds heron'

While it's possible to do a lot of things in one regex, it's often
easier and clearer to use more than one.

    $_ = 'nature scenery animals birds heron';
    print "matched\n" if (/nature/ && /heron/);


-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Fri, 27 Nov 1998 15:29:17 +0000
From: Andy Mendelsohn <andy@focus-consulting.co.uk>
Subject: Re: HELP! need help in regex for multiple word search
Message-Id: <365EC54D.D682329A@focus-consulting.co.uk>

Kenneth Ban wrote:
> 
> Hi,
> 
>     I'm a novice user of Perl, and I'm trying very hard to get a regex for
> searching 2 words in a line of test.. i.e.
> 
> in line of text 'nature scenery animals birds heron'
> 
> i intend to search for 'nature' and 'heron'
> so far i've tried /nature|heron/ but it gives me any other line with the
> occurence of nature OR heron
> hope someone can help me. Thanks in advance...u can email me at
> kban@pacific.net.sg
> 
> Kenneth
> Singapore

try something like :

	print "found\n" if (/(birds|heron).*(birds|heron)/);

hth

andy


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

Date: Fri, 27 Nov 1998 15:43:36 +0000
From: Andy Mendelsohn <andy@focus-consulting.co.uk>
Subject: Re: HELP! need help in regex for multiple word search
Message-Id: <365EC8A8.4D9B06AD@focus-consulting.co.uk>

Andy Mendelsohn wrote:
> 
> Kenneth Ban wrote:
> >
> > Hi,
> >
> >     I'm a novice user of Perl, and I'm trying very hard to get a regex for
> > searching 2 words in a line of test.. i.e.
> >
> > in line of text 'nature scenery animals birds heron'
> >
> > i intend to search for 'nature' and 'heron'
> > so far i've tried /nature|heron/ but it gives me any other line with the
> > occurence of nature OR heron
> > hope someone can help me. Thanks in advance...u can email me at
> > kban@pacific.net.sg
> >
> > Kenneth
> > Singapore
> 
> try something like :
> 
>         print "found\n" if (/(birds|heron).*(birds|heron)/);
> 
> hth
> 
WHOOPS!

that will match birds birds as well as heron heron..
(and you wanted nature not heron!)

try this :
 /(nature.*heron)|(heron.*nature)/
> andy


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

Date: Fri, 27 Nov 1998 10:45:46 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Andy Mendelsohn <andy@focus-consulting.co.uk>
Subject: Re: HELP! need help in regex for multiple word search
Message-Id: <365EC923.348195C3@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Andy Mendelsohn wrote:
> 
> Andy Mendelsohn wrote:
> >
> > Kenneth Ban wrote:
> > >
> > > Hi,
> > >
> > >     I'm a novice user of Perl, and I'm trying very hard to get a regex for
> > > searching 2 words in a line of test.. i.e.
> > >
> > > in line of text 'nature scenery animals birds heron'
> > >
> > > i intend to search for 'nature' and 'heron'
> > > so far i've tried /nature|heron/ but it gives me any other line with the
> > > occurence of nature OR heron
> > > hope someone can help me. Thanks in advance...u can email me at
> > > kban@pacific.net.sg
> > >
> > > Kenneth
> > > Singapore
> >
> > try something like :
> >
> >         print "found\n" if (/(birds|heron).*(birds|heron)/);
> >
> > hth
> >
> WHOOPS!
> 
> that will match birds birds as well as heron heron..
> (and you wanted nature not heron!)
> 
> try this :
>  /(nature.*heron)|(heron.*nature)/
> > andy

For the sake of effeciency and readability, breaking up the regex (as pointed
out by Rick D.) seems like a better choice. Besides, you never know when you
are going to seach for 'animals' too ;-)

#--------------------------------------
#!/usr/loca/bin/perl -w

use Benchmark;
$line = 'nature scenery animals birds heron';
    
timethese(20000, {
    separate => sub {
        for ($line) {
            $i=1 if (/nature/ && /heron/); 
        }
    },
    sep_rev => sub {
        for ($line) {
            $i=1 if (/heron/ && /nature/); 
        }
    },
    compound => sub {
        for ($line) {
            $i=1 if /(heron.*nature)|(nature.*heron)/;
        }
    },
    comp_rev => sub {
        for ($line) {
            $i=1 if /(nature.*heron)|(heron.*nature)/;
        }
    },
  }
);

__END__

Benchmark: timing 20000 iterations of comp_rev, compound, sep_rev, separate...
  comp_rev:  3 wallclock secs ( 3.42 usr +  0.00 sys =  3.42 CPU)
  compound:  4 wallclock secs ( 3.53 usr +  0.00 sys =  3.53 CPU)
   sep_rev:  3 wallclock secs ( 2.48 usr +  0.00 sys =  2.48 CPU)
  separate:  2 wallclock secs ( 2.47 usr +  0.00 sys =  2.47 CPU)

#--------------------------------------

-TK


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

Date: Fri, 27 Nov 1998 09:16:50 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP!!! REAL simple script doesn't work!
Message-Id: <MPG.10c87e6041a7b4b1989929@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <73llfi$g8j$1@nnrp1.dejanews.com> on Fri, 27 Nov 1998 
07:48:05 GMT, ptimmins@netserv.unmc.edu <ptimmins@netserv.unmc.edu> 
says...
> In article <73kpdu$r2s$1@nnrp1.dejanews.com>,
>   lkleiner@perfectsolve.com wrote:
 ...
> > #!/usr/bin/perl
> > print "Conent-type: text/html\n\n";
> > print "query string=$ENV{'$QUERY_STRING'}";
 ...
> use CGI q/:all/;
> print header, query_string;
> 
> Score another point in favor of using CGI.pm ( sorry Larry :)

When run several times on my webserver on Windows NT, the first program 
(corrected, of course) averages about 0.03 sec of CPU to load and 
nothing to execute.  The second program averages in addition about 0.2 
sec of CPU to initialize and 0.1 sec to execute -- about 10 times 
longer, in total.

BEGIN { $t0 = (times)[0]; }       # Load time.
$t1 = (times)[0] - $t0;  # Initialize time, because 'use' happens first.
#...two lines of code to be measured...
$t2 = (times)[0] - $t1;  # Execute time.
print "$t0 $t1 $t2\n";

Considering that most CGI programs are short and are run often, these 
overheads may be considered very significant.  Elephants are large, 
powerful, slow, and ponderous, and aren't very good at cracking peanuts 
-- they gobble them whole.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 27 Nov 1998 16:24:56 GMT
From: "Peter R Lynch" <plynch@bbss.com>
Subject: Re: Help..I'm Way Over My Head
Message-Id: <snA72.815$up4.1348735@news.rdc1.nj.home.com>

I agree that buying a book on Perl would be a good place to start. If you
are already programming in other languages I can tell you personally Perl is
not all that hard to pick up on. A couple of books I found very useful were:

Learning Perl - ISBN: 1565922840 (Good Perl primer)
Programming Perl - ISBN: 1565921496 (Good Perl reference)

A great place for cheap technical books on-line is www.bookpool.com

These books, however, primarily focus on the Perl language and not on its
integration and use in a web site. Fortunately there are plenty of good
books and a TON of on-line resources for that as well.

Good luck!

Peter Lynch


    Hunter Padgett wrote in message <365D6460.51562DB4@gate.net>...
    I am trying to configure ad-click thrus on my new Web Trends software.
Our web site has recently attracted advertisers and they require click-thru
rates to sign up. In order to set-up that part of the software, I need to
write a custom script (among other things) using the Perl 5 language. The
script is then housed on my ISP's server. I am lost.
    I know this is kinda broad, but if anyone has gone through this, I'd
appreciate your insight.

    Thanks,

    Hunter Padgett





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

Date: Fri, 27 Nov 1998 14:19:52 GMT
From: dave@mag-sol.com
Subject: Re: HTMLgen for perl...
Message-Id: <73mcdu$2sv$1@nnrp1.dejanews.com>

In article <slrn75t0kg.euu.aasmundo@communalis.ifi.uio.no>,
  aasmundo@ifi.uio.no wrote:
> Hi,
>
> I wonder, is there some perl-module which is similar to the HTMLgen module for
> python.
>
> I know there is CGI.pm, HTML::Base and maybe HTML::Simple, but this is not
> exactly what I want. Ok, the problem is that I like HTMLgen in python, but I
> like perl better, hence I search for something similar for perl.

Perhaps, if you explained about the modules you mentioned, it might help us to
help you. I would guess that most of us here have little or no knowledge of
Python.

hth,

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: Fri, 27 Nov 1998 11:18:51 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Lexical var in nested sub
Message-Id: <365ED0EB.39EAFEF3@min.net>

David Combs wrote:
> 
> >John Porter  <jdporter@min.net> wrote:
> >>Don't do this.  Nested subs are broken.
> 
> Please, what are you talking about?  Just what is it that
> doesn't work?
> Saying something like the above without an explanation
> or example is a bit terrifying to read.  Please clue us in.

Well, this didn't just come out of nowhere.
Nested subs were a good idea (it seemed), before the addition
of 'my' variables to the language.  Now, if you try to use
them, you may get a discouraging warning relating to lexical
variables.

In probably every conceivable case, you can use closures
instead.  Closures work great.  You won't be disappointed.

More info on nested subs is available:

	% perldoc perldiag
	/stay shared

	The Perl Cookbook, section 10.16

	Deja News -- threads containing the following messages:
		<3573FE9E.3B63@min.net>
		<199809271252.OAA26886@lion.plab.ku.dk>
		<5vrqok$d2n3@quest.lmtas.lmco.com>
		<uu31u24jo.fsf@worldnet.att.net>

-- 
John Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

Bill Gates claims to be developing a stable operating system;
Linus Torvalds claims to be bent on world domination.


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

Date: Fri, 27 Nov 1998 16:53:12 GMT
From: tcpeter@iname.com
Subject: Newbie: Need to split comma-delimited data into scalars or an array.
Message-Id: <73mldi$aej$1@nnrp1.dejanews.com>

Ok, if my script doesn't give it away, I'm still something of a newbie, but
I've checked the docs and the archives and this one is still giving me fits.
My question is this:  as part of my job, I receive e-mails with data in a
number of comma-delimited fields.  I've written a script to strip out the
lines containing the data and put it into a new file.  What I'd really like
to do is plug the individual fields onto individual lines (or better yet,
into scalars or an array, for further manipulation).  Can anyone point me in
the right direction, (and hopefully something more explicit or easier for a
newbie than the Perl docs)?

My code appears below.  Thanks in advance.

Tim

#! /usr/bin/perl -w

print "What file are you editing? \n";
chop($file = <STDIN>);
open(SOURCE,"$file") || die "Couldn't open file $file : $! \n";
print "Where do you want the output to go? \n";
chop($output = <STDIN>);
while (<SOURCE>) {
	($foo) = split(/\b+/g);
	open(DEST,">>$output") || die "Couldn't output file $output : $! \n";
	print DEST "$foo\n" if /\b"(.*)"/g;
	close DEST;
}
close(SOURCE);

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


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

Date: Fri, 27 Nov 1998 09:17:52 -0000
From: "Peter Shea" <peter.shea@parkside.demon.co.uk>
Subject: Re: Obfuscation of perl scripts
Message-Id: <73lqoj$ae6$1@pslx010.intranet.parkside.com>

Translate it into a compiled language (C++).

Or write a compiler :-)

Vlad Volkov wrote in message ...
>Can anybody suggest good obfuscation tool for Perl?
>
>Thanks a lot,
>Vlad
>
>
>




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

Date: Fri, 27 Nov 1998 09:23:27 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Obfuscation of perl scripts
Message-Id: <365EE00F.9742946F@atrieva.com>

Vlad Volkov wrote:
> 
> I rather meant changing variable names from, say,
> @user_names to @c354fbg within a module.
> "\n"s can be easily put back with corresponding
> Perl script. If you sell consulting in Perl for some particular
> field, in my case data loaders, you would not want somebody
> on the client side to learn the technics and take the
> business from you, eh?

If I pay a guy to write code and he delivers unmaintainable code, he
doesn't get paid until it's fixed. 


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Fri, 27 Nov 1998 13:31:16 +0100
From: Philip Class <philip.class@popcorn-studio.ch>
Subject: Password Protected Sites ?
Message-Id: <365E9B94.811E8D15@popcorn-studio.ch>

What are possible solutions for password protected sites ?
I've checked http://www.takempis.com/pword.asp that shows a simple example of
a pw protection to access a database (using ASP). 
But how do I protect a whole Webpage (or maybe a whole Directory) from
unwanted users ?

There's another example on http://www.net-link.net/cgi-docs/htpsswd.html that
uses the CGI-Interface and probably accesses a Perl-Script.

Or may I have to use SSL ?

I'd be very glad if someone could show me any examples / tutorials / links.

Thanks a lot !

Philip


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

Date: Fri, 27 Nov 1998 11:53:56 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
To: "Freeness" <Webmaster@Freeness.net>
Subject: Re: Perl Scripting Error
Message-Id: <F32x1x.GCw@csc.liv.ac.uk>

[Posted and mailed]

In article <73lg3u$bln$1@birch.prod.itd.earthlink.net>,
"Freeness" <Webmaster@Freeness.net> writes:
> Can anyone point out anything wrong with the following script? I have had a
> 13-hour-long head ache from this... after I type perl -w gotoad.cgi in
> telnet it says "syntax error at gotoad.cgi line 15, near ")
> 
> open"
> Execution of gotoad.cgi aborted due to compilation errors.
> --PLEASE HELP!
> 

[snipped none-relevant code]

> open(DISPLAY, "accounts/$account.txt");
> @file = <DISPLAY>;
> close(DISPLAY)
                ^
                ^
I hsould imagine the lack of a ';' above has something to do with it.
(unless of course this is a typo.

You would probably figure this out instantly for your self but 13 hours
straight coding tends to make you semi blind.

> 
> open(DKPC, ">accounts/$account.txt");

[snipped none-relevant code]

> 
> 
> 

-- 
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>
<postmaster@merseymail.com>

Fifth Law of Procrastination:
        Procrastination avoids boredom; one never has the feeling that
there is nothing important to do.



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

Date: Fri, 27 Nov 1998 16:07:29 +0100
From: Attila <akara@cybernet-ag.net>
Subject: problem with syslog.pl under Windos NT
Message-Id: <365EC030.13813111@cybernet-ag.net>

Hey folks,
I'm trying to use my old perl scripts with Windows NT 4.0.
So I've taken the latest sources of perl and built it with the Visual
C++ 5.0 compiler. When executing perl -v I receive:
This is perl, 5.005_02 built for MSWin32-x86
So far so good, but my scripts - which run very well on HPUX - require
the ODBC module for perl and therefore the modules Storable and pRPC are
necessary too.
When trying trying to prepare the makefile for the pRPC module I get the
following error message:

Checking for Storable ... ok
Checking for Sys::Syslog ...
While loading the Sys::Syslog module, I received the follwing error
message:
Can't locate syslog.ph in @INC at c:\perl\lib\Sys\Syslog.pl line 117
(did you run h2ph?)
You can do this now by executing the commands
     cd /usr/include
    h2ph *.h */*.h */*/*.h
I think this supposed to work with UNIX but not with Windows NT.
Does anybody know how to get the appropiate syslog.h or syslog.ph for
Windows NT?
And when I have the right files, what must I do with them?

I'm would be very thankfull for any hint
Attila Kara



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

Date: Fri, 27 Nov 1998 09:02:50 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: problem
Message-Id: <quem37.g1c.ln@flash.net>

Sean Mintz (stmintz@yahoo.com) wrote:

: in my program i tried to do this;

: foreach $dog ($log{$num}) {
:     print "$dog\n";
: }

: if there is more than 1 thing in $log{$num} it only says the last one


   Hmmm.

   Maybe you meant to say "if there is more than 1 thing in %log"?

   To print all the values in the %log hash:

      foreach $dog (keys %log) {
         print "$log{$dog}\n";
      }

      or

      foreach $dog (values %log) {
         print "$dog\n";
      }


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


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

Date: Fri, 27 Nov 1998 13:56:36 GMT
From: luc.rosier@alcatel.be (Luc Rosier)
Subject: Re: read from a program ?
Message-Id: <365eae1e.25211181@news.bel.alcatel.be>

On 27 Nov 1998 08:45:03 GMT, "Tim Schelfhout"
<tim.schelfhout@telenet.be> wrote:

>I'm trying to write a perl script which reads output from a program and
>then formats some of its data.  So far I've come up with the following but
>I don't seem to get any data 
>back from the program although I know it's connected to it.
>
>($phone,$rest)=@ARGV;
>$cli="/opt/cli/bin/cli"; 
>open (CLI,"|$cli") || die "Can't connect to $cli\n";
>print  CLI,"searchdn $phone\n";
>close (CLI);

Hadietim,

You could try :

  open(CLI,"$cli searchdn $phone |") || die ....

and then :
 
  @output=<CLI>;

 Best Regards, Luc Rosier  ____________
__________________________/\  _________\____________________________
 Alcanet International    \ \ \______  / Phone :   +32-(0)3-450 3365
 Network & Services        \ \ \  / / /  Fax :     +32-(0)3-450 3038
                            \ \ \/ / /   
 De Villermontstraat 38      \ \/ / /  Email : luc.rosier@alcatel.be
 B-2550 KONTICH               \  / /  
 B E L G I U M                 \/_/ 



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

Date: Fri, 27 Nov 1998 09:30:52 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Running Perl scripts as NT services
Message-Id: <365E714C.DB663099@patriot.net>

Could someone point me to a FAQ that tells me how
to run my scripts as NT services?

Thanks
Carv



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

Date: Fri, 27 Nov 1998 15:33:24 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Running Perl scripts as NT services
Message-Id: <365ec636.85431814@thunder>

On Fri, 27 Nov 1998 09:30:52 +0000, Marquis de Carvdawg
<carvdawg@patriot.net> enlightened us thusly:

>Could someone point me to a FAQ that tells me how
>to run my scripts as NT services?

I'll point you to the NT Resource Kit ;-)

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Fri, 27 Nov 1998 15:22:58 GMT
From: dan_stefura@mad.scientist.com
Subject: Re: Serial programming question
Message-Id: <73mg46$5s9$1@nnrp1.dejanews.com>

In article <slrn75rl24.l4.lbayuk@lbayuk.none>,
  lbayuk@mindspring.com (L J Bayuk) wrote:
> dan_stefura@mad.scientist.com wrote:
> >Hello world,
> >
> >I'm about to start a project of getting my Kodak DC-220 digital camera to
talk
> >to my serial port using Linux.   I am most likely going to do it in Perl, and
> >eventually use the GTK.
> >
> >After hunting down info on serial port programming, I have found various
> >resources that should get me started.
> >
> >The first stumbling block before I even start to write some code is this:
> >
> >I need to send a pulse on the Reset/Att line sent from the host computer to
> >the camera.  This pulse must be at least 50 microseconds.  Once I do this I
> >will receive a packet and away I go sending and receiving more specially
> >constructed packets.
> >
> >It sounds easy enough, but I see no mention of how to send a pulse on the
> >Reset/Att line, or anything about a Reset/Att line in the RS232 specs.
> >
> >I'm guessing it's something relatively easy, and I'm overlooking something.
> >
>
> You aren't missing anything because there is no such thing in RS232. Does
> the camera use a special cable which connects one of the standard RS232
> lines (like maybe a modem control line) to something the camera calls
> "Reset/Att" ?

Yes.  To be more specific, the Reset/Att line is pin 2 at the camera side. 
If I determine which corresponding pin it is on the RS232 side, I assume this
will help.  Had better get out the multimeter I guess.	You would think they
would tell you.

The next question is once I find out which pin it is, is it possible to send a
pulse down any of these?  I assume this is possible.

The only other specs is that it's 8-bit, 1 stop bit, no parity, half duplex,
and asynchronous, and from 9600-115200bps, all the standard stuff.

- dan -

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


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

Date: Thu, 26 Nov 1998 00:43:29 -0600
From: David Staggs <dstaggs@vumclib.mc.vanderbilt.edu>
Subject: Threads/Solaris/Compile/Perl-5.005_02
Message-Id: <Pine.SO4.4.00.9811260041320.4512-100000@vumclib>

Has anyone gotten threads to compile on a Solaris 2.6 box?  I cannot
figure out what I need to make it work.  If I say no to threads during the
configure process, it compiles fine.

Thanks for any pointers.

Regards,

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
David Staggs                                                          
Systems Software Specialist                                           
Vanderbilt University Medical Center                            
http://www.mc.vanderbilt.edu/users/dstaggs                                  
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



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

Date: 27 Nov 1998 16:06:53 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Threads/Solaris/Compile/Perl-5.005_02
Message-Id: <isaf1d2n02.fsf@godzilla.kiere.ericsson.se>

David Staggs <dstaggs@vumclib.mc.vanderbilt.edu> writes:

> Has anyone gotten threads to compile on a Solaris 2.6 box?  

Yes, lots of people have.

If you say what the problem is and what your environment is like,
maybe you can get some help.
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
              Please pay no attention to the panda in the fridge.


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

Date: Fri, 27 Nov 1998 16:20:57 GMT
From: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Re: Timeout on CGI-scripts that may block
Message-Id: <365ecddb.45143324@news.infoave.net>

Jorn Topnes <jornt@md1.merkantildata.net> wrote:

} I wonder how I can set up a timeout-system just to be sure that my CGI-scripts
} wont block other scripts they share resources with. Can I give my scripts a 
} timeout of say 5 minutes?

I'm not sure I understand what you mean here.  [you say "won't block" ---
did you really mean to write "won't be blocked by"??]  If you're talking
CGI, then five minutes is ridiculous --- what user would sit in front of
their browser for five minutes waiting for a page to load [indeed most
browsers will have given up on you LONG ago].  I suspect that you shouldn't
block for more than a few tens of seconds at the most..

Dealing with blocking on shared resources is a long standing systems design
problem and there are a bunch of solutions [especially where just "waiting
forever" isn't a viable alternative].  The very last-resort, when you can't
find *ANY* other way to deal with the problem, is to use some kind of
timeout/alarm signal and brute-force pull you out of the wait for whatever
resource you're waiting for.  It is a terrible solution because it is
horribly nondeterministic, Perl isn't quite reentrant and altogether it
makes for some nasty implementation problems.

If you start with the notion that "locking" a resource is a very bad idea,
then you can usually find ways to get done what you need done without a
long-timeout lock.

Two ways, for example, are to do transaction actions and snapshot actions:

1) transaction: you figure out what you want to do [interactively, slow,
however], and then lock-transact-unlock.

2) snapshot: you copy the file and work at your leisure on the copy.  Then
you lock-trytoupdate-unlock.  In trytoupdate you make sure that no one else
has changed the file while you were messing with it.  If someone else has
messed with the file you deal with it someone [in a little program I wrote
a few days back that took just this approach, I just told the user "you
lose, please do your edit over again" (no, I'm not an unsympathetic cretin
gleefully willing to throw away hours of a user's work: this is OK in my
particular application. :o)) but you could also use something like Unix's
'diff3' to make the user's changes on the new-version of the file
automatically or something like that..


It really depends on what sort of resource you're sharing and what the
constraints are, [and I know this isn't much help on your original
question, but in truth I think it is good advice}: If you really need to
lock resources for a long time, before I'd go and start building in
lock-timeouts and such I'd go an carefully reexamine the system design..

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Fri, 27 Nov 1998 11:48:56 -0800
From: Paul Deshaies <pauljr@nt.com>
Subject: Trouble using format (newbie)
Message-Id: <365F0228.43B9208E@nt.com>

This is what I'm trying to do:

	open (ORDER, ">>orders.info") || die"Could not open orders.info file";
	write;
	close ORDER;

format ORDER_TOP =
_____________________________________________________________________________
 .
format ORDER = 
@<<<<<<<<<<<    @|||||||||||||||||||||||    @>>>>    @>>>>>>>>   
@>>>>>>>>>>
$uid,           $orderedDocument,           $quantite,$date,      $time
 .

and this is the error I get:

Format not terminated in file upDateOrder.pl at line 359, next char ^?
Execution of upDateOrder.pl aborted due to compilation errors.

What am I missing.

pd


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

Date: Fri, 27 Nov 1998 11:06:29 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Girish Deodhar <girishd@gsslco.co.in>
Subject: Re: trying to print ALL keys in symbol table
Message-Id: <365ECDFD.F93EF8E7@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Girish Deodhar wrote:
> 
> Hi,
> 
>   i've just started learning perl.
> 
>   in the following i am trying to pring ALL the keys in symbol table
>   those in %main:: and those in other package symbol tables contained in
> main
> 
>   however the inner loop (the one which has print "inside\n") never gets
> executed
>   can someone tell me what is the mistake
> 
> ~girish
> 
> sub addkeys {
>  my ($href,$parentname) = @_;
>  foreach $keyname (keys %$href) {
> #  print qq|$parentname\:\:$keyname\n|;
>   if(! $keyname =~ m|main|) {
       ^
If you are try to look for $keyname _NOT_ match the regex, the do this:

      if(!($keyname =~ m|main|)) {     # you code with correct
OR,
      if ($keyname !~ m|main|) {       # this is clearer and simpler
OR,
      unless ($keyname =~ m|main|) {   # this one also

The problem in you code is that '!' operator has higher precedence than '=~'.
'perldoc perlop' for more info.

>    print "inside\n";
>    push(@array_of_keys,qq|$parentname\:\:$keyname|);
>    &addkeys($$href{$keyname},qq|$parentname\:\:$keyname|) if $keyname =~
> m|::$|;
>   }
>  }
> }
> 
> &addkeys(\%main::,"main");
> 
> print join("\n",@array_of_keys)

HTH.

-TK


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

Date: 27 Nov 1998 16:32:33 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: writing to a 9-track tape w/perl
Message-Id: <73mk71$1dei@fidoii.cc.Lehigh.EDU>

rsg <gibsonrs_killspam@earthlink.net> wrote:

> Shortly after the holiday, I will have to start 
> making 9-track tapes from our sun sparc10 running
> solaris 5.6.  I know about dd, but the files 
> that have to be written to tape are very large 
> and must be split across multiple reels.

> Can anyone help me get started with a perl 
> program to write a 9-track tape watching for the 
> end of tape marker and then continue on the next 
> volume.

> Thanks in advance.

I suspect you don't know what you'r in for! (-:

Tape operations (and there's nothing particularly specific to 9 tk tapes
here) are rather complex.  Are these tape labelled or unlabelled?  If so, are
they ANSI labels?  ASCII, EBCDIC or other characters?  Are you going to
handle VOL1, HDR1, EOF1 labels?  Yuck.  Do you *really* want to limit
yourself to tape volumes of 125MB or so, even at 6250 CPI?

Are you sure your dd can't handle multi-volume tape?  Can you use tar?  Many
tars can write multi-volume mutli-file files/tapes.  Try

Anyway, I expect you can read the tape just like any other device and the
driver will handle EOFs for you, and you can just use normal perl I/O.
Hopefully...


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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