[10958] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4559 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 5 21:07:19 1999

Date: Tue, 5 Jan 99 18:00:19 -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, 5 Jan 1999     Volume: 8 Number: 4559

Today's topics:
        ANNOUNCE:  Devel::Assert 0.03 (Michael G Schwern)
    Re: Changing Environment Variables in a shell (Charles DeRykus)
    Re: Does 'require' run the script automatically? <off-duty@entheosengineering.com>
    Re: flock(2) <off-duty@entheosengineering.com>
        fork + exec => zombie - Please help m_naren@yahoo.com
    Re: How do I create a unique (reproducible) identifier? <off-duty@entheosengineering.com>
    Re: I wanna learn Perl real good..but first <mishra.aditya@emeryworld.com>
    Re: I wanna learn Perl real good..but first <eugene@verticalnet.com>
    Re: Lists of Lists in Perl 4 (Martien Verbruggen)
    Re: Lists of Lists in Perl 4 (Tad McClellan)
    Re: looking for perl programmer <estabroo@ispn.com>
        op/pat, op/regex tests fail perl 5.005_02 DEC alpha <thale@rsch.comm.mot.com>
    Re: Opening remote file (Abigail)
    Re: Path under windows <ebohlman@netcom.com>
    Re: Perl and CR+LF (Martien Verbruggen)
    Re: Please Help!! (Martien Verbruggen)
    Re: Question: How to spawn another program and then die <callahan@pmel.noaa.gov>
        Reading data coming in from serial port to SUN <Jeffrey_Davey-P93404@email.mot.com>
    Re: Reading data coming in from serial port to SUN (Brand Hilton)
        SNMP MIB Agent? <rvarner@systems.dhl.com>
        Thanks for the help - what about this? <gbc1@axe.humboldt.edu>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 05 Jan 1999 20:21:36 -0500
From: schwern@pobox.com (Michael G Schwern)
Subject: ANNOUNCE:  Devel::Assert 0.03
Message-Id: <schwern-0501992021360001@news.panix.com>

A brand-spanking new module, still in alpha-state mostly because its
brand-new, I'd like the syntax to change, if possible, and I'm not totally
sure if it should be in the Devel:: tree or start a new Debug:: tree on
its own.

It is intended as a replacement for assert.pl.


The probably too wordy man page follows...


Assert(3)      User Contributed Perl Documentation      Assert(3)


NAME
       Devel::Assert - stating the obvious to let the computer
       know

SYNOPSIS
           BEGIN { $Devel::Assert::DEBUG = 1 }
           use Devel::Assert;
           assert(1 == 1);

           # Switch off assertations and inline them.
           BEGIN { $Devel::Assert::DEBUG = 0 }
           use Devel::Assert qw(:DEBUG);
           assert(1 == 1) if DEBUG;


DESCRIPTION
           "We are ready for any unforseen event that may or may not
            occur."
               - Dan Quayle

       Devel::Assert is intended for a purpose like the ANSI C
       library assert.h.  If you're already familiar with
       assert.h, then you can probably skip this and go straight
       to the FUNCTIONS section.

       Assertations are the explict expressions of your
       assumptions about the reality your program is expected to
       deal with, and a declaration of those which it is not.
       They are used to prevent your program from blissfully
       processing garbage inputs (garbage in, garbage out becomes
       garbage in, error out) and to tell you when you've
       produced garbage output.  (If I was going to be a cynic
       about Perl and the user nature, I'd say there are no user
       inputs but garbage, and Perl produces nothing but...)

       An assertation is used to prevent the impossible from
       being asked of your code, or at least tell you when it
       does.  For example:

           # Take the square root of a number.
           sub my_sqrt {
               my($num) = shift;

               # the square root of a negative number is imaginary.
               assert($num >= 0);

               return sqrt $num;
           }

       The assertation will warn you if a negative number was
       handed to your subroutine, a reality the routine has no
       intention of dealing with.

       An assertation should also be used a something of a
       reality check, to make sure what your code just did really
       did happen:

           open(FILE, $filename) || die $!;
           @stuff = <FILE>;
           @stuff = do_something(@stuff);

           # I should have some stuff.
           assert(scalar(@stuff) > 0);

       The assertation makes sure you have some @stuff at the end.  Maybe
