[8009] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1634 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 03:05:22 1998

Date: Wed, 14 Jan 98 00:00:54 -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           Wed, 14 Jan 1998     Volume: 8 Number: 1634

Today's topics:
     Re: Clever way to trash a bunch of global variables? <joseph@5sigma.com>
     Re: define variable names at run time? <rootbeer@teleport.com>
     Re: Displaying GIFs - oops <rjk@coos.dartmouth.edu>
     Re: Form entry limited to about 1950 characters?  Why? <rootbeer@teleport.com>
     Re: getpwnam on Solaris not giving me password? <joseph@5sigma.com>
     Re: getpwnam on Solaris not giving me password? <joseph@5sigma.com>
     Help Needed bc7336788@ntu.edu.sg
     Re: Help Needed (brian d foy)
     Help: sendmail can not send international character <thada@chuosenko.th.com>
     Re: How do I convert 19971016085243 to time since the e <rootbeer@teleport.com>
     Learning Perl <mike@interways.com>
     Re: performing subroutine on a strange set of elements  <rootbeer@teleport.com>
     Re: perl under windows95 <keithmur@mindspring.com>
     Re: PGP Plugin <rootbeer@teleport.com>
     Re: putenv equivalent? <rootbeer@teleport.com>
     simple Perl question <black@cia.com.au>
     Re: simple Perl question (brian d foy)
     Re: sorting arrows <rootbeer@teleport.com>
     source into binary code <wschow@Comp.HKBU.Edu.HK>
     Re: Speed up a file write? (perl tricks in a cgi script (brian d foy)
     Re: Speed up a file write? (perl tricks in a cgi script (Shishir Gundavaram)
     Re: tar, z, gz unzip,Win95 <cseh@best.com>
     Re: Testing for valid numeric values <rjk@coos.dartmouth.edu>
     Re: unlink () doesn't work under NT <koos_pol@bigfoot.com>
     Re: Using Perl and CGI for background execution (brian d foy)
     Re: Using Perl and CGI for background execution <joseph@5sigma.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jan 1998 23:10:09 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Clever way to trash a bunch of global variables?
Message-Id: <34BC56B1.2F8F9558@5sigma.com>

I'm not real sure what sorts of symbol table mucking are safe
with respect to mod_perl.  However, let's suppose Dean's program
uses only lower-case variable names.  He could start off his
program like this:

  package MyProgram;
  reset 'a-z';

What is this reset thing?  See man perlfunc.

	-joseph
	 http://www.effectiveperl.com

Shishir Gundavaram wrote:
> 
> Dean Pentcheff (dean@tbone.biol.sc.edu) wrote:
> : I'm looking for a quick'n'dirty solution to a small problem.  I've got
> : a Perl program that runs fine as a CGI script (NO, this is NOT a CGI
> : problem, please read on...).  I'd now like to run it under mod_perl
> : (which, if you aren't aware of it, compiles the program once using a
> : perl interpreter in the WWW server itself, then reinvokes the program
> : for each incoming request).
> 
> How about hacking the symbol table directly. Untested code follows:


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

Date: Tue, 13 Jan 1998 21:11:33 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Michael R. Harper" <mikihasa@worldnet.att.net>
Subject: Re: define variable names at run time?
Message-Id: <Pine.GSO.3.96.980113210353.22337X-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Michael R. Harper wrote:

> Does Perl have the capability to define variable names at runtime?

Yes, but you're usually better off to avoid this in favor of true
references or other methods.

> For instance, let's say I have a three-character code (stored in an
> array named @CODE) that I want to use as the name of an associative
> array, 

(Have you considered what might happen if the three characters are 'INC',
'ENV', or 'SIG'?)

Instead of making a new hash with the given string as the name, use an
anonymous hash and store its reference into a named hash, like this.

    $trigram = 'ISA';			# or whatever
    $my_hash{$trigram} = { };		# new anonymous hash
    $my_hash{$trigram}{foo} = 'bar';	# store elements into it

(Some people would do this in an even simpler manner.) Details are
available in the manpages perlref, perllol, and perldsc. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 00:56:17 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Displaying GIFs - oops
Message-Id: <34BC5381.3B3C5210@coos.dartmouth.edu>

Martien Verbruggen wrote:
> 
> In article <34BC20B1.36F3@mediacity.com.sg>,
>         Patrick Stacey <patrick@mediacity.com.sg> writes:
> 
> >  print <IMAGE>;
> 
> You're only reading the first 'line' here, meaning the first bunch of
> bytes up to the record separator, which by default is a newline. If
> the bytes in the GIF at any point are by chance whatever a newline is
> on your system, it will stop reading.

No no no!

>From the perlop manpages:

     If a <FILEHANDLE> is used in a context that is looking for a list, a
     list consisting of all the input lines is returned, one line per list
     element.

print <IMAGE>; will read in and print every line in the file.

Chipmunk


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

Date: Tue, 13 Jan 1998 21:41:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Rick <rlluhman@netins.net>
Subject: Re: Form entry limited to about 1950 characters?  Why?
Message-Id: <Pine.GSO.3.96.980113214125.22337c-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Rick wrote:

> The following sub supplied as an addition to the Novell Webserver
> appears to limit the form to 1950 characters.  If I enter more than 1950
> characters I get the message "Your comment was not added.  Not all the
> information was filled in".  Any suggestions to overcome this
> limitation? 

Fix the code to use CGI.pm and the POST method. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 13 Jan 1998 23:25:05 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <34BC5A30.6B7470AC@5sigma.com>

Running as root?

Nonprivileged users are not supposed to be able to get at the
password field, at least not that I'm aware of.  That is the whole
point of shadow passwords.  Why make the shadow file unreadable if
there is a system call that nonprivileged users can use to read
it anyway?

	-joseph

Keith Keilholtz wrote:

> I wrote a small c program (my c is very rusty) to retrieve the encrypted password using the
> getspnam system routine, but I was getting *NP* returned as the encrypted password.  Don't know
> why.


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

Date: Tue, 13 Jan 1998 23:26:58 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <34BC5AA1.D5568DFA@5sigma.com>

Oh, and here, right out of the 2.5.1 man page:

     Access to shadow password information may be restricted in a
     manner  depending on the database source being used.  Access
     to the /etc/shadow file is generally restricted to processes
     running  as  the  super-user (root).  Other database sources
     may impose stronger or less stringent restrictions.

     When NIS is used as the database source, the information for
     the   shadow   password   entries   is   obtained  from  the
     ``passwd.byname'' map.  This map stores only the information
     for the sp_namp and sp_pwdp fields of the struct spwd struc-
     ture.  Shadow password entries obtained from NIS  will  con-
     tain the value -1 in the remainder of the fields.

     When NIS+ is used as the database  source,  and  the  caller
     lacks  the permission needed to retrieve the encrypted pass-
     word from the NIS+ ``passwd.org_dir'' table, the  NIS+  ser-
     vice  returns  the  string  ``*NP*''  instead  of the actual
     encrypted password string.  The functions described on  this
     page  will  then return the string ``*NP*'' to the caller as
     the value of the member sp_pwdp in the returned shadow pass-
     word structure.

	-joseph
	 http://www.effectiveperl.com

Joseph N. Hall wrote:
> 
> Running as root?
> 
> Nonprivileged users are not supposed to be able to get at the
> password field, at least not that I'm aware of.  That is the whole
> point of shadow passwords.  Why make the shadow file unreadable if
> there is a system call that nonprivileged users can use to read
> it anyway?
> 
>         -joseph
> 
> Keith Keilholtz wrote:
> 
> > I wrote a small c program (my c is very rusty) to retrieve the encrypted password using the
> > getspnam system routine, but I was getting *NP* returned as the encrypted password.  Don't know
> > why.


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

Date: Wed, 14 Jan 1998 14:35:20 +0800
From: bc7336788@ntu.edu.sg
Subject: Help Needed
Message-Id: <34BC5CA8.DA0C69BB@letterbox.com>

Hi,

I have this problem with the system() function:

In my perl script, i have this line
system("Batchrun.bat");

On my PC, i have this batch file Batchrun.bat that holds these lines
javac Mondrain.java
copy Mondrain.java Mondrain.txt

when I run the perl script from my browser, the first line in the batch
file did not execute but the second line did.

I don't know why this happens. Can anybody help? Thanks.

YC



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

Date: Wed, 14 Jan 1998 02:27:48 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help Needed
Message-Id: <comdog-ya02408000R1401980227480001@news.panix.com>
Keywords: from just another new york perl hacker


Please check this information on how to choose a good subject for a post:
        http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

In article <34BC5CA8.DA0C69BB@letterbox.com>, bc7336788@ntu.edu.sg posted:

>I have this problem with the system() function:
>
>In my perl script, i have this line
>system("Batchrun.bat");

>when I run the perl script from my browser, the first line in the batch
>file did not execute but the second line did.

what happens when you run it from the command line?

since this problem is not a Perl problem, you might want to ask
further questions in a more appropriate newsgroup :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 14 Jan 1998 12:05:05 +0700
From: "ChuoSenko" <thada@chuosenko.th.com>
Subject: Help: sendmail can not send international character
Message-Id: <69hhcp$d4$1@news.ksc.co.th>

I have problem about sendmail . I want to send mail by sendmail in unix.
English character is ok but Thai Character have problem. Sendmail convert
Thai character to numeric such as #;2030.
Can anyone solve this problem for me.
thada@chuosenko.th.com





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

Date: Tue, 13 Jan 1998 21:01:55 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Toby Ounsted <tkounste@bechtel.com>
Subject: Re: How do I convert 19971016085243 to time since the epoch??
Message-Id: <Pine.GSO.3.96.980113210018.22337W-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Toby Ounsted wrote:

> The string 19971016085243 specifies the date that an event occoured,
> i.e. Year=1997, Month = 10th, Day =16th, time was 08:52:43 AM.  What I
> would like to do is to convert this string into the number of seconds
> since the epoch,

You could use unpack or a pattern match to break that into pieces, then
you could use one of the many Date modules to work with the pieces. Or
maybe one of the modules already handles that format. Or maybe the module
you're about to write will do so. :-)  Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 07:52:57 GMT
From: "Mike" <mike@interways.com>
Subject: Learning Perl
Message-Id: <01bd20b8$dafc96e0$3c42100a@nl-amv-dsk5002>

Hi,

Since I had it with JavaScript (caused by the missing support
of writing to files), I try to start learning Perl. My question is:
how can I tackle this? Download online FAQs? Study sources?
Buy some book? What is the best way to learn this wonderful
language.

Thanks in advance,
Mike - Interways Internet Services
http://www.interways.com


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

Date: Tue, 13 Jan 1998 20:52:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Lott <eclectic@polarnet.com>
Subject: Re: performing subroutine on a strange set of elements from array
Message-Id: <Pine.GSO.3.96.980113204900.22337S-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Chris Lott wrote:

> I have a 64 element array @foo. I want to perform a certain subroutine
> on elements 1,3,5,7,10,12,14,16,17 ...

I'm not sure what that sequence is, but you could pass those elements to
the sub by using a slice. 

    $result = &sub(@foo[1,3,5,7,10,12,14,16,17]);

Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 13 Jan 1998 11:08:47 -0600
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: perl under windows95
Message-Id: <34BB9F9F.30659203@mindspring.com>

In addition to what's been posted, another rather nice way to run it is
to set up a shortcut from your desktop.

1.  Right-click and do "New|Shortcut" from your desktop.
2.  For "Command line", fill in "C:\WINDOWS\COMMAND.COM".
3.  Click "Next".
4.  Under "Select a name for the shortcut", fill in "Run my perl
script", or whatever.
5.  Click "Finish".
6.  Now, you have an MSDOS shortcut on your desktop.
7.  Right-click it and select "Properties".
8.  For "Cmd line", fill in "perl.exe <yourscriptname>".  (Here, I'm
assuming your perl.exe is in your PATH).
9.  For "Working directory", choose whatever directory you want to be
the default for the script.
10. Make sure the "Close on Exit" box is *UNCHECKED* if you want your
output to hang around.
11. Click "OK".

Now you'll have a nice shortcut you can use from now on.

Kind of funny how you have to do the "C:\WINDOWS\COMMAND.COM" stuff
first, but that's necessary for Windows to know it's a DOS shortcut, and
that's necessary to get the "Close on Exit" box, which is pretty
important.  You may end up tailoring some of the memory and font
options, too...

cwtalbot@intellex.com wrote:
> 
> I recently loaded perl5 and am having trouble running it. I tried the
> Start menu then Run,typed "perl ProgramName.pl", but that doesn't work.
> Any ideas how to launch perl and run my program?
> 
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 13 Jan 1998 20:53:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Guz <mguz@sol.co.uk>
Subject: Re: PGP Plugin
Message-Id: <Pine.GSO.3.96.980113205334.22337T-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Mark Guz wrote:

> Anyone recommend a good pgp plugin for perl???

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 13 Jan 1998 20:57:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: michael engel <engel@carmel.cc.huji.ac.il>
Subject: Re: putenv equivalent?
Message-Id: <Pine.GSO.3.96.980113205618.22337V-100000@user2.teleport.com>

On Tue, 13 Jan 1998, michael engel wrote:

> Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules

What does this question have to do with modules?

> Is there in perl a command that is equivalent to "putenv" of C
> (or setenv DISPLAY ...)?

Perhaps you want to read section 8 of the FAQ. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Jan 1998 06:26:29 GMT
From: "Adam" <black@cia.com.au>
Subject: simple Perl question
Message-Id: <01bd20b6$b4638680$3c301ccb@adam>

Hi All,
I am new to Perl programming and need some help!
I am learning from a book by Erik Strom called:
	"Perl-CGI Programming..No Experience Necessary"

When I try to run the program - listed below - I get the error message:
htmlend.pl did not return a true value at hellowww.pl at line 5

I guess there is something incorrect in the syntax used in htmlend.pl to
define the subroutine. However, as this is my only reference source, I
don't know where I'm going wrong! Can someone please do me a favour and
have a quick look at the code below and tell me why it won't work??
Thanks very much for your attention.
Adam

black@cia.com.au

PS I tried running it form the command line, so I get error messages. If I
go through Netscape, it just sits there.


Hellowww.pl

#!c:/perl/bin/perl.exe

# hellowww.pl
# A Perl program that draws a Web page.
require "htmlend.pl"; 
    print "Content-type: text/html", "\n\n";  # MIME header.
    print "<HTML>", "\n";
    print "<HEAD>";
    print "<TITLE>Perl meets the World Wide Web</TITLE>", "\n";
    print "</HEAD>", "\n";
    print "<BODY>", "\n";
    print "<H1>Hello, World!</H1>", "\n";
&HTML_Footer
 
#                    End hellowww.pl


****************************************************************************
*****
htmlend.pl

#!c:/perl/bin/perl
# Set up a standard HTML footer section.  At this point, it simply
# ends the BODY and HTML sections.
 
sub HTML_Footer
{
#    print "\n","</BODY>", "\n";
#    print "</HTML>", "\n";
 
}                    # End HTML_Footer


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

Date: Wed, 14 Jan 1998 02:24:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: simple Perl question
Message-Id: <comdog-ya02408000R1401980224040001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd20b6$b4638680$3c301ccb@adam>, "Adam" <black@cia.com.au> posted:

>I am new to Perl programming and need some help!
>I am learning from a book by Erik Strom called:
>        "Perl-CGI Programming..No Experience Necessary"

Experience is a good thing because it teaches you to run away
from books like this one and to use CGI.pm

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 13 Jan 1998 21:17:18 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jahnel Klaus <jahnel@xarch.tu-graz.ac.at>
Subject: Re: sorting arrows
Message-Id: <Pine.GSO.3.96.980113211539.22337Y-100000@user2.teleport.com>

On Tue, 13 Jan 1998, Jahnel Klaus wrote:

> Subject: sorting arrows

(I think you mean "arrays".)

Section four of the Perl FAQ has an entry called "How do I sort an array
by (anything)?" That may have what you need. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Jan 1998 07:18:55 GMT
From: "Mr. Chow Wing Siu" <wschow@Comp.HKBU.Edu.HK>
Subject: source into binary code
Message-Id: <69hosv$4iua$1@power42t.hkbu.edu.hk>



Hi, I would like to know how to turn the perl source code 
into binary/executable code due to security.

Please forward your answers to wschow@comp.hkbu.edu.hk

TIA.

- -- 
PGP PUBLIC KEY: https://www.comp.hkbu.edu.hk/~wschow/pgp.html
Key fingerprint = 15 C4 36 D6 EC CF 1D A4  7F D8 F9 EF 2E D7 32 A6


Version: 2.6.3i
Charset: noconv

iQCVAwUBNLxrVL3ixeOqBhAdAQGBVQQAtdKfPOuMUEw1X9DOGXHz/nI31ABhGRjf
OqdLDpcvieNDwuLkI1fqCjSpVYLtct5FdYHQbV0Ryqi/k6Q4b7tlwjGLUj2Qz7Kt
TJlXtwEls6SFVz2WmpgxNf1+yiHYCQNyb+hcLwkMNuyq744Tpv/AWTQqG+HGJiIw
+rH7tiaWXgs=
=xFST
-----END PGP SIGNATURE-----


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

Date: Wed, 14 Jan 1998 00:22:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Speed up a file write? (perl tricks in a cgi script?)
Message-Id: <comdog-ya02408000R1401980022530001@news.panix.com>
Keywords: from just another new york perl hacker

In article <69heqj$2j0_002@mrw.panix.com>, awnbreel@panix.com (Michael R Weholt) posted:

>In article <34BC2E1A.82E3A625@5sigma.com>, 
>joseph@5sigma.com wrote:

>>One more stylistic comment.  Personally I would use a "here doc" string
>>to print stuff like this rather than a whole bunch of print statements.
>>It won't make much difference efficiency-wise but it looks cleaner:
>>
>>  print <<EOT;
>>  Here is a line.
>>  EOT
>
>Whoa.  First I've heard of it.  This is referred to as a "here 
>doc" string?  What's the <<EOT; do?  Tell the machine to print 
>everything after it until it gets to EOT?  How would I use that to 
>print to a file?
>
>print FN <<EOT;  (?)

that's the basic idea.  read all about it in the Camel book if you
are so inclined.  there are all sorts of nifty ways to quote
things - and most of them make your life much easier :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 14 Jan 1998 05:41:26 GMT
From: shishir@ruby.ora.com (Shishir Gundavaram)
Subject: Re: Speed up a file write? (perl tricks in a cgi script?)
Message-Id: <69hj66$n59$1@amber.ora.com>

Michael R Weholt (awnbreel@panix.com) wrote:
: In article <34BBB700.C347CFD9@5sigma.com>, 
: joseph@5sigma.com wrote:
: >
: >Do you have any idea whether the print statements are taking
: >up the time, or whether the time is being spent starting
: >up the Perl interpreter and loading Text::Wrap?

[deleted]

: calls will take from .1 to .45 seconds each (obviously depending on 

[deleted]

: Clearly I have to get that wrap call out of there.  Thanks.

Here's a replacement function that's a bit faster, but probably
not as robust:

sub wrap
{
    my ($string, $length, $tab) = @_;
    my $spaces;

    return unless $string;

    $length ||= 76;
    $tab    ||=  4;

    $spaces =  ' ' x $tab;
    $string =~ s/ ?\n/ /gs;
    $string =~ s/\t/$spaces/gs;
    $string =~ s/(.{0,$length}) /$1\n/gos;

    return $string;
}

Good luck.

--Shishir


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

Date: Tue, 13 Jan 1998 21:25:19 -0800
From: Frank Cseh <cseh@best.com>
Subject: Re: tar, z, gz unzip,Win95
Message-Id: <34BC4C3F.2886@best.com>

Rich Grise wrote:
> 
> Hello, this is probably the wrong newsgroup, but I downloaded
> some perl library files, but they're in z or gz or maybe tar
> format. Where can I get a free unzipper for those formats for
> Windows 95?
> Thanks.
> Rich Grise
> rmgrise@spacestar.net
````````````
WinZip 6.3 handles some of the unix comptessed files.
There is also DOS based Untar and gunzip programs.
( search the web for those names )

cseh@best.com
http://www.best.com/~cseh/


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

Date: Wed, 14 Jan 1998 00:37:05 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Testing for valid numeric values
Message-Id: <34BC4F01.AAFB431B@coos.dartmouth.edu>

John Porter wrote:
> 
> Matthew Cravit wrote:
> >
> > sub IsNumeric($) {
> >         $_[0] =~ m/\D/ ? 0 : 1;
> > }
> >
> > Hope this helps.
> 
> This subroutine returns True for arguments such as
> "Half-baked g0ggle-b0x d0-g00ders..."

It does?  Did you actually try it on that argument?

~> perl5
sub IsNumeric($) {
        $_[0] =~ m/\D/ ? 0 : 1;
}

print IsNumeric("Half-baked g0ggle-b0x d0-g00ders..."), "\n";
^D
0

Chipmunk


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

Date: Wed, 14 Jan 1998 07:52:56 +0100
From: Koos Pol <koos_pol@bigfoot.com>
Subject: Re: unlink () doesn't work under NT
Message-Id: <34BC60C8.2A3B@bigfoot.com>

Ko Kin (Xiao Gao) wrote:
> 
> I wrote:
> 
> unlink ("$jukebox[$i]\\$date\\*") || warn ("cannot delete files\n");

Try 
  unlink ("$jukebox[$i]\\$date\\*") || warn ("cannot delete files$!\n");

This should produce a diagnostic. BTW, unlink works on my NT 3.51
install.

-- 
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
PC Systems Administrator                   email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: Wed, 14 Jan 1998 00:20:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Using Perl and CGI for background execution
Message-Id: <comdog-ya02408000R1401980020240001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BC4367.C5114E1@SPAMLESSctp.com>, Mike Hardy <mhardy@ctp.com> posted:

>I'm using the JavaWebServer (kinda interesting, as an aside) 1.0.3, on

>Everything CGI seems just fine and dandy except that no matter what I
>try to do, the server waits on all children to exit before it will
>display the page that the script generated.
>
>This is a problem because one of the things the script does is fire off
>a huge, time-consuming job that I certainly don't want to wait for :-)

sounds like a buffering problem, but then you have to have data
before you can send it.  maybe the usual no parsed header trick will
work if the JWS supports that sort of thing.

>system("<job> &");
>
>a fork, then having the child do an exec "job";

if you don't need the output from that stuff, do the system as the
last thing in the script (i.e. after the HTTP data has been sent).
you may even want to close STDOUT so the server thinks you are 
finished sending output.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
kinda ironic that you aren't using servlets


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

Date: Tue, 13 Jan 1998 23:20:32 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Using Perl and CGI for background execution
Message-Id: <34BC591F.A0A4C604@5sigma.com>

Did the FAQs you consulted include Tom C's Idiot's Guide to
Solving CGI Problems (or whatever it's called)?  Well, that
aside, since it may not cover your exact problem ....

1) You must, of course, unbuffer STDOUT.
2) system waits on its child.  See 4).
3) Unless you are using non parsed headers, your server may 
   opt to retain all output generated from your script up till 
   it receives EOF on standard output, so that it can add useful 
   things like Content-Length to the headers.  Maybe you should
   send that EOF sooner (close STDOUT).
4) To start a daemon process that is owned by init, you need
   to fork a child, have the child fork another process which
   will become your daemon, and then exit the child process.  When 
   the grandchild process is orphaned it becomes a child of init.
   You need to use fork and possibly exec for this.

	-joseph
	 http://www.effectiveperl.com

Mike Hardy wrote:
> 
> Hi, I rooted around in faqs for a good long time and was unable to come
> up with a satisfactory answer, though it may be simple.
> 
> I'm using the JavaWebServer (kinda interesting, as an aside) 1.0.3, on
> an HP-UX 10.20 machine with Perl 5.004_4 and cgiwrap to execute
> the cgi script as the user I want.
> 
> Everything CGI seems just fine and dandy except that no matter what I
> try to do, the server waits on all children to exit before it will
> display the page that the script generated.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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