[17384] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4806 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 3 18:05:50 2000

Date: Fri, 3 Nov 2000 15:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973292715-v9-i4806@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 3 Nov 2000     Volume: 9 Number: 4806

Today's topics:
    Re: "chown" of symlink instead of linked file (Otto Wyss)
    Re: 1+(-1)=? can be 0 or 2, depending on context <joe+usenet@sunstarsys.com>
    Re: @ARGV and Absolute URL (Richard J. Rauenzahn)
    Re: ANN-Upload.it, for sharewarists (and a request) <gellyfish@gellyfish.com>
        CGI newbie - premature end of script headers??? <it_likes_you@yahoo.com>
    Re: CGI newbie - premature end of script headers??? <dure@telerama.com>
        comma delimited to fixed length <arm@home.com>
    Re: comma delimited to fixed length (John J. Trammell)
    Re: comma delimited to fixed length <jeff@vpservices.com>
        Communicating with a child process (Anno Siegel)
    Re: Communicating with a child process <tim@ipac.caltech.edu>
    Re: Communicating with a child process (Sean McAfee)
    Re: does anyone know if this will work? (Tad McClellan)
    Re: embedded variables in a file <gellyfish@gellyfish.com>
        Form radio/drop down.. <mysangam@my-deja.com>
    Re: Freelance Programmer Neede - Good Money (Tad McClellan)
    Re: Freelance Programmer Neede - Good Money <russ_jones@rac.ray.com>
    Re: Getting NT Domain Full Names with Win32::NetAdmin <rckjr@yahoo.com>
        Hanging problem with IO::Socket::INET <bruce@pennypacker.org>
    Re: Hardwood Website <lmoran@wtsg.com>
    Re: HELP Devive:SerialPort disables ioctl <ned@bike-nomad.com>
        how to do a download process? <Odeen01@yahoo.com>
    Re: howto fork() an object <bkennedy@hmsonline.com>
    Re: Is there a way to get all PID's within Perl ? <tzz@heechee.beld.net>
    Re: Is there a way to get all PID's within Perl ? <gellyfish@gellyfish.com>
    Re: Microsoft SQL server atomshop@my-deja.com
    Re: String manipulation?? (Martien Verbruggen)
    Re: Timers? (Tad McClellan)
    Re: Want to process all files less than 24 hours old <mark-lists@webstylists.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 3 Nov 2000 22:27:47 +0100
From: otto.wyss@bluewin.ch (Otto Wyss)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <1ejfyts.1vr1de8uug2dwN%otto.wyss@bluewin.ch>

> > name . So how do I change the time of a symlink instead of the
> > referenced file? There is no "ltouch" nor a "touch -h" on my Debian
> > Linux and don't know if the kernel has a suitable syscall. In my view
> 
> Does relinking a'la  "ln -sf" not work?
>
No, this changes the modification time!

O. Wyss


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

Date: 03 Nov 2000 14:31:30 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: 1+(-1)=? can be 0 or 2, depending on context
Message-Id: <m34s1oyhrh.fsf@mumonkan.sunstarsys.com>

Helmut.Richter@lrz-muenchen.de (Helmut Richter) writes:

> First of all, thanks to all who responded. Yes, it really looks like a
> bug.  I am always very reluctant to suspect interpreter bugs, and
> therefore I wanted some more people to have a look into it. Thanks
> again.
> 

No problem - I could tell from your post that you worked hard
to figure out what was wrong before you posted it, and you had
a hunch where the problem was.  Although your code was very 
difficult to read, those clues made debugging it much easier.


> >If that's too much trouble, a quick fix would be to change
> 
> >$coe = "$op$coe";
> 
> >to 
> 
> >$coe = "$op$coe" + 0;
> 
> Are you sure that works? This might just change the -1 into a 1 some
> statements earlier.

No, I'm not sure it will always work; but it does fix it on my 
broken 5.6. What I'm getting at is that IMHO, $coe is meant to 
be a numeric value in your code - so each line where set $coe, 
you should be setting/testing it via a numeric expression. With 

$coe = "$op$coe" ;      # [1]

you're treating it like it's an (alphanumeric) string.  Normally 
that's just fine with perl, since a working compiler will convert 
the (alphanumeric) string version of $coe to a numeric value 
when you want to treat $coe as a number.

