[11639] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5239 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 27 11:02:32 1999

Date: Sat, 27 Mar 99 08:00:23 -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           Sat, 27 Mar 1999     Volume: 8 Number: 5239

Today's topics:
        [perlipc] is this perlish? (Marc Haber)
    Re: CGI/Perl help needed <ebohlman@netcom.com>
        combine multiple files into one <h0p2468@acs.tamu.edu>
    Re: Compiling Perl Scripts <gellyfish@gellyfish.com>
    Re: Compiling Perl Scripts (Chris Tremblay)
    Re: Compiling Perl Scripts <wflanagan@msn.com>
    Re: Easy ?... why doesn't this script run on NT? <All@n.due.net>
    Re: Easy ?... why doesn't this script run on NT? (Larry Rosler)
    Re: Help!  How scanf() in Perl? <ebohlman@netcom.com>
    Re: Help!  How scanf() in Perl? <gellyfish@gellyfish.com>
    Re: Help... Running Perl on NT <gellyfish@gellyfish.com>
    Re: HELP: Confused about Hash Table. (KEhlar)
    Re: Making Perl work with Netscape / IE <gellyfish@gellyfish.com>
    Re: Need help with WIN32::GUI (Jan Dubois)
        Newbie cgi DBM help needed ("Thomas J. Margolis")
    Re: Newbie cgi DBM help needed <gellyfish@gellyfish.com>
    Re: newbie questions <gellyfish@gellyfish.com>
    Re: Newbie: Browser keeps trying to download scripts.. <gellyfish@gellyfish.com>
    Re: No clues to Win32::NetResource problem? <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
    Re: Q: set perl path in perl script <gellyfish@gellyfish.com>
    Re: Q: set perl path in perl script (Tad McClellan)
    Re: Reading a non Archived ( Live ) file with PERL <gellyfish@gellyfish.com>
    Re: regexp on block of text <gellyfish@gellyfish.com>
    Re: remote user password <gellyfish@gellyfish.com>
    Re: Request: Sample Multi Threaded Perl TCP Server/ <gellyfish@gellyfish.com>
    Re: Sending files with CGI <gellyfish@gellyfish.com>
    Re: SENDMAIL not allowing Content-Type: multipart/mixed <gellyfish@gellyfish.com>
    Re: Starting programs under Win95 <gellyfish@gellyfish.com>
        testing ignore <rickb@exchsvr.spawar.navy.mil>
    Re: Working with threads: reading a core file <gellyfish@gellyfish.com>
        Writing isn't working, and the mode is set, Help! <wflanagan@msn.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 27 Mar 1999 10:49:30 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: [perlipc] is this perlish?
Message-Id: <7did3r$spi$1@news.rz.uni-karlsruhe.de>

Hi!

Last night, I have written a code snippet that I am including in my
article. This is a wrapper for less to make it HUP-aware. I am
monitoring a log file and would like to be able to restart the less
process with a signal which will be sent by the logrotate process.

I am new to perlipc and would like to know if there is something that
i could make more efficient and more perlish.

|#!/usr/bin/perl -w
|
|use strict;
|
|my $HUPped=0;
|my $TERMed=0;
|my $childpid=0;
|
|my $tty = "/dev/ttya2";
|my $commandline = "/usr/bin/less -S +F /var/log/messages"; # <$tty >$tty 2>$tty";
|
|$SIG{HUP} = sub { $HUPped++ };
|$SIG{TERM} = sub { $TERMed++ };
|
|until( $TERMed )
|{
|	$childpid = fork;
|	die "can't fork: $!" if !defined $childpid;
|	if( $childpid==0 )
|	{
|		exec "$commandline";
|		die "exec failed: $!";
|	}
|	else
|	{
|		until( $TERMed || $HUPped )
|		{
|			sleep 40;
|		}
|		$HUPped = 0;
|		kill "TERM", $childpid;
|		sleep 20;
|		kill "KILL", $childpid;
|		if( wait != $childpid )
|		{
|			die "we killed the wrong child";
|		}
|		if( $TERMed )
|		{
|			exit;
|		}
|	}
|}

