[9538] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3132 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 12 18:08:08 1998

Date: Sun, 12 Jul 98 15:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 12 Jul 1998     Volume: 8 Number: 3132

Today's topics:
        "The opposite of read()" (John Siracusa)
    Re: "The opposite of read()" (Ronald J Kimball)
    Re: Bizarre copy of ARRAY in aassign? (Jonathan Stowe)
    Re: Bug? shift( split(' ',$_)); won't compile. (Tye McQueen)
    Re: Can I do it with ioctl() with Perl ? (Jonathan Stowe)
    Re: Code for deciding week number? <tchrist@mox.perl.com>
    Re: DB_File.pm <jkinoshi@pcs.usp.br>
        deplyoy perl in NT4 <lmkuang@sprint.ca>
        Execute another CGI In a CGI <uwtools@cse.cuhk.edu.hk>
    Re: Execute another CGI In a CGI (Jonathan Stowe)
    Re: extracting data out of html page, LWP::USerAgent (Jonathan Stowe)
    Re: Getting a web page before a process finishes.. <aar@nwark.com>
    Re: Getting Yesterday's Date <tchrist@mox.perl.com>
    Re: kill 0 always true?  How test pid? (Charles DeRykus)
    Re: Lenght of string and array problem... (Jonathan Stowe)
    Re: module installation problem (Tye McQueen)
        online Perl reference <albertlo@netvigator.com>
    Re: online Perl reference <tchrist@mox.perl.com>
    Re: online Perl reference (Jonathan Stowe)
    Re: Openin files (Jonathan Stowe)
        page is not showing until perl program is finished dwiesel@my-dejanews.com
    Re: page is not showing until perl program is finished (Jonathan Stowe)
    Re: Perl Beautifier Home Page <spamsux-tex@habit.com>
    Re: Perl Beautifier Home Page (Ilya Zakharevich)
    Re: Perl Beautifier Home Page <tchrist@mox.perl.com>
    Re: Perl Beautifier Home Page <tchrist@mox.perl.com>
    Re: Perl CGI under NT4.0 problem <jwb79@mail.idt.net>
        Perl debugging in emacs - possible? <jkinoshi@pcs.usp.br>
        perl IDE and compiler stlam@yahoo.com
    Re: Perl to populate Access 97 database <gbramlett@mediaone.net>
    Re: Perl to write data to Access database <jwb79@mail.idt.net>
    Re: PING / Traceroute Perl Script (Jonathan Stowe)
    Re: Problems creating files graemeaustin@my-dejanews.com
    Re: Putting CPAN on a CD:  good or not good? (Jonathan Stowe)
    Re: Putting CPAN on a CD: good or not good? <jll@skynet.be>
    Re: PUZZLE: make hat, take ham (Bart Lateur)
    Re: sending mail from within perl (Jonathan Stowe)
    Re: Weirdness in trying to extract year from localtime (Jonathan Stowe)
    Re: Where can I find GD.pm (Jonathan Stowe)
    Re: xs generates call to XFree (Tye McQueen)
    Re: y2k (Stefan Scholl)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Jul 1998 02:49:35 GMT
From: macintsh@cs.bu.edu (John Siracusa)
Subject: "The opposite of read()"
Message-Id: <6o987v$afv$1@news1.bu.edu>

Is there a buffered write routine other than print?  As the
docs say, write() isn't the opposite of read().  syswrite()
isn't what I'm looking for either.  fwrite() in the POSIX
module says "use print", but print just returns true or undef.
Is that what I'm stuck with?  (Well, not "stuck"...but you
know what I mean)

Oh, and while I'm here, word on the street (heh) is that
calling functions with &func is now deprecated.  Why?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow



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

Date: Sun, 12 Jul 1998 01:54:50 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: "The opposite of read()"
Message-Id: <1dc16cj.4o69hx1o82lpeN@bay1-163.quincy.ziplink.net>

John Siracusa <macintsh@cs.bu.edu> wrote:

> Is there a buffered write routine other than print?  As the
> docs say, write() isn't the opposite of read().  syswrite()
> isn't what I'm looking for either.  fwrite() in the POSIX
> module says "use print", but print just returns true or undef.
> Is that what I'm stuck with?  (Well, not "stuck"...but you
> know what I mean)

According to the Camel book, in the description of read:

"Note that the opposite of read is simply a print, which already knows
the length of the string you want to write, and can write a string of
any length."

What return value were you looking for?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 12 Jul 1998 21:37:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Bizarre copy of ARRAY in aassign?
Message-Id: <35a8eac1.7119213@news.btinternet.com>

On 10 Jul 1998 18:00:15 -0700, justinb@ignored.cray.com wrote :