the file
       was empty, maybe do_something() returned an empty list... either way, the
       assert() will give you a clue as to where the problem lies, rather
than 50
       lines down when you print out @stuff and discover it to be empty.

       Since assertations are designed for debugging and will
       remove themelves from production code, your assertations
       should be carefully crafted so as to not have any side-
       effects, change any variables or otherwise have any effect
       on your program.  Here is an example of a bad assertation:

           assert($error = 1 if $king ne 'Henry');

       It sets an error flag which may then be used somewhere
       else in your program.  When you shut off your assertations
       with the $DEBUG flag, $error will no longer be set.

FUNCTIONS
       assert


           assert(1==1);

       assert's functionality is effected by compile time value
       of $Devel::Assert::DEBUG.  If $DEBUG is true, assert will
       function as below.  If $DEBUG is false, assert will simply
       return undef.  See the section on Debugging vs Production
       for details.  (Note:  Altering the value of $DEBUG after
       Devel::Assert has been required will not change assert's
       behavior.)

       Give assert an expression, assert will Carp::confess() if
       that expression is false, return undef if it is true (DO
       NOT use the return value of assert for anything).

       assert() is intended to act like the function from ANSI C
       fame.  Unfortunately, due to perl's lack of macros or
       strong inlining, it's not nearly as unobtrusive.

Debugging vs Production
       Because assertations are extra code and because it is
       sometimes necessary to place them in 'hot' portions of
       your code where speed is paramount, Devel::Assert provides
       the option to remove its assert() calls from your program.

       So, we provide a way to force Perl to inline the switched
       off assert() routine, thereby removing almost all
       performance impact on your production code.

           BEGIN { $Devel::Assert::DEBUG = 0; }
           use Devel::Assert qw(:DEBUG);  # assertations are off.
           assert(1==1) if DEBUG;

       DEBUG is a constant set to 0.  Adding the 'if DEBUG'
       condition on your assert() call gives perl the cue to go
       ahead and remove assert() call from your program entirely,
       since the if conditional will always be false.

       (This is the best I can do without requiring Filter::cpp)

AUTHOR
       Michael G Schwern <schwern@pobox.com>
Michael G Schwern                                            schwern@pobox.com
  Funny thing about weekends when you're unemployed, 
  they don't mean quite so much.


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

Date: Wed, 6 Jan 1999 00:26:19 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Changing Environment Variables in a shell
Message-Id: <F543vv.FwI@news.boeing.com>

In article <368C9587.DDFE742C@mihy.mot.com>,
Ramanujam Parthasarathi  <rpsarathi@usa.net> wrote:
>
>I'm trying to change the environment variables of the shell using PERL.
>Its a fact that the modifications are 'local' (PERLish) to the script
>(and any child processes). Is there any way I can modify the Environment
>variables (%ENV) of the current shell?
>
>What I want to do is to set the environment variables (like PATH, etc.,)
>dynamically as when required - this way we can have a script which can
>take the s/w package name as argument and make the appropriate settings
>to the environment.
>

check the FAQ for complete details - perldoc perlfaq8. 

Something like this may work if you have a reasonable shell: 
(where 'host:' is your shell prompt) 

host: eval `perl -we 'print q(export BACK_TO_SHELL=foo)'`


hth,
--
Charles DeRykus


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

Date: Tue, 05 Jan 1999 18:34:59 -0600
From: Rich Grise <off-duty@entheosengineering.com>
To: strattner@my-dejanews.com
Subject: Re: Does 'require' run the script automatically?
Message-Id: <3692AFB3.57A10698@entheosengineering.com>