Your comments will be appreciated.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Sat, 27 Mar 1999 09:33:05 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: CGI/Perl help needed
Message-Id: <ebohlmanF98yJ5.1Ar@netcom.com>

Jamester76 <jdalldata@my-dejanews.com> wrote:
: I have a perl program that works, but when I try to run it on the webserver,
: it gives me a Malformed header message in the errorlog.

: Here is a sample of what I am doing:
: #!/usr/bin/perl
: print "Content-type: text/html\r\n\r\n";
: print '<TITLE>Directory listing of root directory</TITLE>';
: print '<h1>Here is root listing</h1>';
: $jamie = system 'rsh','remotehost','run-this-program.sh';
: print "$jamie";

It sounds to me like you want to display the output returned by the rsh 
command, but you're going about it the wrong way.  perldoc -f system will 
give you a good explanation of the problem and how to solve it.



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

Date: Sat, 27 Mar 1999 08:15:35 -0800
From: "Mei" <h0p2468@acs.tamu.edu>
Subject: combine multiple files into one
Message-Id: <7diphl$q97$1@news.tamu.edu>

Hello,

I have a few hundred of text files that contain the same format of data.
Each one of them is very short (~ 5 lines).

I need to combine them into one text file then do some processes from there.
I have copied and pasted some of them already, but I felt very boring in the
process.

Somebody suggested me to write a perl script to do it, because it is likely
I will have a lot more this kind of files been generated each week.  I have
very limited knowledge in perl, could some one help me with the script?

Any help will be greatly appreciated.  Thank you very very much.

Mei





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

Date: 27 Mar 1999 11:51:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Compiling Perl Scripts
Message-Id: <7dign5$19g$1@gellyfish.btinternet.com>

On 27 Mar 1999 07:49:39 GMT Peter Sergeant wrote:
> If I've written a Perl Script in a Win95 or Dos version of Perl, is there
> any program I can get to compile it as an EXE that will work on any
> computer?
> 

Er no. It will only run on an Intel NT or Win9[58] machine.

Otherwise:

   =head1 Found in /usr/lib/perl5/5.00502/pod/perlfaq3.pod

   =head2 How can I compile my Perl program into byte code or C?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 27 Mar 1999 15:15:17 GMT
From: anne@NOstormSPAM.ca (Chris Tremblay)
Subject: Re: Compiling Perl Scripts
Message-Id: <36fcf592.40453569@news.storm.ca>