>justinb@ignored.cray.com writes:
>
><snip>
>
>Fine, perlbug it is ...
>

Maybe a snippet of the code that produced the message hey ?  We are
after all not capable of psychic diagnosis.  Perhaps it might also be
illuminating for you to look into the CHANGES document with your Perl
in order to see what has changes in respect of the kind of statement
that has caused the error.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 12 Jul 1998 02:18:46 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: Bug? shift( split(' ',$_)); won't compile.
Message-Id: <6o9o0m$6tg@fohnix.metronet.com>

) Rob Hutchings wrote:
) > But if you're going to throw away the rest of the array, you
) > migt as well use
) > 
) >         $x=(split)[0];

Dan Boorstein <danboo@negia.net> writes:
) and you might as well limit the split to 2.

I'm surprised that isn't optimized by Perl like this is:

    ($x)= split;

[But then I haven't run benchmarks to prove that this is
actually optimized.]
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Sun, 12 Jul 1998 21:37:36 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Can I do it with ioctl() with Perl ?
Message-Id: <35a9287e.22644588@news.btinternet.com>

On Fri, 10 Jul 1998 14:34:34 +0200, Philippe Vivarelli wrote :

>Hi,
>
>I currently design a driver for a PRI ISDN pci board on linux.
>
>I wrote a little utility to be able to read the pci configuration of
>the  board (IRQ, Latency timer, etc..)
>
>Well this utility is written in C code and it run from a shell window.
>
>I would like to write an equivalent utility in perl to be ablle to read
>the board pci configuration from a browser.
>
Dont take this wrong - but is there any particular reason why need to
use Perl ?  It might be just as easy to alter your C program to do
this - the only differences lie in the output and input from the user
;-}
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 12 Jul 1998 13:19:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Code for deciding week number?
Message-Id: <6oad4d$d0f$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Thomas Albech <thomas@provideo.dk> writes:
:How do you mathematically decide, which week number we are currently in?
:Is there any expression for it
:in combination with the Time module?

American or European?

--tom
-- 
    "Perl5, surprisingly, makes it very easy to do OO programming.  I suspect
    that it does this much better than Larry ever intended."
	--Dean Roehrich in <1994Oct5.140720.1511@driftwood.cray.com>


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

Date: Sat, 11 Jul 1998 09:59:38 -0400
From: Jorge Kinoshita <jkinoshi@pcs.usp.br>
Subject: Re: DB_File.pm
Message-Id: <35A76FCA.98E1E16B@pcs.usp.br>

DCash wrote:

> Can some tell me where I can locate DB_File.pm  I was told that it came
> bundled with Perl but my sys admin doesn't have it.
>
> Thanks
> DCash

  To my concern, you must be looking a generic DB_File. You must specify
this DB_File by choosing GDBM_File.pm, SDBM_File.pm, etc. Yes, these files
comes with Perl.



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

Date: Sun, 12 Jul 1998 17:24:56 -0400
From: "L Kuang" <lmkuang@sprint.ca>
Subject: deplyoy perl in NT4
Message-Id: <900278738.460973@michelob>

I recently downloaded PERL_WIN32 from activestation and wish to deployed it
in NT with IIS4 server.

I did

download most recently PERL packages (5.003/5.004) from web, unpack the 3
files (PERLwin32, perlscript and perlIS), put them in my
%WinntDriver%\Inetpub\PERL5 dir, run the 3 installation batch files
consecutively:perl_win32_install.bat, perl_win32_script.bat,
perlis_install.bat.

After it is finished, I check the log and find the registry has been
changed. and nothing abnormal happened. But I didn't find PERLIIS.dll file
registered to application filter and I also encounter error msg running the
sample calculator from web.

I wonder my setup is correct? (also, I couldn't find useful docs about
setting up PERL for NT4 coming together with the package)

Anyone can give me a hand, thanks.

Liming





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

Date: 12 Jul 1998 06:07:58 GMT
From: Database and tools for Uniweb <uwtools@cse.cuhk.edu.hk>
Subject: Execute another CGI In a CGI
Message-Id: <6o9jru$ip8@eng-ser1.erg.cuhk.edu.hk>

I want to execute another CGI (CGI_Y) in a Perl CGI script (CGI_X).

1. I want to feed the string $qs to CGI_Y so that CGI_Y can get the query
   string from STDOUT (like the behavior of post). 

2. Also, I want the result of execution of CGI_Y to be stored in $result. 

How should I write in CGI_X to achieve the above two points?

Should I use pipe?

Thank you very much.


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

Date: Sun, 12 Jul 1998 21:37:20 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Execute another CGI In a CGI
Message-Id: <35a8f35f.9325166@news.btinternet.com>

On 12 Jul 1998 06:07:58 GMT, Database and tools for Uniweb wrote :