strattner@my-dejanews.com wrote:
> [...]
> What I would like to do is to call the subroutines from another script. I
> thought it was as simple as adding the path to @INC and using require.
> However, when I did that, it appears that the entire script is run, as
> opposed to the subroutine only. In other words, I get the 'nice' output
> instead of the array. I added '1' to the end of the script files (as per
> "Perl by Example", p.217 - see, I did research before posting), but that
> didn't help.


I haven't had any problem - either post or send the two main scripts and
the "require"d one. I've done stuff like,

mysub.cgi:
sub printit {
	print some stuff;
	return;
}
1;


main.cgi:

require "/my/real/subdirectory/mysub.cgi";

print prettification;
&printit("other &stuff");
print document foot;


And have never had a problem.
Sorry I couldn't be more helpful.
-- 
Rich Grise
off-duty@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)


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

Date: Tue, 05 Jan 1999 18:13:55 -0600
From: Rich Grise <off-duty@entheosengineering.com>
Subject: Re: flock(2)
Message-Id: <3692AAC3.107A16F7@entheosengineering.com>

Nathan Clemons wrote:
> [...]
> >look it tells me to look up flock(2) for operation info. 
[...]
> >Gala Grant
> Try man 2 flock. That's what the parenthesis is for, to separate
> sections of man pages.
>
Or, if he(she) is using perl, how about man perlfunc, and scroll
to flock, or even perldoc -f flock | less.

Of course, if he's not on a real operating system, he's kinda 
stuck.
-- 
Rich Grise
off-duty@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)


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

Date: Tue, 05 Jan 1999 23:16:01 GMT
From: m_naren@yahoo.com
Subject: fork + exec => zombie - Please help
Message-Id: <76u6fe$1lo$1@nnrp1.dejanews.com>

Can anyone of you extend me your helping hand in resolving my problem?

Here is the problem,

I have a web page with several buttons on it. Clicking on any of the buttons
would invoke the same perl script but by passing different parameters. This
perl script would fork process and this child process in turn be replace by
an other executable , say FLOATER. The FLOATER is supposed to extract desired
data and pipe to the calling program and the result would be again displayed
in an HTML form. Everything works fine, if the user clicks any of the one
buttons once and waits for the next page to load. But, when the same user
clicks the same button a number of times or clicks different buttons
successively without waiting for the next page to load, all the FLOATER
processes are still keep running indefinitely and finally ending-up with an
alert saying "Document contains no data".


To avoid the zombies to exist indefinitely, I set an alarm for a particular
time (I assume that the process does in no case takes more than this
particular time to pull the desired data) and once the signal is trapped, I
would kill the process.


So, in testing, when I clicked on several buttons successively, I could see
that many number of FLOATER processes being created and continue to run. Once
the set-alarm time is reached, I could see one by one, each process getting
died. Since each process of FLOATER occupies as much as 8MB of memory, if
there are more number of such processes, the time set for alarm seems
insufficient in pulling the data and eventually the process is being killed
intermittently.


In practice, when I interrupt, either by clicking the same button or some
other button or the browser's stop button, the previous process should be
stopped and the latest action should come into effect. But, in my case, it's
not happening. Even if I press the stop button, only the browser's loading is
stopped NOT the respective processes on the server are dying.

I have been trying to trap different signals to kill the processes, but all my
attempts are going in vain.

I would be very grateful, if anyone of you can help me in this.

Thanks a lot for your co-operation,
Narayana.

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


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

Date: Tue, 05 Jan 1999 19:21:04 -0600
From: Rich Grise <off-duty@entheosengineering.com>
To: Jonathan Callahan <callahan@pmel.noaa.gov>
Subject: Re: How do I create a unique (reproducible) identifier?
Message-Id: <3692BA80.645DDC5B@entheosengineering.com>

Jonathan Callahan wrote:
> 
> I'd like to take a series of name=value paris (from an HTML form
> submission) and convert them into a unique ascii identifier to use for a
> filename which my cgi process will create.  The concatenation of all the
> values is unique but unpleasantly long and I was hoping to find
> something that would create a short, unique identifier string.  But it
> needs to be reproducible:  I need to create the same unique identifier
> if the same name=value pairs are passed in so that the previously
> created file can be found rather than recreated.
> 
> Thanks in advance for any suggestions,
> 
> -- Jon