I may be wrong but ... No.
You would need perl on any machine that would run the script (notice
it is called a script and not a program. But then again who knows
someone may be working on something that will do that but I never
heard of it.

On 27 Mar 1999 07:49:39 GMT, "Peter Sergeant" <petes@hempseed.com>
wrote:

>If I've written a Perl Script in a Win95 or Dos version of Perl, is there
>any program I can get to compile it as an EXE that will work on any
>computer?
>
>Thanks for  the time
>
>Peter J Sergeant



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

Date: Sat, 27 Mar 1999 10:16:25 -0500
From: "William Flanagan" <wflanagan@msn.com>
Subject: Re: Compiling Perl Scripts
Message-Id: <922547786.773.47@news.remarQ.com>

You can get a complier for Windows machines, but not one that will compile
it to run on windows and other machines.

Wf

Peter Sergeant <petes@hempseed.com> wrote in message
news:01be7826$f4d2d220$e2e5abc3@martinse...
> If I've written a Perl Script in a Win95 or Dos version of Perl, is there
> any program I can get to compile it as an EXE that will work on any
> computer?
>
> Thanks for  the time
>
> Peter J Sergeant




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

Date: Sat, 27 Mar 1999 12:05:40 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: Easy ?... why doesn't this script run on NT?
Message-Id: <oQ3L2.13574$DM5.3797@news.rdc1.ct.home.com>

rogerDH <rogdh@iname.com> wrote in message
news:36fc47a7.2703237@news.earthlink.net...
: I type this in on my command line...
: perl -e 'print "hello, world!";'
: The error message I get is...
: Can't find string terminator "'" anywhere before EOF at -e line 1.

See Perlfaq3:
Why don't perl one-liners work on my DOS/Mac/VMS system?

In DOS, you need to start the line with double quotes.  To try and keep my
one-liners as consistent as possible I use qq and q.

perl -e 'print qq(hello, world!);' #*NIX
perl -e "print qq(hello, world!);" #DOS

All I need to change is the type of quote at the beginning and end.  Just
makes it easier for me when I switch back and forth.  Of course we don't
need double quotes here anyway, but just for future reference.

HTH

AmD




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

Date: Sat, 27 Mar 1999 06:52:47 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Easy ?... why doesn't this script run on NT?
Message-Id: <MPG.116690948eb6bf4c9897db@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <oQ3L2.13574$DM5.3797@news.rdc1.ct.home.com> on Sat, 27 Mar 
1999 12:05:40 GMT, Allan M. Due <All@n.due.net >says...
 ...
> perl -e 'print qq(hello, world!);' #*NIX
> perl -e "print qq(hello, world!);" #DOS
> 
> All I need to change is the type of quote at the beginning and end.  Just
> makes it easier for me when I switch back and forth.  Of course we don't
> need double quotes here anyway, but just for future reference.

Why don't you try the second command on Unix as well?  You may be 
pleasantly surprised!

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


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

Date: Sat, 27 Mar 1999 09:40:18 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Help!  How scanf() in Perl?
Message-Id: <ebohlmanF98yv6.1KM@netcom.com>

Les Neste <lesneste@mindspring.com> wrote:
: I'm relatively new to Perl but seem to have reached critical mass for
: writing useful code.  Still one thing I haven't seen, though:  is
: there a way to get the same functionality as C provides through
: scanf()?  I can figure out how to get the same result, but I end up
: having to write a lot of case-specific code, and I wonder whether Perl
: provides a general-purpose solution?

There's nothing that's drop-in equivalent, but you can achieve the same 
effect by using regexes (for cases where the input fields are 
variable-length) or unpack (where they're fixed-length).



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

Date: 27 Mar 1999 11:01:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help!  How scanf() in Perl?
Message-Id: <7didqb$12s$1@gellyfish.btinternet.com>

On Sat, 27 Mar 1999 05:04:54 GMT Les Neste wrote:
> Hi friends,
> 
> I'm relatively new to Perl but seem to have reached critical mass for
> writing useful code.  Still one thing I haven't seen, though:  is
> there a way to get the same functionality as C provides through
> scanf()?  I can figure out how to get the same result, but I end up
> having to write a lot of case-specific code, and I wonder whether Perl
> provides a general-purpose solution?

No Perl does not have a direct scanf equivalent.  Generally people will
read from STDIN in the normal manner and use either a regex (with capturing)
, unpack or even perhaps substr to decompose the input.  I find that this
is no more 'case-specific' than what you would do with scanf in C but
thats me.

If one wanted to write a generic scanf function for perl probably unpack()
would be the prime candidate for the implementation but I would suggest
that it would be an introduction of something unnecessary where there are
so many other facilities available - if you feel that you need to have a
scanf it might be a sign that you Perl indoctrination is not complete - I
would prescribe several days locked in a room with a camel far away from C.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 13:09:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help... Running Perl on NT
Message-Id: <7dila4$1hl$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 19:16:13 -0500 Raven513 wrote:
> 
> You need to add the MIME-type for application/x-perl.  Set it to .pl
> file extension.  Check your web server docs for details.
> 

Er no. As well as having nothing to do with Perl it is also incorrect.
If the server doesnt know what to do with a CGI program adding a MIME
type will only contribute to the browsers confusion.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 26 Mar 1999 14:56:31 -0500
From: KEhlarQUASH@SPAMMERtheglobe.com (KEhlar)
Subject: Re: HELP: Confused about Hash Table.
Message-Id: <MPG.1165b07ba9566d099897a5@nntpd.bb.dec.com>

I think I've really confused those who read my question.  I apologize for that.  
I was really confused about how Perl handles hash tables.  I was trying to split 
the keys and values using "split /,/" but realized later, after having played 
with Perl and read lots of material online, that it's not necessary (in hash 
tables).  So I guess this time I've answered my own question (after having 
confused others on this newsgroup....*sorry*).