>I want to execute another CGI (CGI_Y) in a Perl CGI script (CGI_X).
>
>1. I want to feed the string $qs to CGI_Y so that CGI_Y can get the query
>   string from STDOUT (like the behavior of post). 
>
>2. Also, I want the result of execution of CGI_Y to be stored in $result. 
>
>How should I write in CGI_X to achieve the above two points?
>
You should probably use LWP::UserAgent available from CPAN.  The
module has excellent documentation thus I need not say any more.

>Should I use pipe?
>
I wouldnt...

>Thank you very much.
No problem

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 21:37:31 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: extracting data out of html page, LWP::USerAgent
Message-Id: <35a916bb.18173693@news.btinternet.com>

On Sat, 11 Jul 1998 12:06:39 -0700, Denis Du Bois wrote :

>I am trying to do something similar to what Abigail is trying. 

I have a feeling that Abigail *isnt trying anything* I think that she
was suggesting however.

>                                                               I can't
>find documentation for LWP::UserAgent and HTTP::request, etc. 
>

Thats a shame because the libwww-perl family of modules is pretty well
documented. If you type "perldoc LWP" or "man LWP" (depending on your
taste) then that presents a reasonably concise description of the
family with an example or two.  There is also a "libwww-perl cookbook"
(lwp-cook ?) that comes with the distribution.  Each individual module
has a fairly good set of POD with it as well.


Searching deja-news for these items will almost certainly throw up
plenty of discussion and quite a few examples on these matters.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 16:54:13 -0500
From: Al Ruth <aar@nwark.com>
To: Steve Swantz <max_eper@hotmail.com>
Subject: Re: Getting a web page before a process finishes..
Message-Id: <35A93084.44860AA7@nwark.com>

Steve,
Try using something like:

$| = 1;

print "Content-type: text/plain", "\n\n";
print "Forking processes!", "\n";

if ($pid = fork) {

print <<text_stuff;

This is the parent

text_stuff

}

else {
        close (STDOUT);
        # This is the child sending out the mail

        exit(0);
}

exit(0);


I think your problem has to do with the buffering of the output.  Good Luck!

Al Ruth
aar@nwark.com

Steve Swantz wrote:

> I'm using a web form to mail a message to a list of subscribers. Right
> now, I'm trying fork(). One process writes the page, then sends one
> e-mail, while the other process takes on the big mailing. The problem -
> the page will not appear until both processes are done, even though an
> e-mail sent following the printing of the HTML arrives pronto. IOW, mail
> sent after the page is printed arrives long before the page appears.
>
> This iteration has the parent writing the HTML while not waiting for the
> child. Same results if the child writes the page and the parent waits
> properly to do the mailing - still no page visible till the mailing is
> done.
>
> So..what do you do to get your HTML page to appear pronto after launching
> a lenghty process? Why does the page not appear until all processes are
> done, even if it was printed first? FWIW, our web server is Apache on a
> Sun box...
>
> TIA,
>
> Steve Swantz
> max_eper@hotmail.com
> -------------
>
> if (!defined ($kidpid = fork()) ) {  # undef - fork failure
>
>    &CgiDie ("Fork Failed");
>
> } elsif ($kidpid == 0) {        # this is child process
>
>    sleep (180);  # doing this to simulate the delay of a large mailing
>    $time_sent = localtime(time);
>    &send_mail ("from\@from.org", "to\@to.org",
>                "Mailed by child", "Time is $time_sent");
>    exit;
>
> } else {                # neither 0 or undef, so this is the parent
>
>    # waitpid ( $kidpid, 0);  what happens if we don't wait? - no change...
>
>    $time = localtime(time);
>    print &PrintHeader;
>    print &HtmlTop;
>    print "Name is $name<BR>This is the parent process at $time";
>    print &HtmlBot;
>
>    &send_mail ("from\@from.org", "to\@to.org",
>                "Mailed by parent", "Time is $time");  #this shows up
> before the page!
>
> }





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

Date: 12 Jul 1998 13:06:46 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting Yesterday's Date
Message-Id: <6oacd6$d0f$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, chip@pobox.com (Chip Salzenberg) writes:
:According to tchrist@mox.perl.com (Tom Christiansen):
:>In comp.lang.perl.misc, allbery@kf8nh.apk.net writes:
:>:Technically, though, he's correct:  what about leap seconds?  :-) :-)
:>Leap seconds are ignored.
:Without your saying who ignores them, you're not saying much.

  ``It is inappropriate to require that a time represented as seconds
    since the Epoch precisely represent the number of seconds between
    the referenced time and the Epoch.''

	       IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Perl's time() function returns the number of seconds that have passed