However, it's bad to rely on this- one simple reason is that you may
confuse your compiler!  Another reason is that other programmers 
(particularly those with backgrounds in C) have a hard time keeping 
track of how you're going to use $coe later on in your code.  This is 
also perhaps the best reason to enable warnings and see what they say. 
The perl compiler will do it's level best to complain loudly if/when 
you make mistakes programming this way.

[...]

> That's why I am not willing to use the other work-around either, which
> I gave in my original description.
> 

Indeed -it was your other work-around that helped me see what was
going on!


> >I have a feeling that the entire chunk of code can be effectively
> >reduced to no more than a few lines, but in case you are the 
> >chef, I don't want to humiliate you for being so forthcoming with
> >your troubles.
> 
> There is always more than one way to do it in perl, and I am always
> open to learn new things. So I won't feel humiliated if someone comes
> up with a smarter way to do it.
> 

In terms of a black box - could you explain the purpose of your
parse_linear ($) sub?  Is it intended to turn a "stringified" vector
into an array, something like

@vec = parse_linear("-x+y+3z"); # returns (-1, x, 1, y, 3, z) ?

-- 
Joe Schaefer


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

Date: 3 Nov 2000 21:27:29 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: @ARGV and Absolute URL
Message-Id: <973286846.504285@hpvablab.cup.hp.com>

dennis100@webtv.net (BUCK NAKED1) writes:
>I thought that the URL that was delivered by getstore would
>automatically be read into @ARGV, and I expected the first $ARGV[0] to
>get the contents of the getstore URL, and I expected my 2nd $ARGV[0] to
>print the URL.

Do you still expect this after having read the entry for @ARGV in the
perlvar manpage?

  @ARGV   The array @ARGV contains the command-line arguments intended
	  for the script.  `$#ARGV' is generally the number of arguments
	  minus one, because `$ARGV[0]' is the first argument, not the
	  program's command name itself.  See `$0' for the command name.

>FWIW, the script above will work fine if I change the ARGV's to a
>filehandle, but I need to read in URL's that are not on my server...
>thus the LWP getstore.

I think before you can proceed further you need to have a better
understanding of what @ARGV is for.  Maybe $ARGV is confusing you?

  $ARGV   contains the name of the current file when reading from <>.

Both of these and their relationship to eachother are also discussed in
the perlopentut man page.  When you understand their purpose, you'll
realize that neither really have anything directly to do with LWP.

Rich
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 3 Nov 2000 19:12:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ANN-Upload.it, for sharewarists (and a request)
Message-Id: <8tv2nb$ak2$1@orpheus.gellyfish.com>

On Thu, 02 Nov 2000 11:58:23 +0100 Dr.Upload wrote:
> Hi!
> http://xxxxxx.it is a new site created for
> sharewarists, i.e. shareware developers. 
> 

Hands up if there are any 'sharewarists' on the group ....

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Fri, 3 Nov 2000 23:08:22 +0100
From: "Tomas" <it_likes_you@yahoo.com>
Subject: CGI newbie - premature end of script headers???
Message-Id: <newscache$tjxg3g$55g$1@news.freegates.be>

Hi,

I'm don't do well in CGI. I'm trying to make a form-to-mail cgi, but I just
grabbed it from several tutorials. The script looks fine, but when I run it
on a webserver, it says "Premature end of script headers"

Also, I've read that you can print HTML easier when you use "print
<<EndOfHTML" so that you don't have to use the print statement everytime.
But is the "EndOfHTML" part neccesary or can you use other thing such as
<<errorpage? And can you use EndOfHTML more than once in a script?

Thanks for reading this,

You can reply to this or email directly to nofunatall@tiscalinet.be




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

Date: Fri, 03 Nov 2000 17:39:42 -0500
From: dre <dure@telerama.com>
Subject: Re: CGI newbie - premature end of script headers???
Message-Id: <3A033EAD.7C0475CE@telerama.com>

Do you have access to the error log.  That's a good place to start.  Also, if
you have access to the command line on the server, try: perl -c yourfile.cgi or
pl which checks for syntax errors.  good luck

Tomas wrote:

> Hi,
>
> I'm don't do well in CGI. I'm trying to make a form-to-mail cgi, but I just
> grabbed it from several tutorials. The script looks fine, but when I run it
> on a webserver, it says "Premature end of script headers"
>
> Also, I've read that you can print HTML easier when you use "print
> <<EndOfHTML" so that you don't have to use the print statement everytime.
> But is the "EndOfHTML" part neccesary or can you use other thing such as
> <<errorpage? And can you use EndOfHTML more than once in a script?
>
> Thanks for reading this,
>
> You can reply to this or email directly to nofunatall@tiscalinet.be



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