Thanks to those who responded to my post and tried to help.

Novey Chou
-- 
remove QUASH SPAMMER from email address.


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

Date: 27 Mar 1999 10:49:04 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Making Perl work with Netscape / IE
Message-Id: <7did30$11o$1@gellyfish.btinternet.com>

On 27 Mar 1999 07:48:05 GMT Peter Sergeant wrote:
> How can I make a Perl work with my internet browser. By this, I mean, if I
> install either a Dos or Win95 version, how can I use it to test my CGI
> scripts. I have MS Personal Web Server. Should this help?
> 

This comes into 3 parts -

A) Perl does not work with your internet browser unless you happen to
   be using a MSIE that supports active scripting an have PerlScript
   in your HTML pages.

B) If you are using CGI.pm you can test your programs offline at the
   command line.

C) If you want to test your programs as they would be seen online you
   will need an HTTP server - however the choice of server and its
   configuration in order to work with some interpreter to do CGI is
   out of the scope of this group.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 27 Mar 1999 12:13:11 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Need help with WIN32::GUI
Message-Id: <3703b726.11032163@news3.ibm.net>

[mailed & posted]

"RANDALL LEBLOND" <leblondrp.m@worldnet.att.net> wrote:

>Can't load 'D:\PERL\site\lib\auto\Win32\GUI\GUI.dll' for module Win32::GUI:
>load
>_file:One of the library files needed to run this application cannot be
>found at
>D:\PERL\lib/DynaLoader.pm line 168.
>
>at hello.pl line 8
>BEGIN failed--compilation aborted at hello.pl line 8.
>Deep recursion on subroutine "Win32::GUI::AUTOLOAD" at
>D:\PERL\site\lib/Win32/GU
>I.pm line 340.
>Out of memory!
>Error: Parse exception

You are very likely using a an older version of the module, which was
precompiled for ActiveState Perl build 3xx. You need a version compiled
for ActivePerl. There is a PPM copy on Jenda's page:

    http://jenda.krynicky.cz/

But I think this is not the latest beta version. Please subscribe to the
Win32::GUI mailing (address also on Jenda's page) to find people who could
help you with Win32::GUI. :-)

>The files are where they are suppose to be, I'm guessing from reading
>previous posts about this that I need to rebuild the module to work with my
>copy or perl?  I am running Activestate Perl for win32 version 5.00502.
>Please help me and tell me what I'm suppose to do. -David

You are supposed to crosspost when you send a message to multiple
newsgroups and NOT send additional copies. :-)

-Jan


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

Date: Sat, 27 Mar 1999 02:45:00 +0000
From: tmargolis@seqnet.net ("Thomas J. Margolis")
Subject: Newbie cgi DBM help needed
Message-Id: <199903271056.DAA13089@seqserv.seqnet.net>

Hello all,

I'm new to Perl5 (Perl4 is already my friend) and I want to...
1.) Learn how to "upgrade" Perl4 to Perl5 in my brain;
2.) Learn how to find, install, and use a DBM module;
3.) Learn how to use Perl5 to interact with databases.

Can anyone point me to a good book and/or URL? 

Thanks,

Tom
tmargolis@seqnet.net



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

Date: 27 Mar 1999 13:22:16 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie cgi DBM help needed
Message-Id: <7dim28$1ho$1@gellyfish.btinternet.com>