Right off the top of my head, I'd say, use a hash.

open (MYHASH, "/mydir/myhash.hash") or die "$!";
(thrash).....

Oops! How do you write a hash to a file, and then retrieve it such
that it's still a hash? Is there a quick way, other than iterating
through the whole thing, turning it into some kind of array or
something?
-- 
Rich Grise
off-duty@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)


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

Date: Tue, 5 Jan 1999 14:55:08 -0800
From: "Adi Mishra" <mishra.aditya@emeryworld.com>
Subject: Re: I wanna learn Perl real good..but first
Message-Id: <76u4pf$19mi@news.cnf.com>

perldoc CGI
Then you can buy a book about it from O'Reilly




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

Date: Tue, 05 Jan 1999 19:34:52 -0500
From: Eugene Sotirescu <eugene@verticalnet.com>
To: Iain Lowe <ilowe@interlog.com>
Subject: Re: I wanna learn Perl real good..but first
Message-Id: <3692AFAC.5F1E44E8@verticalnet.com>

Check out brian d foy's cornucopia of CGI resources:

http://computerdog.com/CGI_MetaFAQ.html

Iain Lowe wrote:

> Hello Perl folks.
>
> I've been dabbling in your dominion for awhile now, wanting to learn how
> to do things -- mostly CGI / Web form processing. I've looked at lots of
> tools and books, but I haven't found anything that really strikes my
> fancy.
>
> Currently, I use PerlBuilder on Win95 to develop pretty basic Perl form
> processors, and then tweak them where I can. Most of the books I've
> looked at only cover very simple forms, and spend most of their time
> explaining how to break up the query string into key/value pairs--the
> brain-dead stuff.
>
> SO, does anybody know of good resources where I can learn to do things
> like split a feedback form across a couple of pages without going all
> the way through the Camel book (that'll come).
>
> Thanks



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

Date: Wed, 06 Jan 1999 00:12:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Lists of Lists in Perl 4
Message-Id: <TTxk2.106$YE1.4050@nsw.nnrp.telstra.net>

In article <369251BD.57FB76DC@email.sps.mot.com>,
	Omar Soto <rp7667@email.sps.mot.com> writes:
> Hello:
> 
> This may seem like a very basic question, but I am trying to
> create a List of lists or an array of arrays, as defined in the
> Perl 5 book p. 257.
> 
> The problem is that the definition works in Perl 5 but not in
> Perl 4.  Due to the requirements of the job, the on ly Perl
> supported is Perl 4 and not Perl 5.
> 
> Please Advice,

Get them to install perl 5. Perl 4 will not do it. Perl 4 has many
security bugs. Perl 4 is no longer supported and maintained. Perl 4 is
dead. Long live perl 5.

I am not joking. You can't do it in perl 4, and perl 4 is dead, even
though it still appears to run at your place.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.       | crops where there ain't no crops.
NSW, Australia                      | 


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

Date: Tue, 5 Jan 1999 18:28:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Lists of Lists in Perl 4
Message-Id: <lnau67.9t7.ln@magna.metronet.com>

Omar Soto (rp7667@email.sps.mot.com) wrote:

: This may seem like a very basic question, but I am trying to
: create a List of lists or an array of arrays, as defined in the
: Perl 5 book p. 257.


   There are dozens of Perl 5 books.

   If you are going to cite one, you should say which one.


: The problem is that the definition works in Perl 5 but not in
: Perl 4.  Due to the requirements of the job, the on ly Perl
: supported is Perl 4 and not Perl 5.

: Please Advice,


   I would advise brushing up your resume and saying so long
   to your Pointy Haired Boss. He is going to pay a lot more
   for programmer labor than he needs to. Bad business...


   You cannot use language features that are not in the language.

   So you use the poor man's version of 2-d array:

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

@lol = ( join("\t", 'fred', 'barney'),
         join("\t", 'george', 'jane', 'elroy'),
         join("\t", 'homer', 'marge', 'bart')
       );

print +(split /\t/, $lol[2])[2];   # bart
---------------
   

   Using Perl 4 will increase your pay if you happen to get
   paid by the character  ;-)

   Using 3 year old software tells me something ( I should get
   a Nokia cell phone instead of a Motorola one ;-).


   Still using Windows 3.1 too?


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


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