Date: Fri, 03 Nov 2000 20:01:12 GMT
From: Alan Melton <arm@home.com>
Subject: comma delimited to fixed length
Message-Id: <3A0318F9.61B4A1F8@home.com>

Have a file that contains multiple lines such as:
10,20,1999,0-13-104860-0,1,HUM,1,33.80,33.80
want to convert this comma delimited to a fixed length, so each field is
a fixed length

Please help - Thanks  A Melton



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

Date: 3 Nov 2000 20:13:58 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: comma delimited to fixed length
Message-Id: <slrn905cov.t04.trammell@nitz.hep.umn.edu>

On Fri, 03 Nov 2000 20:01:12 GMT, Alan Melton <arm@home.com> wrote:
>Have a file that contains multiple lines such as:
>10,20,1999,0-13-104860-0,1,HUM,1,33.80,33.80
>want to convert this comma delimited to a fixed length, so each field is
>a fixed length

Look into the Text::CSV_XS module for robust CSV parsing, 
then perhaps use sprintf() to force each field length.

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Fri, 03 Nov 2000 12:33:29 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: comma delimited to fixed length
Message-Id: <3A032119.3BA428DC@vpservices.com>

Alan Melton wrote:
> 
> Have a file that contains multiple lines such as:
> 10,20,1999,0-13-104860-0,1,HUM,1,33.80,33.80
> want to convert this comma delimited to a fixed length, so each field is
> a fixed length

The DBD::RAM module uses DBI and can handle both CSV and fixed-length
files so you can read in one and write out the other in about four lines
of code.  Or you could just use Text::CSV and pack to roll your own.

-- 
Jeff


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

Date: 3 Nov 2000 20:08:02 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Communicating with a child process
Message-Id: <8tv5v2$o4f$1@lublin.zrz.tu-berlin.de>

Tim Conrow  <tim@ipac.caltech.edu> wrote in comp.lang.perl.misc:
>Anno Siegel wrote:
>> Tim Conrow  <tim@ipac.caltech.edu> wrote in comp.lang.perl.misc:

>> >Why not make "(do something)" do this:
>> >
>> >print "<<<RESET COUNTER>>>\n";
>> >
>> >and add a line like this to the child:
>> >
>> >$line = 0 if /^<<<RESET COUNTER>>>$/;
>> 
>> That doesn't work without some kind of protocol.  Of course, a viable
>> "protocol" may just state that "<<<RESET COUNTER>>>" doesn't appear
>> on a line by itself, but sometimes you can't enforce that.  
>
>In this case Sean implied that he can enforce it, because his program is the one
>sending the text to the child. If it's really a concern, he could add something
>like this to the parent to watch for conflicts:
>
>if($text =~ /^<<<.*>>>$/) {
>	# modify $text innocuously and/or produce a warning
>}
>
>> If so, you need a second channel to the kid.
>> 
>> In this case, where you only want a single parameterless action, a
>> signal may do.  Pick a signal and set up a handler (in the kid) that
>> resets the line counter.  You may have to set autoflush in the parent
>> to be sure the counter is reset on the next line you print.  None of
>> this has been tested.
>
>Re signals: Signals are asynchronous, so making sure the counter reset is
>synchronized with the text will take some extra work, including perhaps
>acknowledgement by the child. Ick. This same problem will make many forms of
>"second channel" communication with the child more complex.

Indeed.  Come to think of it, I was rather thinking in terms of a
quick hack, meant to run on a lightly loaded machine.  Thanks for
providing the caveat I didn't.  The simple solution I sketched is
one of the things that break when "nothing has changed" (except
server load).

I rather like the light-handed way of embedding a command language
in a data stream (well, stream of lines).  All you need is a command
saying "the rest of the line is data" to escape the escape.  Neat,
and in fact never out of sync with the data.

Anno


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

Date: Fri, 03 Nov 2000 12:33:28 -0800
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Communicating with a child process
Message-Id: <3A032118.FA001F15@ipac.caltech.edu>