On Sat, 27 Mar 1999 02:45:00 +0000 "Thomas J. Margolis" wrote:
> Hello all,
> 
> I'm new to Perl5 (Perl4 is already my friend) and I want to...
> 1.) Learn how to "upgrade" Perl4 to Perl5 in my brain;

you probably want to take that to alt.neurosurgery if you want to do it
yourself - unfortunately there is a six month withing list on the
programmer Perl 5 retrofit at the moment.

> 2.) Learn how to find, install, and use a DBM module;

Do you mean DBI / DBD ?  If so then it is simply a matter of downloading
the relevant .tar.gz files unpacking them reading the README file following
the instructions therein and so on and so forth - the majority of the
DBD modules are well documented.

> 3.) Learn how to use Perl5 to interact with databases.
> 

DBI and the relevant DBD module for your database.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 12:08:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie questions
Message-Id: <7dihn8$1b0$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 15:36:29 -0500 Jay Glascoe wrote:
> John Callender wrote:
>> 
>> > $string=s/\t\n/\n/g
>> 
>> Sure. This is patented Perl Newbie Mistake #4: using an assignment
>> operator ( = ) instead of a tie operator ( =~ ).
> 
> <snip>
> 
> oops... I totally missed that!  But, I still maintain
> that it's a syntactically valid statement.  :-P
> 

Of course sometimes it *is* useful to know how many substitutions one has
done on $_ .

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 13:03:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie: Browser keeps trying to download scripts..
Message-Id: <7dikvi$1hh$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 08:25:20 -0500 Mark Bennett wrote:
> I was able to install perl and run these scripts on other machines but
> one machine is being a pain.
> no matter what when the script is run it tries to either download the
> file  or runs the script from the perl exe in the dos window.
> (yes, I'm on the machine of the evil empire... sorry)
> Any insight would be appreciated.

A server configuration problem that should be taken to:

comp.infosystems.www.servers.ms-windows

you are running some HTTP server arent you ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 27 Mar 1999 02:05:31 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: No clues to Win32::NetResource problem?
Message-Id: <V22L2.8371$_47.7860@news2.giganews.com>

Uwe W. Gehring wrote in message <36FB4730.AD3CAE1D@politik.uni-mainz.de>...
>Hi,
>
>this is a reposting since no one answers to the same posting earlier to
>comp.lang.perl.misc.
>
>The Win32::NetResource on AvtiveStates 509 Build does not work properly.
>Some functions work (i.e. NetShareAdd, NetShareDel), but others not,
>i.e. NetShareGetInfo. The following script returns absolutely nothing -
>not even an error. I have a clean installation just added the AdminMisc
>Module (which works).
>
>use Win32::NetResource;
>
>$myshare = "Programme";
>
>Win32::NetResource::NetShareGetInfo($myshare,\%share_info)
> || die "Unable to get share information\n";
>
>foreach $i (keys %share_info) {
>        print $share_info{$i},"\n";
>}
>
>exit;

Try specifing the machine name (even if the share is local):
  Win32::NetResource::NetShareGetInfo( $myshare, \%share_info, $machine )

Whenever I run this function on my NT server with less than three
parameters I get a runtime exception and Perl pukes (ActiveState build
509).
Your function is correct, it looks like there may be a bug in
Win32::NetResource.

dave
--
=================================================================
Dave Roth                                ...glittering prizes and
Roth Consulting                      endless compromises, shatter
http://www.roth.net                     the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net

Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/





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

Date: 27 Mar 1999 11:23:16 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Q: set perl path in perl script
Message-Id: <7dif34$16a$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 15:44:03 -0800 Lupei Zhu wrote:
> Hi,
> 
>   I know that in perl script I should put '#!/perl_path/perl' at the
> first line. the problem is that
> differnt machines installed perl at different places, such as
> /opt/perl/bin or /usr/local/bin. When
> i move my scripts to a different site, i have to edit them to change the
> perl_path which is really
> annoying. Does anyone have a solution?
> 

The choices are :

A) create a link from the actual location of your perl to some well know
   location (usually /usr/local/bin/perl )