since the epoch--more or less.  29 seconds less as of this writing,
actually, if you want to be to be precise.  It turns out that POSIX
requires that time() not include leap seconds, a peculiar practice of
adjusting the world's clock by a second here and there to account for
vicissitudes of the Earth's orbital wobble.  See the sci.astro FAQ,
section 3, in

    http://astrosun.tn.cornell.edu/students/lazio/sci.astro.3.FAQ 

--tom
-- 
There's going to be no serious problem after this.  --Ken Thompson


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

Date: Sun, 12 Jul 1998 21:25:45 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: kill 0 always true?  How test pid?
Message-Id: <Ew03Ix.780@news.boeing.com>

In article <35A53006.B899DC6B@alum.mit.edu>,
Larry P. Rosen <lrosen@alum.mit.edu> wrote:
> ...
>for it.  By the way, I could just do a waitpid(), as
>long as it is non-blocking, to test if the child is
>running.  Now I need to know if waitpid() is non-blocking
>on our platforms (irix 6.2, irix 6.4, Solaris, Linux) and
>what the flag is that I use.  If not, I can modify my code
>to do a grandchild instead.  Thanks.
>

This should work:

use POSIX ":sys_wait_h";
my $pid = fork();
 ...
$SIG{CHLD}  = sub { 1 until waipid($pid, WNOHANG) > 0 };



HTH,
--
Charles DeRykus


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

Date: Sun, 12 Jul 1998 21:37:28 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Lenght of string and array problem...
Message-Id: <35a90a96.15214060@news.btinternet.com>

On 12 Jul 1998 17:59:16 +0200, Ondrej Sury wrote :

>
>1.  How do I find out length of string in Perl?
>
How does the length builtin grab you ?  I am sure you could look in
the perlfunc document for more.

>2.  Array @mages is filled with numbers.  But after I use this
>code each number in array rewritten by value of $mg_found{$_}.
>I use similar code on other place and it doesn't behave like
>this.  What is the problem?
>
>    foreach (@mages) {
>        $_ = $mg_found{$_};
>        @_ = split //;
>        for ($a = 0; $a < 10; $a++) {
>            $max{$a} = $_[$a] if ($max{$a} < $_[$a]);
>        }
>    }
>
Thats what happen when you use foreach():  from the perlsyn manpage:

                                                         If LIST is
    an actual array (as opposed to an expression returning a list
    value), you can modify each element of the array by modifying
    VAR inside the loop. That's because the `foreach' loop index
    variable is an implicit alias for each item in the list that
    you're looping over.

You will probably want to use another variable rather aassigning to $_
(or indeed @_ here ).  You have no real need to do this except in the
implicit 'split' but that doesnt really pose a problem.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 12 Jul 1998 01:58:48 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: module installation problem
Message-Id: <6o9mr8$32v@fohnix.metronet.com>

madcow99@my-dejanews.com writes:
) I've been trying to install the TK package and the Data dumper package into
) the merged activeware version.

I'm not sure that is permitted by the license:

    3.  You may apply bug fixes, [...] derived from ActiveState. [...]

Seems to imply that you can't modify it otherwise.  So maybe
they're just enforcing their license??

Only half joking,
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Sun, 12 Jul 1998 14:59:29 +0800
From: Albert Lo <albertlo@netvigator.com>
Subject: online Perl reference
Message-Id: <35A85ED0.450C99EE@netvigator.com>

where is online Perl5 reference?

Albert Lo



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

Date: 12 Jul 1998 13:17:39 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: online Perl reference
Message-Id: <6oad1j$d0f$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Albert Lo <albertlo@netvigator.com> writes:
:where is online Perl5 reference?

% man perl
-- 
You have to admit that it's difficult to misplace the Perl sources.  :-)
		--Larry Wall in <1992Aug26.184221.29627@netlabs.com>


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

Date: Sun, 12 Jul 1998 21:37:24 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: online Perl reference
Message-Id: <35a8f9dd.10945234@news.btinternet.com>

On 12 Jul 1998 13:17:39 GMT, Tom Christiansen wrote :

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, Albert Lo <albertlo@netvigator.com> writes:
>:where is online Perl5 reference?
>
>% man perl
>-- 
>You have to admit that it's difficult to misplace the Perl sources.  :-)
>		--Larry Wall in <1992Aug26.184221.29627@netlabs.com>

Alternatively to you:

C:\> perldoc perl

However you might check my sig. if you dont have Perl installed
locally

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 21:37:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Openin files
Message-Id: <35a912de.17183890@news.btinternet.com>

On Fri, 10 Jul 1998 23:30:10 +0200, Guillermo Garcis wrote :

>Can i open a file that is in other server?
>
>
What server, how open ?

On NT you can do :

open(NTSHARE,"\\\\server\\share\\somedirectory\\file") || die "blah";