Anno Siegel wrote:
> 
> Tim Conrow  <tim@ipac.caltech.edu> wrote in comp.lang.perl.misc:
> >Sean McAfee wrote:
> >> Now I want to change the code so that I can reset the line counter in
> >> the child process from the parent process:
> >>
> >> print PIPE "foo\nbar\nbaz\n";     # prints "1 foo", "2 bar", "3 baz"
> >> # (do something)
> >> print PIPE "baz\nbletch\nquux\n"; # prints "1 baz", "2 bletch", "3 quux"
> >
> >Why not make "(do something)" do this:
> >
> >print "<<<RESET COUNTER>>>\n";
> >
> >and add a line like this to the child:
> >
> >$line = 0 if /^<<<RESET COUNTER>>>$/;
> 
> That doesn't work without some kind of protocol.  Of course, a viable
> "protocol" may just state that "<<<RESET COUNTER>>>" doesn't appear
> on a line by itself, but sometimes you can't enforce that.  

In this case Sean implied that he can enforce it, because his program is the one
sending the text to the child. If it's really a concern, he could add something
like this to the parent to watch for conflicts:

if($text =~ /^<<<.*>>>$/) {
	# modify $text innocuously and/or produce a warning
}

> If so, you need a second channel to the kid.
> 
> In this case, where you only want a single parameterless action, a
> signal may do.  Pick a signal and set up a handler (in the kid) that
> resets the line counter.  You may have to set autoflush in the parent
> to be sure the counter is reset on the next line you print.  None of
> this has been tested.

Re signals: Signals are asynchronous, so making sure the counter reset is
synchronized with the text will take some extra work, including perhaps
acknowledgement by the child. Ick. This same problem will make many forms of
"second channel" communication with the child more complex.

If this were driving a nuclear power plant or the space shuttle, I might go for
an out-of-band action of some sort [*], but it seems like overkill here. 

(I'm not really disagreeing with you Anno; only the OP can judge just how much
programming time the problem is worth. That's one of the things programmers get
paid to decide.)

(* Then again I might not. Such solutions might be sufficiently hard to debug
that I might feel better with the simpler answer.)

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Fri, 03 Nov 2000 20:51:16 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Communicating with a child process
Message-Id: <8zFM5.8727$O5.199028@news.itd.umich.edu>

In article <3A032118.FA001F15@ipac.caltech.edu>,
Tim Conrow  <tim@ipac.caltech.edu> wrote:
>Anno Siegel wrote:
>> Tim Conrow  <tim@ipac.caltech.edu> wrote in comp.lang.perl.misc:
>> >Sean McAfee wrote:
>> >> print PIPE "foo\nbar\nbaz\n";     # prints "1 foo", "2 bar", "3 baz"
>> >> # (do something)
>> >> print PIPE "baz\nbletch\nquux\n"; # prints "1 baz", "2 bletch", "3 quux"

>> >Why not make "(do something)" do this:
>> >print "<<<RESET COUNTER>>>\n";
>> >and add a line like this to the child:
>> >$line = 0 if /^<<<RESET COUNTER>>>$/;

>> That doesn't work without some kind of protocol.  Of course, a viable
>> "protocol" may just state that "<<<RESET COUNTER>>>" doesn't appear
>> on a line by itself, but sometimes you can't enforce that.  

>In this case Sean implied that he can enforce it, because his program is the one
>sending the text to the child. If it's really a concern, he could add something
>like this to the parent to watch for conflicts:

>if($text =~ /^<<<.*>>>$/) {
>    # modify $text innocuously and/or produce a warning
>}

Actually, I can't; the handle to the child may be passed around to many
different routines, and it's not feasible to require all of them to perform
this check.  I only regain full control over the handle between chunks of
input, when I want the counter to be reset.

>> In this case, where you only want a single parameterless action, a
>> signal may do.  Pick a signal and set up a handler (in the kid) that
>> resets the line counter.  You may have to set autoflush in the parent
>> to be sure the counter is reset on the next line you print.  None of
>> this has been tested.

>Re signals: Signals are asynchronous, so making sure the counter reset is
>synchronized with the text will take some extra work, including perhaps
>acknowledgement by the child. Ick. This same problem will make many forms of
>"second channel" communication with the child more complex.

Actually, I found a solution that's not too bad.  It's based on the parent
being able to tell the child to start reading input in a non-blocking
manner.  This can be done with a signal.  When the parent wants the child
to reset its counter, it tells the child to go non-blocking--letting the
child completely consume whatever data is left in the pipe--and then waits
(via a semaphore) for the child to indicate that it has reset its counter.