Date: Tue, 05 Jan 1999 17:46:10 -0600
From: Eric Estabrooks <estabroo@ispn.com>
Subject: Re: looking for perl programmer
Message-Id: <3692A442.FB8CA511@ispn.com>

Daniel Grisinger wrote:

> cberry@cinenet.net (Craig Berry) writes:
>
> > Snowhare (snowhare@devilbunnies.org) wrote:
> > : In article <36907D62.DD53F1A3@c-zone.net>,
> > : TRG Software  <chatmaster@c-zone.net> wrote:
> > : >I dont know much about the hardware but its a unix server on the fast
> > : >connection to the net on a DSL ( faster then a t-3)  line you will be
> > :
> > : Hmmm...At this level of cluelessness you would expect him to be in
> > : retail computer sales. :))))
> >
> > Either that, or I want to move to his phone company's service area!
>
> US West is advertising 7 mb/s service here (denver, co), which is
> faster than a t3.  I don't think that that is bidirectional, though.

I believe a T3 is 44.736 mb/s (Bell Standard).

Eric
 estabroo@ispn.com




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

Date: Tue, 05 Jan 1999 16:30:16 -0600
From: Bryan Thale <thale@rsch.comm.mot.com>
Subject: op/pat, op/regex tests fail perl 5.005_02 DEC alpha
Message-Id: <36929278.39D879C8@rsch.comm.mot.com>

Hi,

I'm trying to upgrade from 5.004_04 to 5.005_02 on a DEC Alpha (DEC Unix
4.0b).  5.002_02 builds OK, but I can't get it to pass a couple of the
regex regression tests.  I'm not getting any error messages that would
seem to fit the "Out of Memory" condition mentioned in the INSTALL file
unless, perhaps, the memory corruption detected is the ultimate result
of a malloc failure?

The INSTALL file seems to imply that it is safe (for an unknown
definition of "safe") to run a perl build that fails the op/pat.t
tests.  So... two questions:

1) Does anyone have any hints for what to tweak in the DEC Alpha build
configuration to resolve the memory corruption problem caught by the
test suite?

2) How much trouble will I get into installing my build of 5.005_02 "as
is", failed regex tests and all?

perlbug -d and harness output follow below.

Thanks for any help,
Bryan.

--
Bryan Thale
Motorola CGISS Systems Technology Research
mailto:thale@rsch.comm.mot.com






thale@aspen:/usr/www/src/perl5.005_02> ./perl -Ilib utils/perlbug -d
inst emulated pid=24955 <perl> va=0x140003424 pc=0x120018cf4
inst=0x392b0000
Site configuration information for perl 5.00502:

Configured by thale at Thu Dec 31 15:11:05 CST 1998.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 aspen.rsch.comm.mot.com v4.0 564 alpha '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O4', gccversion=egcs-2.91.57 19980901 (egcs-1.1
release)
    cppflags='-D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    ccflags ='-D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=8, ptrsize=8, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /shlib /lib /usr/lib /usr/ccs/lib
    libs=-ldbm -ldb -lm
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-shared -expect_unresolved "*" -O4
-msym -s -L/usr/local/lib'

Locally applied patches:


---
@INC for perl 5.00502:
    lib
    /usr/local/share/perl5/5.00502/alpha-dec_osf
    /usr/local/share/perl5/5.00502
    /usr/local/share/perl5/site_perl/5.005/alpha-dec_osf
    /usr/local/share/perl5/site_perl/5.005
    .