(It seems that the backslashes are necessary in my experience.)

this should work with other NT servers shared Win95/3.11 resources
Novell volumes (given a Novell client on your NT machine) and Unix
machines (with Samba).  You could also use
Win32::NetResource::AddConnection to map a drive letter to a network
resource.

On Unix there are various ways of mounting volumes on another server
for your use (NFS,Samba,NCP etc) these may be available to you.

You might mean another *web* server and for this purpose you can use
the libwww-perl (LWP) package of modules available from CPAN.

This is not an exhaustive list of ways to "open" a file from a nother
server.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 06:21:28 GMT
From: dwiesel@my-dejanews.com
Subject: page is not showing until perl program is finished
Message-Id: <6o9kl7$8r0$1@nnrp1.dejanews.com>

Hi,

Does anyone know how I can make some of my page show up for the user although
the program is not finished?

The first thing I do is printing out a header, then there are lots of
calculations. The header doesn't show until all of the calculations (and the
whole program) is done...

Is there any special trick? I've noticed that when you search for a article on
Dejanews (www.dejanews.com) they show a header before the search result...

Thank you

// Daniel

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 12 Jul 1998 21:37:21 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: page is not showing until perl program is finished
Message-Id: <35a8f418.9468301@news.btinternet.com>

On Sun, 12 Jul 1998 06:21:28 GMT, dwiesel@my-dejanews.com wrote :

>Hi,
>
>Does anyone know how I can make some of my page show up for the user although
>the program is not finished?
>
Check out the perlvar document about $| (AKA $OUTPUT_AUTOFLUSH) to see
how you might achieve this.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 13:01:52 +0800
From: Austin Schutz <spamsux-tex@habit.com>
To: Tim Maher <tim.maher@halcyon.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35A84340.7B79@habit.com>

Tim Maher wrote:
> 
> I've got my Perl Beautifier running, with a reasonable set
> of default options, on
> http://www.consultix.wa.com/yumpy/cgi-pvt/pbeaut.cgi.
> 
> It's been tested primarily with the 66 modules of the standard
> Perl distribution, so I'm interested to see what happens when
> it's confronted with other programming styles.
> 
	Well, for the short sub I tested it on it only changed