Here's an example of the technique.  The parent sends the child five
sequences of letters of random length, starting with 'A'.  The child
prints it input to STDOUT, prefixing each line with a count.  Between each
sequence, the parent tells the child to reset its counter as described
above.  So 'A' is always prefixed with 0, 'B' with 1, and so on.  Any
comments, suggestions, improvements, etc. are welcome.

----------------------------------------------------------------------
use Fcntl;
use IO::File;
use IPC::SysV qw(IPC_PRIVATE IPC_CREAT S_IRWXU);
use IPC::Semaphore;
use strict;

my $sem = new IPC::Semaphore(IPC_PRIVATE, 1, IPC_CREAT | S_IRWXU)
    or die "Can't get semaphore: $!\n";
$sem->setall(0);

END { $sem->remove }

my $blocking = 1;
$SIG{USR1} = sub { fcntl(STDIN, F_SETFL, O_NDELAY); $blocking = 0 };

defined(my $pid = open PIPE, '|-') or die "Can't fork: $!\n";

if ($pid == 0) {
    my $count = 0;
    my $defmode = fcntl(STDIN, F_GETFL, 0);
    while (1) {
        while (<STDIN>) {
            print $count++, " ", $_;
        }
        last if $blocking == 1;
        fcntl(STDIN, F_SETFL, $defmode);
        ($count, $blocking) = (0, 1);
        $sem->op(0, 1, 0);
    }
    exit;
}

$SIG{USR1} = 'DEFAULT';
PIPE->autoflush(1);

for (1 .. 5) {
    my $target = chr(ord('A') + rand(8) + 2);
    for ('A' .. $target) {
        print PIPE "$_\n";
    }
    kill USR1 => $pid;
    $sem->op(0, -1, 0);
}
----------------------------------------------------------------------

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: Fri, 3 Nov 2000 15:35:00 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: does anyone know if this will work?
Message-Id: <slrn9068bk.3md.tadmc@magna.metronet.com>

On Fri, 03 Nov 2000 18:08:30 GMT, wildhorses@my-deja.com 
   <wildhorses@my-deja.com> wrote:

>We want to test to see if our sql data base is working or not. 


You could write a Perl program to test it out.


><%@ LANGUAGE = PerlScript %>


PerlScript is still not Perl.

This is still a newsgroup for Perl.

Please still try to find a newsgroup or mailing list about the
PerlScript language for asking PerlScript questions.

Thank you again.


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


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

Date: 3 Nov 2000 20:08:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: embedded variables in a file
Message-Id: <8tv60d$aob$1@orpheus.gellyfish.com>

On Thu, 02 Nov 2000 12:53:46 GMT arse wrote:
> use a regexp like this
> $line =~ s/\$HOME\/(.*?)/$HOME$1/;

Indeed, but for a more general solution the OP would be better advised
to consult the already cited item in perlfaq4.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Fri, 03 Nov 2000 20:21:50 GMT
From: Sangam <mysangam@my-deja.com>
Subject: Form radio/drop down..
Message-Id: <8tv6ol$tef$1@nnrp1.deja.com>

 Hi,
  I would like to print radio buttons OR drop down menu on fly from the
given data. I need some help. I am trying it  using HTML::Template
Where I have defined the format for each one. It doesn't work the way I
want since in radio buttons, the 'name' goes in each button where as in
drop down, it goes only once.. ..The selection of the format (drop down
or radio) comes from the database..
Any ideas would be helpful

Thanks..










--
 .
 .
 .
Sangam


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 3 Nov 2000 15:42:23 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Freelance Programmer Neede - Good Money
Message-Id: <slrn9068pf.3md.tadmc@magna.metronet.com>

On Fri, 3 Nov 2000 16:42:02 -0000, Lee Denny <lee@areality.co.uk> wrote:

>Sorry if this is the wrong group, 


You appear to already have known that posting here was wrong,
since you are pre-apologizing.

Apologizing before you do something wrong does not excuse it.

   "Sorry, stick up your hands and give me the cash register."

The robber would not be prosecuted because he apologized
before he did it?



Newsgroups where job postings _are_ welcomed have "jobs" in
the newsgroup name. This newsgroup does not have "jobs" in
its name.


>but we need an urgent quote on the


You also need some clue.

"urgent" and "newsgroups" don't go together.

Usenet can take hours, days, or forever to propogate a message.