thale@aspen:/usr/www/src/perl5.005_02/t> ./perl harness
inst emulated pid=24805 <perl> va=0x140003424 pc=0x120018cf4
inst=0x392b0000

[ok tests snipped]

op/pat..............1400114f0 254
/
     (
       \(
       (?{ $c = 1 })            # Initialize
       (?:
         (?(?{ $c == 0 })       # PREVIOUS iteration was OK, stop the/:
regexp memory corruption at op/pat.t line 363.
dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 101-141
        Failed 41/141 tests, 70.92% okay

[ok tests snipped]

op/regexp...........1400114f0 254
1400114f0 254
1400114f0 254
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f0 254
1400114f0 254
1400114f0 254
1400114f0 254
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
FAILED tests 335-337, 426-430, 434-435, 438-439, 443-444, 447-449
        Failed 17/485 tests, 96.49% okay
op/regexp_noamp.....1400114f0 254
1400114f0 254
1400114f0 254
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f0 254
1400114f0 254
1400114f0 254
1400114f0 254
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
1400114f8 230
FAILED tests 335-337, 426-430, 434-435, 438-439, 443-444, 447-449
        Failed 17/485 tests, 96.49% okay

[ok tests snipped]

Failed Test  Status Wstat Total Fail  Failed  List of failed
-------------------------------------------------------------------------------

op/pat.t          2   512   141   41  29.08%  101-141
op/regexp.t                 485   17   3.51%  335-337, 426-430, 434-435,
438-
                                              439, 443-444, 447-449
op/regexp_noamp             485   17   3.51%  335-337, 426-430, 434-435,
438-
                                              439, 443-444, 447-449
2 tests skipped, plus 14 subtests skipped.
Failed 3/186 test scripts, 98.39% okay. 75/6509 subtests failed, 98.85%
okay.




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

Date: 5 Jan 1999 23:20:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Opening remote file
Message-Id: <76u6oa$gpb$1@client3.news.psi.net>

Henrik Ruud (famruud@online.no) wrote on MCMLIII September MCMXCIII in
<URL:news:76tre0$dc1$1@readme.online.no>:
33 How do I open a file from ANOTHER SERVER into a variable in a perl-script?


What do you mean? How do/can you access the other server? Server for
what? And what do you mean by "openining into a variable"?



Abigail


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

Date: Wed, 6 Jan 1999 00:03:52 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Path under windows
Message-Id: <ebohlmanF542uG.FIF@netcom.com>

John Warner <jwarner@tivoli.com> wrote:
: machines (NT or Unix).  I had one client running an adult site that I had to teach him
: how to use the mouse before we got to NT administration.

This conjures up a somewhat X-rated image in my head....

: From what you describe, you are probably correct in your analysis (although Perl 5.001
: comes with the NT Resource Kit--it's not a standard feature).  Trying to explain the

Anyone got a list of all the security holes that existed in early 
versions and have since been plugged?



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

Date: Wed, 06 Jan 1999 00:03:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl and CR+LF
Message-Id: <OLxk2.103$YE1.4050@nsw.nnrp.telstra.net>

In article <comdog-ya02408000R0501991240510001@news.panix.com>,
	comdog@computerdog.com (brian d foy) writes:
> In article <3691FB67.39CA089@bbaw.de>, Joachim von Thadden <thadden@bbaw.de> posted:
> 
>> This is an obsolete problem in the 20th century, but it still exists. I
>> have users who write perl-cgi-scripts on Win95-Clients and transfer them
>> by samba to a linux host, where they should be executed. But the perl
>> version on linux doesn't want to deal with the line endings (CR+LF).
> 
> transfer them is ascii mode (or is that a samba problem?) or use

I wouldn't call it a problem :), but:

It is, at least from my last experience with samba. It doesn't, and in
my opinion shouldn't, translate end-of-line markers.

> something like dos2unix to strip the extra characters.

Or educate your users about this, and make them use an editor that can
save files with a unix line ending. vim will do it, so will PFE, and a
variety of other decent editors will do it as well.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: Tue, 05 Jan 1999 23:45:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Please Help!!
Message-Id: <Vuxk2.99$YE1.3904@nsw.nnrp.telstra.net>

In article <ip5s67.kg2.ln@magna.metronet.com>,
	tadmc@metronet.com (Tad McClellan) writes:

>    2) I dunno what Operating System you are on, but I don't know of
>       any that use that line-ending sequence...
> 
>       Unix: "\n"   (gotta use double quotes)
>       Mac:  "\r"
>       PoB:  "\r\n"

The last one is of course not just PoB. Most text based network
protocols specify a end-of-line marker as a sequence of a carriage
return and a line feed (ASCII 13 and 10). Many browsers and servers
are tolerant, which means they'll also accept other variants, but the
specifications most often still define CRLF.

I suspect that the original poster's "\n\r" was an attempt to be
correct. Of course, "\n" translates to LF on Unix, CR on Mac, and CRLF
on NT. Platform independent application that want to return CRLF will
do so explicitly by referring to their numeric values ("\x0d\x0a" or
something like that).

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd.       | password?
NSW, Australia                      | 


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

Date: Tue, 05 Jan 1999 15:06:07 -0800
From: Jonathan Callahan <callahan@pmel.noaa.gov>
Subject: Re: Question: How to spawn another program and then die
Message-Id: <36929ADF.DF89F068@pmel.noaa.gov>

Greg,

We had a similar goal and I ended up using fork.  Even so we still had a
problem with the browser not returning until someone pointed out that we had
not closed STDOUT at the end of the program.  I'll append the important
parts of our cgi script:

-- Jon

=====================================================

#!/opt/local/bin/perl

use CGI;

# Force output;
# Redirect stderr to stdout so we can see err msgs on the web;

$| = 1;
open (STDERR, ">&STDOUT") || die "can't dup stdout ($!)\n";

$query = new CGI;

# Open a file for debugging output
open(DBGFILE, ">debug/doit_debug.txt") || die "can't open doit_debug.txt\n";

$query->save(DBGFILE);
close(DBGFILE);

# set directories
$outdir = "your_directory_here";
$outweb = "your_web_server_here";

$debug = $query->param('debug');

unless ($debug) { &createFile($query, $outdir); }

&returnPage($query, $outdir, $outweb);

close(STDERR);
close(STDOUT);

unless ($debug) { &runProgram($query); }

#END OF MAIN PROGRAM

 ... the_other_subroutines ...

sub runProgram {
  local($query) = @_;

  open(DBGFILE, ">debug/runProgram_debug.txt") || die "can't open
runProgram_debug.txt\n";

  unless (fork) {
    print DBGFILE "child process\n";
    unless (fork) {
      open(GDBGFILE, ">debug/grandchild_debug.txt") || die "can't open
runProgram_debug.txt\
n";
      print GDBGFILE "grandchild process\n";
      sleep 1 until getppid == 1;
      exec 'cd /home/tsunami2/public_html/model/Run; ./run_most.bat >
run.log 2>&1';
      print GDBGFILE "end of grandchild process\n";
      close(GDBGFILE);
      exit 0;
    }
    print DBGFILE "end of child\n";
    exit 0;
  }
  wait;
  print DBGFILE "end of parent\n";
  close(DBGFILE);
}

=====================================================


Greg Coit wrote:

> Hello all,
>
> I'm writing a perl/cgi program that needs to (among other things), take
> in some data, fire another perl program and send it a variable, and then
> send a web page to the browser.  the catch is that the program that gets
> fired off takes several hours to complete it's process, and I'm having a
> hard time getting the browser to not wait for it.  If I understand this
> process correctly, I need to find a way to kill the current script after
> the new one is called (I can send the new page to the browser before
> firing off the new script - but the browser seems to want to wait until
> the old script is done before showing the page, and the old script is
> waiting for the new one to finish).  I have tried using exec (page 538
> of the cookbook), eval (with an alarm - from page 80 of Advanced Perl)
> and calling a shell script which calls the new script and places it in
> the background.  I haven't tried fork because the parent wouldn't be
> around to clean up the child's entry in the process table after the
> child dies (per page 552 of the cookbook).
>
> Any ideas or suggestion are welcome.  Thanks in advance for your help.
>
> Greg Coit
> gbc1@axe.humboldt.edu



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

Date: Tue, 05 Jan 1999 15:15:34 -0700
From: Jeffrey Davey <Jeffrey_Davey-P93404@email.mot.com>
Subject: Reading data coming in from serial port to SUN
Message-Id: <36928F06.81EBA746@email.mot.com>

Hello, all!

I need to code a small program to read data coming into the serial port
on a Sun workstation.  I tried to find something like this at CPAN, but
the only thing similar was a Win32 application.

Does anybody out there have something like this, or can give me some
pointers?  I'd appreciate it greatly.

(I am assuming that as long as the application is UNIX-oriented, it
would be useful...)

Thanks!

jeff


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

Date: 6 Jan 1999 00:21:59 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Reading data coming in from serial port to SUN
Message-Id: <76uab7$3js1@mercury.adc.com>

In article <36928F06.81EBA746@email.mot.com>,
Jeffrey Davey  <Jeffrey_Davey-P93404@email.mot.com> wrote:
>Hello, all!
>
>I need to code a small program to read data coming into the serial port
>on a Sun workstation.  I tried to find something like this at CPAN, but
>the only thing similar was a Win32 application.
>
>Does anybody out there have something like this, or can give me some
>pointers?  I'd appreciate it greatly.

A co-worker just did that very thing on a FreeBSD box here.  He used
Comm.pl, but I think I'd try Expect.pm.  Here's the magic:

($pty_fh, $tty_fh, $pid) = Comm::open_proc("cu -l /dev/cuaa0 -s 38400");

Enjoy!

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 05 Jan 1999 16:10:35 -0800
From: Roger Varner <rvarner@systems.dhl.com>
Subject: SNMP MIB Agent?
Message-Id: <3692A9FB.12477DC@systems.dhl.com>

This is a multi-part message in MIME format.
--------------3739B2A8A74867E5F9A6BEF5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Has anyone heard of an SNMP MIB agent written in PERL? There
seems to be many client side modules that implement the get, getnext,
and set functionality, but I have not been able to find any creation
and
maintenance of the MIB.

Thanks,
Roger Varner

--------------3739B2A8A74867E5F9A6BEF5
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Varner, Roger
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Roger Varner
n:              Varner;Roger
org:            Communications Infrastructure Development
email;internet: rvarner@systems.dhl.com
title:          Sr. Software Engineer
tel;work:       650-425-5323
tel;fax:        650-425-5018
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------3739B2A8A74867E5F9A6BEF5--



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

Date: Tue, 05 Jan 1999 17:40:28 -0800
From: Greg Coit <gbc1@axe.humboldt.edu>
Subject: Thanks for the help - what about this?
Message-Id: <3692BF0C.BFF7590C@axe.humboldt.edu>

Thanks for the replies.  Adding a close of STDERR and STDOUT helped greatly
by allowing the browser to show the new page even while the script is
waiting for the new script to finish:

 #subroutine and variable names changed to avoid confusion (no innocents to
protect here!):
sub spawn_program_and_generate_next_page
{       &get_data_from_old_webpage;
        &generate_new_web_page;
        close(STDERR);
        close(STDOUT);
        `new_program.pl $param`;  #Don't worry, $param was not derived from
any user input
}

My next question is why do I need fork after all?  If I understand fork
correctly (which is unlikely), my parent program will still be active until
the child dies (which is how the above snippet of code behaves even though
it's not technically forking).  I could probably kill the parent, but
wouldn't that  require a new script to clean up zombies after the child
dies?  Should I use fork because it allows me to makes sure the firing off
of the new script really worked?

Thanks for the help on this one, I banged my head against the computer
screen for 3 days on this one.

Greg Coit
gbc1@axe.humboldt.edu



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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4559
**************************************

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