B) use the 'env' shell command to find perl in your path.

C) Edit your files inplace :

 perl -pi.bak -MConfig -e 's/^#!.+/$Config{startperl} -w/' jj.pl

You pays your money and takes your choice ...

/J\

-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 27 Mar 1999 04:47:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Q: set perl path in perl script
Message-Id: <if9id7.gb2.ln@magna.metronet.com>

Lupei Zhu (lupei@gps.caltech.edu) wrote:

:   I know that in perl script I should put '#!/perl_path/perl' at the
: first line. 


   You should put

      #!/perl_path/perl -w

   at the first line.


   Let perl help you find your mistakes.


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


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

Date: 27 Mar 1999 15:05:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading a non Archived ( Live ) file with PERL
Message-Id: <7dis42$1ov$1@gellyfish.btinternet.com>

On Wed, 24 Mar 1999 00:26:40 GMT kamez@my-dejanews.com wrote:
> Hello there,
> could you help me for the following stuff : i wanna read a live file with
> variable size ( on records ) , each time i find out a certain string in a
> record newly created on my file , i wanna launch a specific process...
> 

I'm not entirely sure what you mean by this but I guess you want to do
something similar to 'tail -f' in which case you could actually use
'tail -f' in a pipe:

open(TAIL,'/usr/bin/tail -f |') || die 'Blah ...';

while(<TAIL>)
{
  ....

}

You may have to deal with some buffering problems however.

Alterantively you could look at perlfaq5:


=head2 How do I do a C<tail -f> in perl?

Which has a couple of suggestions.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 12:13:10 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regexp on block of text
Message-Id: <7dii0m$1b4$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 20:01:14 GMT stenew@my-dejanews.com wrote:
> 
> I am able to get the AccessedByINS, but not all the parameters.  What am I not
> understanding?
> 

I dont want to seem glib but I think that what you are not understanding is
that sometimes it is necessary to create a full on parser rather than using
a regular expression to do this kind of stuff - not that I am volunteering
to create on for you ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 15:29:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: remote user password
Message-Id: <7dithf$1ps$1@gellyfish.btinternet.com>

On Thu, 25 Mar 1999 21:01:56 -0500 Mark David! wrote:
> 
> Okay, maybe I didn't make myself clear.  

You made yourself perfectly clear but I think the responders did too.