The period of urgency is likely exceeded by the propogation time,
so by the time anyone gets your message, it is already too late.

Usenet is a hit or miss thing. Hire a contractor if you want
better than that.


>attached specification.


Huh?


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


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

Date: Fri, 03 Nov 2000 16:10:21 -0600
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Freelance Programmer Neede - Good Money
Message-Id: <3A0337CD.F062A144@rac.ray.com>

Lee Denny wrote:
> 
> Sorry if this is the wrong group, but we need an urgent quote on the
> attached specification.
> Thanks in advance

Here's an urgent quote:
"I'M GONNA THROW UP!!!" - me on a car trip to Wyoming in 1958.
-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Are we there yet? Are we there yet? Are we there yet? Are we there
yet?


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

Date: Fri, 03 Nov 2000 19:05:47 GMT
From: Dr. Strangepork <rckjr@yahoo.com>
Subject: Re: Getting NT Domain Full Names with Win32::NetAdmin
Message-Id: <8tv2a4$pfr$1@nnrp1.deja.com>

That was it!  Thanks!

>
> Hi Rick,
>
> Win32API::Net::UserGetInfo($server, $user, 2, \%info);
> will do the trick.
>
>     David...


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 03 Nov 2000 20:23:34 GMT
From: "Bruce Pennypacker" <bruce@pennypacker.org>
Subject: Hanging problem with IO::Socket::INET
Message-Id: <a9FM5.14936$Cn4.168754@typhoon.ne.mediaone.net>

Hi all,

We have NT servers running a very simple monitoring program that listens on
a TCP port for connections.  I'm trying to write a perl script on a RedHat
Linux 6.2 machine to connect and issue a command that will result in a
single line of text being sent back.  I'm using Socket.pm with Perl
5.005_03, and for the most part everything is working fine.  Here's a
snippet of what I have:

$socket = IO::Socket::INET->new( PeerAddr => $host,
                                 PeerPort => 63333,
                                 Proto => "tcp",
                                 Type => SOCK_STREAM);

if (defined($socket)) {
  print $socket "ping";

  $result = <$socket>;

  if ($result =~ "^pong") {
    print "server ok\n";
  }
}

99% of the time this script works like a champ. However if it happens to run
at the approximate time that the NT server it's connecting to is shutting
down (for whatever reason) this script hangs on the call to new and never
returns.  I've been trying a number of ways to prevent it from hanging in
this situation but haven't had any consistant luck.  I've tried setting a
SIGALRM handler but it never seems to get called.  I've tried creating the
socket manually but then the <$socket> read never returns.  I'm about ready
to fork another process and kill it after a few seconds if it doesn't
succeed on it's own but that's really messy...

Any suggestions on how to handle this problem?  Since this script will
eventually be run automatically from a cron job I don't want any chance of
it getting hung like it is....

-Bruce





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

Date: Fri, 03 Nov 2000 15:27:15 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Hardwood Website
Message-Id: <gq760t86jngj5bdgojvqf9r2gtfhn6nq2v@4ax.com>

On 2 Nov 2000 22:05:55 GMT, clay@panix.com (Clay Irving) wrote
wonderful things about sparkplugs:
SNIP
>>>> > Hardwood floors and more! See the natural beauty of hardwood flooring
>>>and hardwood designs at
>>>> why do you post that here?
>>>> NO ONE HERE IS INTERESTED IN THAT!!!
>>>
>>>Actually, I was kinda disappointed it wasn't about Viagra.
>>
>>
>>Women.
>>
>>Always only one thing on their mind...
>
>Well, it does mention the beauty of hard wood...


You know, I'm buying a new house and my wife mentioned that if I let
her get some beautiful hardwood floors that I could have the basement
as my server room...


"Ow, ow, stupid trash, rotten, stinky, hate world, revenge soon,
take out on everyone..." 
lmoran@wtsg.com


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

Date: Fri, 03 Nov 2000 11:04:23 +0800
From: "Ned Konz" <ned@bike-nomad.com>
Subject: Re: HELP Devive:SerialPort disables ioctl
Message-Id: <t06387bhni42ef@corp.supernews.com>

In article <8trln6$sqr$1@nnrp1.deja.com>, "Phil xxx"
<phil_xxx@my-deja.com> wrote:

> When I use the Device::SerialPort module I get the following warning:
> Does anyone know what this is and
>  how to resolve it?
> 
> "disabling ioctl methods - constants not found"