a couple of lines that looked like
	foreach $scalar(@array) {

to      foreach $scalar(@array) 
	{   


	Which I guess implies that my code isn't that ugly to start off
with (yeah, sure ;').  One thing I am a pretty staunch supporter of
is using spaces rather than tabs to indent code. Even moderately complex
programs will use up half your line with indents if you use tabs. My
suggestion (of course, it's what I do) is to indent with two spaces.
Code blocks are still easily recognizable but it is much more compact.
	Also, it seems to have trouble recognizing the difference
between curly braces used for hashes and curly braces used for 
indicating code blocks.

    foreach $handle(@{${*$self}{exp_Listen_Group}}) {

	turns in to

                    foreach $handle(@
                                            {
                                            $
                                            {
                                            *$self
                                            }
                                            {
                                            exp_Listen_Group
                                            }
                                            }
                )
                {

	BTW, from the results page you can't (using Nav 3.0 for Solaris)
use the back button to return to your code.  Maybe that's just a browser
thing though.

	Austin


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

Date: 12 Jul 1998 21:06:45 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ob8h5$d8t$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Christiansen 
<tchrist@mox.perl.com>],
who wrote in article <6ob6ql$rd8$1@csnews.cs.colorado.edu>:
> :CPerl works on Perl code.  What is at this URL is not Perl.
> 
> Yeah, right.  My Perl compiler works find on it, and so does yours.

Which proves nothing.  It is not Perl4, since it uses isn't_programmer
without leading &, and is not Perl5 since it uses isn::t_programmer
without ::.  Thus it is not Perl.

> :P.S.  CPerl does beautification interactively.  On this file it finds
> :many false positives due to obvious bugs in RE.  Thanks for this hint.
> 
> I have plenty of others where that came from.

Adding RE for \&subr, -t STDOUT, $| and <<FOO makes the ratio of
false-positives to true-positives quite good (except for places junked
by the above non-Perlian code).

Ilya


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

Date: 12 Jul 1998 20:37:41 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ob6ql$rd8$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:CPerl works on Perl code.  What is at this URL is not Perl.

Yeah, right.  My Perl compiler works find on it, and so does yours.
You can play with the program at 

    http://mox.perl.com/cgi-bin/MxScreen

:P.S.  CPerl does beautification interactively.  On this file it finds
:many false positives due to obvious bugs in RE.  Thanks for this hint.

I have plenty of others where that came from.

--tom
-- 
    "Nowadays people just don't distinguish between prudence and paranoia."
    	--Larry Wall


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

Date: 12 Jul 1998 21:13:16 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ob8tc$76g$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:Which proves nothing.  It is not Perl4, since it uses isn't_programmer
:without leading &, and is not Perl5 since it uses isn::t_programmer
:without ::.  Thus it is not Perl.

That's not the way things work.  Your logic is utterly wrong.

:Adding RE for \&subr, -t STDOUT, $| and <<FOO makes the ratio of
:false-positives to true-positives quite good (except for places junked
:by the above non-Perlian code).

Ilya, that's perfectly acceptable code.  You can't define it out
of existence.  It runs just fine.  And it doesn't even generate
warnings with -w.  It's Perl.  Cope.  

--tom
-- 
    stab_val(stab)->str_nok = 1;    /* what a wonderful hack! */
        --Larry Wall in stab.c from the perl source code


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

Date: 12 Jul 1998 04:21:54 GMT
From: "jim babbington" <jwb79@mail.idt.net>
Subject: Re: Perl CGI under NT4.0 problem
Message-Id: <01bdad4b$8caa10b0$6488fdc7@dixon>

Terry,

In addition to bbell's resonse,

I use NSES 3 and my "file not found" error was due to a partial perl
install- go to explorer and make sure that .pl is associated with
c:\perl\bin\perl.

Explorer->view->options>filetypes> .pl had better be there.

NSES is will run perl, but it is very perl-unfreindly(and so is NT):With
any NSES cgi, start your script with:

$| = 1; # flush STDOUT after \n, God only knows what NT will do with it.
print "content-type <whatever";

BTW, STDERR does not go to the log, that would make too much sense,
instead, they piggy back it to STDOUT.

Also, NT will run your script using the cd of c:\perl\bin (where it found
the exe).
Also,also, make sure NT is at the current service level, B4 calling
Netscape, or they'll just tell you to do that, send you complimentary
patches, charge you $195USD and hang up.(personal experience).

Cross your fingers,

Jim


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

Date: Sat, 11 Jul 1998 11:31:46 -0400
From: Jorge Kinoshita <jkinoshi@pcs.usp.br>
Subject: Perl debugging in emacs - possible?
Message-Id: <35A78562.ABD9AB1E@pcs.usp.br>

Hello,
    I am using 'perl -d' in order to debug Perl scripts and it works
very fine, but
    there must be some much more interactive way for debugging.
    For instance: I am seeing the source code, click in some line as a
breakpoint and the program runs till there, etc. as it is done in turbo
C.
    I think that emacs is a very good platafform to deal with such
stuff.
   Is there any debugger interface in emacs or anything that resembles
it?
    if not, it is time to create it.
    Thanks in advance.
    Jorge




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

Date: Sun, 12 Jul 1998 07:27:44 GMT
From: stlam@yahoo.com
Subject: perl IDE and compiler
Message-Id: <6o9ohf$d2m$1@nnrp1.dejanews.com>

Hi all,
Is there any Perl IDE for win32/unix?
Is there any Perl compiler for win32/unix?
regards,
Stlam

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 12 Jul 1998 04:55:26 GMT
From: "Greg Bramlett" <gbramlett@mediaone.net>
Subject: Re: Perl to populate Access 97 database
Message-Id: <2lXp1.2226$s5.8991029@news2.naplesfl.net>


Try using the Win32::ODBC module, you can get it at www.roth.net/odbc/ (I'm
assuming you are using Perl for Win32)

    Greg Bramlett

Edward Villalovoz <edwardv@jps.net> wrote in message
35a81bcd.0@blushng.jps.net...
>Does anyone know if you can write to an Access 97 database directly from
>perl?  If so how.  Thanks.
>
>
>




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

Date: 12 Jul 1998 04:35:53 GMT
From: "jim babbington" <jwb79@mail.idt.net>
Subject: Re: Perl to write data to Access database
Message-Id: <01bdad4d$8155e8e0$6488fdc7@dixon>



Edward Villalovoz <edwardv@jps.net> wrote in article
<35a81142.0@blushng.jps.net>...
: 
: Does anyone know if you can write to an Access 97 database directly from
: perl?  If so how.  Thanks.
: 

Check out http://www.access.digex.net/~jurlwin/

Good luck,

Jim


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

Date: Sun, 12 Jul 1998 21:37:26 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: PING / Traceroute Perl Script
Message-Id: <35a8fea2.12165667@news.btinternet.com>

On Sat, 11 Jul 1998 18:02:16 -0700, Jesse Rosenberger wrote :

>I am trying to get a Ping and a Traceroute Perl Script  to work so that
>they will output the information as they are recieved (ie nph-file.pl).
>Has anyone done this?  So far this is what I have, and this is only for
>the Ping Script:
>
>$fqdn = $ENV{'QUERY_STRING'};
>$ping_cmd = "/sbin/ping";
>$num_times = 4;
>@result = `$ping_cmd -c$num_times $fqdn`;
>
>print "Content-type: text/html\n\n";
>print "Ping Results For <b>$fqdn</b>:<br>";
>print "<br>\n";
>print "@result";
>exit;
>
>but it prints it all out in one block instead of line-by-line, like the
>normal ping output looks, and it also waits till all the pinging is done
>before it outputs.   Can anyone help me with this?
>

I will assume that what you know what you are you doing with your
QUERY_STRING and that nph-<blah> thing as these are really CGI things.
However, given all that, you could do something like this to achieve
your aims:

$fqdn = $ENV{'QUERY_STRING'};
# Assume that this above is correct
$ping_cmd = "/sbin/ping";
$num_times = 4;
open(PING ,"$ping_cmd -c$num_times $fqdn |") || die "no ping -$!";
#The usual caveats as to die in CGI apply to the above.

$| = 1;
#Set autoflush

# You probably need to output some other stuff here for nph
print "Content-type: text/html\n\n";
print "Ping Results For <b>$fqdn</b>:<br>";
print "<br>\n";
while(<PING>)
{
   print $_,"<br>\n";
}

close(PING) || die "$?";

Anyhow World Cup Final looms see ya later

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 13:29:45 GMT
From: graemeaustin@my-dejanews.com
Subject: Re: Problems creating files
Message-Id: <6oado9$6do$1@nnrp1.dejanews.com>

In article <35a63d46.0@news.arrakis.es>,
  "Guillermo Garcis" <ggarces@arrakis.es> wrote:
> I can4t create files putting:    open NEW, "+>$PAGE" or die "Error
> opening$PAGE\n$!";
> i don4t know if the name is too long or i have to give permissions.
> I tried too: open NEW, ">$PAGE" or die "Error opening $PAGE\n$!"; but it
> don4t works....
> When i try to create files appears the next error: Permission denied
> What i have to do?
> Thanks.
>

A common mistake is to not have the permissions set correctly on the
*directory* containing the file to be created. Depending on what you are
ultimately trying to do (and what operating system you are running under),
this may well be chmod 0666 which gives total read and write settings for any
file created in that directory.

hope that helps
Graeme
PS BTW check out the perl FAQ pages in CPAN

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 12 Jul 1998 21:37:18 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Putting CPAN on a CD:  good or not good?
Message-Id: <35a8f005.8467842@news.btinternet.com>

On Sat, 11 Jul 1998 01:14:06 GMT, Randal Schwartz wrote :

>>>>>> "brian" == brian d foy <comdog@computerdog.com> writes:
>
>brian> In article <6o5rgv$bam@news1.panix.com>, dha@panix.com (David Adler) posted:
>>> -- 
>>> David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
>>> Free Randal Schwartz!  <http://www.rahul.net/jeffrey/ovs/>
>
>brian> Randal is free!  Rejoice!
>
>Not free.  Just sensibly priced.
>
Hey, Excellent now I can have one for the office and one at home ;-}
>:-)
>
>Seriously though, "not going to jail" is a long way from "no longer a
>felon".  That's another two years in the making <sigh, crossing
>fingers>.
>
I reckon a quick bit of self re-invention here might serve well here -
"Who was that masked hacker"

/J\
Rained off from the Carnival Float.
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 14:23:50 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: Putting CPAN on a CD: good or not good?
Message-Id: <VA.000000c6.0139c024@enterprise>

> It seems to me that the journal (I understand it is "PC MAGAZIN")
> for which the author is preparing a one-time special issue about
> Perl, is the one you can find at any kiosk everywhere in Germany.

In the light of this, putting CPAN on the CD is a good idea. Sure, it'll be 
outdated before the CD sees shelves. But it will still bring home the 
important point: "see, the Perl community has made reuse a reality".

Personally I gave permission to include my modest module; I appreciated that 
Jurgen took the time to ask for a permission he already had anyway (my stuff 
is under Artistic License) and to explain what he was doing; and as a native 
French speaker I appreciate that we can all communicate and share ideas in 
English, our lingua franca, but then this works only as long as someone's 
technical expertise is not measured by her/his command of English.

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/



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

Date: Sun, 12 Jul 1998 14:13:06 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: PUZZLE: make hat, take ham
Message-Id: <35a8bd6b.3560458@news.tornado.be>

[newsgroup post; cc sent to author]

Tom Christiansen wrote:

>In other words, you have to
>exchange the first letter of the first word with the last letter of
>the last word.  For example: "make hat" and "take ham" are one set of
>such pairs.
>
>Now, find all such matching pairs in the list, and do this in better than
>exponential time.  The goal is to run this over a large /usr/dict/words.

For each word, strip off the beginletter. Construct the set of
beginletters for this stripped word. Linear. A bitfield, one bit for
each possible letter, seems like the most efficient way to store it
(26<32). 

Do the same for the endletters. Linear.

Now, overlay, for all stripped down words, the beginletters of one with
the endletters of the other word. Only letters common in both sets are
possible candidates. For this, the bitfields come in handy: binary AND
is enough. Quadratic.

Example:

	{ 
	    my $i = 0;
	    %bit = map { $_ => 1<<$i++ } ('a'..'z');
	}	

	$begin{'ake'} |= $bit{'t'};	# take
	$begin{'ake'} |= $bit{'m'};	# make
	$begin{'ake'} |= $bit{'s'};	# sake
	$begin{'ake'} |= $bit{'f'};	# fake
	$end{'ha'} |= $bit{'t'};	# hat
	$end{'ha'} |= $bit{'m'};	# ham
	$end{'ha'} |= $bit{'s'};	# has

	$common = $begin{'ake'} & $end {'ha'};
	# Result: 't', 'm' and 's'

Any combination of those is "valid": ex. "take hat", "take ham", "take
has", ....

Of course, you'll end up with some strange "sentences". :-)

But I get only O(N**2)?
	Bart.


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

Date: Sun, 12 Jul 1998 21:37:35 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: sending mail from within perl
Message-Id: <35a92027.20549969@news.btinternet.com>

On Fri, 10 Jul 1998 12:25:18 GMT, Bob L. wrote :

>Hi:
>
>I'm running Perl under windows 95.  I want to send mail from a script but do
>not have a mail server running.  I am connected 24/7 and wonder if I can use
>my mail host (smtp.gte.net) to send the mail for me?
>

This is a subject that gets people quite excited on this group quite
often.  You might want to search DejaNews on the subject.  You might
see perlfaq9 for an example that will work on Windo3e as well.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 21:37:33 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Weirdness in trying to extract year from localtime
Message-Id: <35a91aa6.19140868@news.btinternet.com>

On Fri, 10 Jul 1998 17:22:11 -0700, Allen Choy wrote :

>Don't I get into a Y2K problem if I add 1900?
>
What is all this problem with 2048 anyway ;?

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 12 Jul 1998 21:37:23 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Where can I find GD.pm
Message-Id: <35a8f853.10550982@news.btinternet.com>

On Sun, 12 Jul 1998 13:11:49 +0100, Geoff Wilkins wrote :

>I'm looking urgently for Lincoln Stein's Perl graphics module, GD.pm.
>All the links I've come across are to
>
>        www-genome.wi.mit.edu/ftp/pub/software/WWW/GD.html
>
>but this gives the message
>
>        "File Not Found: Our server is in the middle of maintenance..."
>
There are mirrors of CPAN at sunsite.doc.ic.ac.uk (Imperial college)
and unix.hensa.ac.uk (Higher Education National Software Archive at
Canterbury).  I have a suspicion that Demon might also mirror it.
Most perl modules wil be available from these sources.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 12 Jul 1998 02:25:17 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: xs generates call to XFree
Message-Id: <6o9oct$89r@fohnix.metronet.com>

andrewa@unixg.ubc.ca (Graue) writes:
) I have some c code that requires a  pointer to an unsigned long.
) The C code alters the value that is pointed to, and so I want to
) be able to  see the altered value from Perl.  My xs file looks
) like:
) ...
) void
) translate(str, res)
) 	char * str
) 	unsigned long * res

should be

	unsigned long &res

) One of the lines in the generated .c file is the following:
) sv_setpvn(ST(1), (char *)res, sizeof(*res)), XFree((char *)res);
) 
) But from the documentation in perlguts, sv_setpvn only takes 3
) arguments.

I only count 3 above.  Recheck how the parens balance.

) Also, if I try to run make test, I get the error
) Can't load...symbol not found XFree

I've written typemap's that work alot like that but I used
alloca() because I knew I could and that avoids needing to
call free().  You can change your typemap to replace XFree()
with whatever the proper call is but it is better to just
use the "&" version and avoid having to malloc() a buffer
for the long.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 12 Jul 1998 04:06:46 GMT
From: stesch@parsec.inka.de (Stefan Scholl)
Subject: Re: y2k
Message-Id: <slrn6qgdim.1e2.stesch@parsec.inka.de>

On Thu, 9 Jul 1998 10:36:51 -0700, Michael Nguyen <ez062634@mailbox.ucdavis.edu> wrote:
> localtime() returns the year as the current year minus 1900  how will this
> affect localtime() when 2000 comes by ... whill it return 100?

Yes.


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

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

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