>                                           I have written a PERL script
> that when a 401 occurs on the server, it logs the passed variable
> information into a log file (such as user's IP, HTTP_REFERER, etc), and
> I can get it to log the "REMOTE_USER" variable, which is what the user
> was trying to authenticate with, but is there a variable that contains
> what password the user tried to enter?
> 

The answer to your question is independent of whatever language you may be
using to write your program.

I think you need to look at the CGI FAQ at:

<http://www.webthing.com/page.cgi/cgifaq>

The executive summary of the answer to your question is 'no'.

> Is that clear enough?
> 

Is that clear enough ?


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 16:04:06 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Request: Sample Multi Threaded Perl TCP Server/
Message-Id: <7divhm$1uq$1@gellyfish.btinternet.com>

On Tue, 23 Mar 1999 21:50:11 +0100 Willem wrote:
> Could someone post a sample multi threaded perl tcp server (I gues this
> would use the perl 'fork' function?), because some sample things would help
> me through!
> 

OK here is a pretty dumb little thing that just sends back the headers
sent from your browser :


#!/usr/bin/perl -w

use strict;
use IO::Socket;

sub Slayer {
  1 until ( -1 == waitpid(-1,0));
  $SIG{CHLD} = \&Slayer;
}

$SIG{CHLD} = \&Slayer;

my $server = IO::Socket::INET->new(LocalPort => 8080,
                                   Type      => SOCK_STREAM,
                                   Reuse     => 1,
                                   Listen    => 10) or die "blah $@\n";
my $client ;

while ( $client = $server->accept())
{
  next if  my $pid = fork;
  die "fork - $!\n" unless defined $pid;

   my $headers;

   while(<$client>)
     {
       last if /^\r\n$/;
       $headers .= $_;
     }

  select $client;
  $| = 1;
  print $client "HTTP/1.0 200 OK\r\n";
  print $client "Content-type: text/plain\r\n\r\n";

  print $client $headers;

  close($client);
  exit;
}
continue
{
  close($client);
}

If you are running this on your own machine then you would access it like:

http://localhost:8080/


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 14:41:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sending files with CGI
Message-Id: <7diqnl$1la$1@gellyfish.btinternet.com>

On Tue, 23 Mar 1999 15:48:15 -0800 Aidan Curran wrote:
> I am using a Perl/CGI script to send files to the client. I am printing the
> HTTP header (just content-type) and then printing the contents of the file.
> I have had to resort to using a system call to the DOS command 'TYPE' to
> print the file contents as the Perl I/O commands corrupted the data - they
> worked fine with text files but not with binary files (even using
> 'binmode'). 
>
<snip>
> 
> How is the file data getting corrupted and is there any way to prevent this?
> 

Most probably you are not using binmode on the right filehandles - you will
need to binmode both your read filehandle and STDOUT I would suggest.  However
without seeing your code it is all a little difficult to say what is going
on.

> System Details:
> Perl: Perl 5.003 for Win32
> 
I would suggest that you should upgrade your Perl to the latest version for
Win32 - check out <http://www.activestate.com/ActivePerl>.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 13:44:55 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: SENDMAIL not allowing Content-Type: multipart/mixed header
Message-Id: <7dincn$1ib$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 12:06:45 GMT I.J. Garlick wrote:
> 
> I could be wrong as well, it would be much easier to debug if a here
> statement had been used. I suspect that Perl 4 doesn't support this
> feature, if I am wrong then Julian would make his life much easier by
> using one.
> 

No as far as i can determine 'here' documents have always been supported
by Perl.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 27 Mar 1999 15:16:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Starting programs under Win95
Message-Id: <7diso4$1pa$1@gellyfish.btinternet.com>

On 23 Mar 1999 14:51:45 GMT Matti Johannes Kdrki wrote:
> 
> (Is there any way to check the full path name for the default browser
> under Win95 or NT4 with Perl?)
> 

You will need to grovel around in the Registry - using I would suggest
the module Win32::Registry.  Beyond that you're on your own as I have
no idea what the key is.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 26 Mar 1999 15:26:49 -0500
From: rick bauman <rickb@exchsvr.spawar.navy.mil>
Subject: testing ignore
Message-Id: <A2EC51B617DBD211B0AF00001CB092A3B08C@exchsvr.nosc.mil>
Keywords: working

testing



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

Date: 27 Mar 1999 12:01:22 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Working with threads: reading a core file
Message-Id: <7dihai$1ag$1@gellyfish.btinternet.com>

On Fri, 26 Mar 1999 13:59:58 -0800 Carlos Cortes wrote:

> For one I'd like to be able to read a standard perl core file.  'gdb'
> doesn't seem to handle it.  Any suggestions?
> 

gdb does deal with coredumps however you may have to compile your perl
with a -g flag (assuming gcc) in order to activate the debugging
information . Having said that I cant say how this will pan out with
threads but I cant see that it should make any difference ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 27 Mar 1999 10:21:31 -0500
From: "William Flanagan" <wflanagan@msn.com>
Subject: Writing isn't working, and the mode is set, Help!
Message-Id: <922548096.859.103@news.remarQ.com>

All-

I've written a perl script to read a structured text file, and convert it to
comma delimited (exactly what Perl was written to do).  I am having a
problem, though with outputing records to a file.  I have the mode set
correctly, I have the privliges in the computer (Win32-based), but I can't
seem to make it work.  I've played around with mode.  Help!

I've included the code below for reference.  Please note that the mode
statements are after playing around with modes for about a day... so,
opening a file for writing only is ok, and that is what the original code
did.  I don't think it's a mode problem, but I don't know what else it could
be...

Thanks for looking,

William
wflanagan@msn.com

#!c:\progra~1\perl\bin\perl
# This is my first attempt at writing a program that will convert my Notes
database to a comma delimited
# file.  This takes any structured text file and converts it to comma
delimited.
# Function:  Reverse each line of a file

#-------
# Step Number 1: Get command line values:
#-------

if ($#ARGV !=1) {
    die "Structured Text to Comma Delimiter, 1999 William Flanagan\n Usage:
$0 inputfile outputfile\n";
    }
($infile,$outfile) = @ARGV;
   if (! -r $infile) {
      die "Can't read input $infile\n";
   }
   if (! -f $infile) {
       die "Input $infile is not a plain text, please use a structured plain
text file\n";
   }

#-------
# Step Number 2: Validate files
#-------

$mode='+<';
open(INPUT,"+<$infile") ||
    die "Can't open $infile successfully, ensure $infile is plain text $!";
if ( -e $outfile) {
    print STDERR "Output file $outfile exists!\n";
    until ($ans eq 'r' || $ans eq 'a' || $ans eq 'e' ) {
        print STDERR "replace, append, or exit? ";
        $ans = getc(STDIN);
        }
    if ($ans eq 'e') {exit}
    }
    if ($ans eq 'a') {$mode='>>'}

    else {$mode='>'}

open(OUTPUT,"$mode$outfile") ||
    die "Can't create $outfile file, ensure that it does not exist $!";


$ccount = 0;

#------
# Step Number 3: Read input, preprocess, and add to first line arguments for
output
#------

while ($line = <INPUT>) {
    ($fieldname, $fieldvalue) = split(":", $line);
    if ($fieldname eq '') {
       next;}
    chomp($fieldvalue);
    chomp($fieldname);
    $foundfield='n';
    for ( $a=0; $a <= $ccount; $a++) {
         if ($columnlist[$a][1] eq $fieldname) {
         $foundfield='Y';
         last; }
    }
    if ($foundfield eq 'n') {
        $columnlist[$ccount] = ["$ccount", "$fieldname"];
        print STDOUT "Adding $fieldname to record list.\n";
        $ccount++;
    }
}

print STDOUT "\n\nTotal ccount is $ccount.\n";

#------
# Step Number 4:  Gather outputfile information
#------

close INPUT;

open(INPUT,"<$infile") ||
    die "Can't open $infile successfully, ensure $infile was not deleted or
moved $!";

$j=0;
while ($line = <INPUT>) {
    ($fieldname, $fieldvalue) = split(":", $line);
    chomp($fieldvalue);
    chomp($fieldname);
    $foundfield='n';
    if ($fieldname eq '') {
       $eorcount++;
       print STDOUT "\nEnd of Record count number $eorcount.\n\n";
       if ($eorcount eq 3) {
          for ($k=0;$k<=$#recorddata;$k++) {
               select OUTFILE;
               print "$recorddata[$k]", ", ";
               select STDOUT;
               print "$recorddata[$k]", ", ";
          }

          select OUTFILE;
          print "\n";
          select STDOUT;
          print STDOUT "\n";
          @recorddata = ();
          $eorcount = 0;
          next;
       }
    }
    for ( $a=0; $a <= $ccount-1; $a++) {
         print STDOUT "Comparing $fieldname to $columnlist[$a][1].\n";
         if ($columnlist[$a][1] eq $fieldname) {
            @recorddata[$a] = $fieldvalue;
            print STDOUT "Found $fieldname in record, adding @recorddata[$a]
to record.\n";
            $foundfield='Y';
            $eorcount = 0;
            last;
         }
    }
    if ($foundfield eq 'n') {
          $eorcount++;
    }
print STDOUT "Moving onto record $j\n\n";
$j++;
}


#-------
# 4: Done!
#-------

    close INPUT,OUTPUT;
    exit;











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

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

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