You don't say which version of the module you're using. 
Have you tried doing

	perldoc Device::SerialPort

and looking for ioctl?

Basically, if the module can find the constants to use in ioctl
calls, you can use the ioctl calls to do things other than
sending/receiving data (like wiggling the modem control lines,
for instance).

Under Unix, this is done by looking at an include file for constant
values. So, if you're using Unix, you need to have your asm/termios.ph
file available and findable by the module.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned@bike-nomad.com
homepage:  http://bike-nomad.com


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

Date: Fri, 03 Nov 2000 22:14:03 GMT
From: Juan Durán <Odeen01@yahoo.com>
Subject: how to do a download process?
Message-Id: <8tvdb4$3lv$1@nnrp1.deja.com>

hi guys,
does somebody by any chance know how to create a process to download a
file (actually is an HTML file)?
i have to give the option to the enduser to click in a link and then
a "save as" box should appear so the user can save the html file i am
offering

if somebody can help me, please, i'm stuck in my job because of that


thanks a lot!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 03 Nov 2000 20:29:45 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: howto fork() an object
Message-Id: <ZeFM5.88767$td5.13334954@news1.rdc2.pa.home.com>


<northward@my-deja.com> wrote in message news:8tn3am$5ce$1@nnrp1.deja.com...

> Has anyone ever tried to fork a Perl object (meaning an instance of a
> class)? I'm currently writing a program using OOP style and Perl's
> lack of true threads is a bit of a problem.

I'm not quite sure what you mean - what are you trying to accomplish?
fork() is used only to spawn multiple independent processess - a perl object
is just a data structure, and there are nice modules that will help you
clone them, such as Storable.  Hope this helps --

--Ben Kennedy




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

Date: 03 Nov 2000 15:37:19 -0500
From: Ted Zlatanov <tzz@heechee.beld.net>
Subject: Re: Is there a way to get all PID's within Perl ?
Message-Id: <m3k8akyeps.fsf@heechee.beld.net>

msalerno@my-deja.com writes:

> pretty much what the title asks.  I would like to be able to get a list
> of all running proccesses.

Maybe Proc::ProcessTable from CPAN (http://search.cpan.org) will be
helpful.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: 3 Nov 2000 19:10:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is there a way to get all PID's within Perl ?
Message-Id: <8tv2j0$ajv$1@orpheus.gellyfish.com>

On Thu, 02 Nov 2000 18:51:59 GMT msalerno@my-deja.com wrote:
> pretty much what the title asks.  I would like to be able to get a list
> of all running proccesses.
> 
> I could use:
> @pids = `/usr/bin/ps -ef -o user -o pid -o args`;
> 
> But I would rather not have to call any external programs.
> 

Depending on your OS you might be able to find a suitable module on
CPAN  or failing that you can (if your system supports it) grope
around in /proc in concert with the appropriate documentation (proc(5)
on this system).

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Fri, 03 Nov 2000 19:00:59 GMT
From: atomshop@my-deja.com
Subject: Re: Microsoft SQL server
Message-Id: <8tv214$p39$1@nnrp1.deja.com>

  DBD::ADO - A DBI driver for Microsoft ADO (Active Data Objects)

  use DBI;
  $dbh = DBI->connect("DBI:ADO:DSN", $user, $passwd);



In article <MPG.146cf6cd249c2b7898968e@news.siol.net>,
  marvin <glodalec@yahoo.com> wrote:
> Hi !
>
> Does anybody know how to connect to Microsoft SQL server 7.00 via DBD
> driver and which one do I need.
>
> I tried with
> http://search.cpan.org/search?module=MSSQL::DBlib
>
> but the page is not valid. (Taken from www.perlmodules.com)
>
> Regards
> Marvin
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 4 Nov 2000 08:50:21 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: String manipulation??
Message-Id: <slrn906cot.ac5.mgjv@martien.heliotrope.home>

On Fri, 3 Nov 2000 14:35:08 +0000,
	James Taylor <james@NOSPAM.demon.co.uk> wrote:
> In article <Pine.GSO.4.21.0011022136250.25313-100000@crusoe.crusoe.net>,
> Jeff Pinyan <URL:mailto:jeffp@crusoe.net> wrote:
> > 
> > Only if he used the non-& method of calling functions.
> 
> Is there any reason to use the &sub method these days?

The same reason why one would use foreach instead of for, or a statement
modifying while, instead of a full loop construct. Preference.

sub foo
{
	# Pass on all my work to bar()
	&bar;
}

instead of 

sub foo
{
	# Pass on all my work to bar
	bar(@_);
}

or even with a goto.

One other reason might be to temporarily get rid of the prototype. You
need it when you have a subroutine reference and you want to actually
use it.

But then, I don't like overusing prototypes. I used to think they were
going to be the next best thing since map, but they get in the way more
often than they're useful.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | System Administration is a dirty
Commercial Dynamics Pty. Ltd.   | job, but someone said I have to do
NSW, Australia                  | it.


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

Date: Fri, 3 Nov 2000 15:45:33 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Timers?
Message-Id: <slrn9068vd.3md.tadmc@magna.metronet.com>

On Fri, 03 Nov 2000 18:26:34 GMT, LostShade <lostshade@home.com> wrote:

>   What seems to be a very common theme to this board "I new to Perl"
                                            ^^^^^^^^^^

This is not a "board" (as in "bulletin board"? )

This is a Usenet newsgroup.

There are important differences, you should not confuse the two.


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


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

Date: Fri, 03 Nov 2000 12:59:56 -0800
From: Mark Thompson <mark-lists@webstylists.com>
Subject: Re: Want to process all files less than 24 hours old
Message-Id: <eb560t4kucu748qjkh5i2o4855fndiu9pt@4ax.com>

On Thu, 2 Nov 2000 19:08:13 -0500, tadmc@metronet.com (Tad McClellan)
wrote:


>>sub readdatabasefile
>>{

>Pass $databasefile as a subroutine argument instead of
>communicating with the subroutine via global variables.

On this I'm trying to figure out how to go about this.  What I like to
do is have things that could change at the top of the program so I can
easily edit it.  Is there a way to define the scope of a variable to
be non-global and to accomplish the easy editability that I'm looking
for at the same time?


>You should always, yes *always*, check the return value from open():
>
>   open(DBFILE, $databasefile) || die "could not open '$databasefile'  $!";
>
>Be sure to include the $! special variable in your diagnostic message.

Exactly :)  I write a new Perl program once a year and I forget
exactly the same things every time :)

>>    close (DBFILE);
>
>Explicit close() is a Very Good Idea!

Thanks, I try to get one or two good things in every program! :)

>>	            $cookies[$count - 1] =~ /ManualDownloadCode=(.+)/;
>>	            if ($1)

>Yikes!
>
>Another biggie!
>
>Do you realize where the value of $1 comes from if that
>pattern match should happen to fail?
>
>If your match fails, $1 will have been set from a *different match*
>many of lines above this point in the program.
>
>The "dollar digit" variables are updated only on a *successful*
>pattern match.
>
>So you should NEVER use the dollar-digit variables without first
>testing to see that the match succeeded.
>
>You can incorporate that easily here though. Instead of "if ($1)":
>
>   if ( $cookies[$count - 1] =~ /ManualDownloadCode=(.+)/ ) {
>      $log{$1}{$file} = 1;
>   }

Thanks!  I never realized that $1 would even be defined if it failed.
Had no effect on the program with the current data because I was using
only browsers with cookies turned on so it worked for me perfectly.
One question I have is that split the cookie variable into multiple
items by semi-colon because that's how it gets split up by the browser
and then had it search each individual cookie separately.  If the
cookie is in the form:

	Cookie1=Value1; Cookie2=Value2; Cookie3=Value3 or
	Cookie2=Value2; Cookie3=Value3; Cookie1=Value1 or
	Cookie3=Value3; Cookie1=Value1; Cookie2=Value2

is there a way to have it find the value of Cookie1 no matter where
it's located?  I can get it to find it if it's the first or second
item in the list and I can get it to find it if it's the 3rd value in
the list, but I can't get it to work for both.  


>>        @dataarray = split("\t",$data{$user});
>                            ^^^^
>
>That is misleading. It looks like a string, but it is a pattern match.
>
>Better if pattern matches _look like_ pattern matches :-)
>
>   @dataarray = split(/\t/ ,$data{$user});

That's something I never knew!  In fact, most people I asked didn't
even realize this (makes me seem really smart to other people :)

Thanks for all the help, I had thought it was perfect as it was before
but it's now a lot better plus I learned quite a bit.

Mark



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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4806
**************************************


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