[8702] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2319 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 14 16:07:36 1998

Date: Tue, 14 Apr 98 13:01:41 -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           Tue, 14 Apr 1998     Volume: 8 Number: 2319

Today's topics:
        Perl to C translator <marcelo@msm.cl>
    Re: Perl to C translator x_bhim@hotmail.com
    Re: Perl to C translator x_bhim@hotmail.com
    Re: Perl to C translator x_bhim@hotmail.com
        Perl/CGI - stale scripts <igorv@styx.or.fedex.com>
        Problem with Website 2.0 CGI <jhermann@ricochet.net>
        question <bugking@usa.net>
        Recursive Calls in Perl ? <gcheng@corp.sgi.com>
        RFC: Adding Commands in Filehandles... <repost> (Tanstaafl)
        RFC: Adding Commands in Filehandles... (Tanstaafl)
        run script on icon <star@sonic.net>
    Re: running `ls $file` on a nt workstation in a search  <joshj@icat.com>
    Re: trying to use grep to give an exact match <Tool@box.noid>
        URGENT: Tracking down a spammer!! (Mick Knutson)
    Re: Which Win32 Perl (Jeffrey R. Drumm)
        Win32:GetFreeDiskSpaceEx <thn@ehs.dk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 13 Apr 1998 11:54:47 -0400
From: "Marcelo J. Iturbe" <marcelo@msm.cl>
Subject: Perl to C translator
Message-Id: <35323547.E94B59FA@msm.cl>

Hello,
Does any one know of a perl to c concertor?
I have a pretty long perl script which needs to be translated to C.

Thanks
Marcelo



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

Date: Tue, 14 Apr 1998 13:11:58 -0500
From: x_bhim@hotmail.com
To: "Marcelo J. Iturbe" <marcelo@msm.cl>
Subject: Re: Perl to C translator
Message-Id: <3533A6EE.63B7@hotmail.com>

Marcelo J. Iturbe wrote:
> 
> Hello,
> Does any one know of a perl to c concertor?
> I have a pretty long perl script which needs to be translated to C.
> 
> Thanks
> Marcelo
check this one -

	       http://www.perl.com/CPAN-local/modules/by-module/B/ 
and look for Compiler-a3.tar.gz


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

Date: Tue, 14 Apr 1998 12:57:44 -0500
From: x_bhim@hotmail.com
To: "Marcelo J. Iturbe" <marcelo@msm.cl>
Subject: Re: Perl to C translator
Message-Id: <3533A398.79A@hotmail.com>

Marcelo J. Iturbe wrote:
> 
> Hello,
> Does any one know of a perl to c concertor?
> I have a pretty long perl script which needs to be translated to C.
> 
> Thanks
> Marcelo
check this one -

	       http://www.perl.com/CPAN-local/modules/by-module/B/ 
and look for Compiler-a3.tar.gz


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

Date: Tue, 14 Apr 1998 12:58:47 -0500
From: x_bhim@hotmail.com
To: "Marcelo J. Iturbe" <marcelo@msm.cl>
Subject: Re: Perl to C translator
Message-Id: <3533A3D7.2B2C@hotmail.com>

Marcelo J. Iturbe wrote:
> 
> Hello,
> Does any one know of a perl to c concertor?
> I have a pretty long perl script which needs to be translated to C.
> 
> Thanks
> Marcelo
check this one -

	       http://www.perl.com/CPAN-local/modules/by-module/B/ 
and look for Compiler-a3.tar.gz


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

Date: Tue, 14 Apr 1998 12:32:38 -0500
From: Igor Vulfson <igorv@styx.or.fedex.com>
Subject: Perl/CGI - stale scripts
Message-Id: <35339DB6.3B4756E8@styx.or.fedex.com>

I have a problem with a Perl/CGI script:

It seems that if there are many users hitting the same script
at the same time (it takes about 2 seconds for the script to run),
there are processes being left running even after the script
completes.  I tried enabling and disabling output buffering ($|)
but it seems to have little or no affect.

Is there a way to have a perl script timeout and exit if it's been
running for more than N seconds?  Is there a reason why this CGI
script would be left running?

Note: I had encountered this problem before, only then the reason
the script was being left running was that the output buffering was
disabled ($| = 42;) and the connection was timing out after 4 minutes
(yes, I had an infinite loop), at which point the client got a server
timeout error, and there was a process id left running on server.
Now, as I said, it takes 2 seconds for the script to run...

Please advise!

Igor Vulfson
--
mailto:ivulfson@fedex.com
http://codeflux.com/

Senior Scientific Programmer
Ops Research & Spatial Apps
Federal Express Corporation


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

Date: Tue, 14 Apr 1998 11:35:20 -0700
From: "Jeremy Hermann" <jhermann@ricochet.net>
Subject: Problem with Website 2.0 CGI
Message-Id: <6h0a9k$mcp$1@usenet53.supernews.com>

I am using WebSite 2.0

I can run perl scripts without problems from the default cgi-shl directory
(C:\WebSite\cgi-shl).  I set up another Standard CGI mapping in the Server
Properties dialog box, but when I try to run scripts from there, I get an
error:

500 Server Error
The server encountered an error and was unable to complete your request.
Message: CGI output from D:/My Documents/Medicineman/Earl/cgi-shl/test.cgi
contained no blank line separating header and data (most likely a broken CGI
program)



The corresponding record in the server.log is:


SpawnWait("C:\Program Files\Perl\bin\Perl.exe D:\My
Documents\Medicineman\Earl\cgi-shl\test.cgi ", "D:\My
Documents\Medicineman\Earl\cgi-shl", ...)
  ...exited with status 2
CGI /Earl/test.cgi execution time = 0 00:00:00.060
Script output needs header parse.

Any ideas?

thanks,

Jeremy Hermann

jhermann@ricochet.net




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

Date: Wed, 15 Apr 1998 01:49:10 +0800
From: "Bug" <bugking@usa.net>
Subject: question
Message-Id: <3533a307.0@ruby.hknet.com>

can i print a html to the user.
then after a while print a new ones.(delete the old ones)
i don't know how?




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

Date: Tue, 14 Apr 1998 11:00:07 -0700
From: Grace Cheng <gcheng@corp.sgi.com>
Subject: Recursive Calls in Perl ?
Message-Id: <3533A427.41C6@corp.sgi.com>

Hi,

Is it possible to do 'recursion' in Perl ?

The manul says the "Subroutines may be called recursively"
but I couldn't seem to get it to work. 

Thanks!

-- 
Grace
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	Grace Cheng                        gcheng@corp.sgi.com
	Application Services            Silicon Graphics Inc.		
	(415) 933-7085                     Moutain View, CA 94039
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


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

Date: Tue, 14 Apr 1998 16:16:06 GMT
From: Tanstaafl@geocities.com (Tanstaafl)
Subject: RFC: Adding Commands in Filehandles... <repost>
Message-Id: <35338a9e.62396@news.xs4all.nl>


	I'm currently reading the book on Perl 5 and I'm learning it
from scratch, so please forgive my ignorance. I've copied and run many
scripts that were in the book, but I wanted to see if I could create
something from scratch. This is my first attempt, please correct any
mistakes. I don't understand what's going wrong...

The idea:
	Basically I wanted to write a standard script I could add to
any program that I created that would handle any commands I used. To
this purpose and because I haven't gotten very far in the book I'm
trying it with file handles. (IOW, with $#ARGV.)

	I was so busy revising the code for posting I missed my own
mistake in the code. Here's the revised code, it still doesn't work.

The code:

#! /usr/local/bin/perl
# by David Dune

if ($#ARGV < 1)
        {
        print << "end_tag";
        # Checks for at least one filehandle

end_tag
        exit (1);
        }

        # Now it should call the correct sub-routine to handle the
        # command.

if ($ARGV[0] =3D "?")
        {
        print "Query -?";
        # etc...
        }
else
        {
        if ($ARGV[0] =3D "s")
                {
                open ($ARGV[1])
                        {
                        print "...actual sub-routine...(s)";
                        }
                }
        elsif ($ARGV[0] =3D "r")
                {
                open << ($ARGV[1])
                        {
                        print "...actual sub-routine...(r)";
                        }
                }
                else
                {
                print "by David Dune";
                exit 0;
                }
        }
blaze your trail!
--
David Dune

=46orgive my questions, I'm a newbie.
Unsolicited commercial email read for $500 per message.


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

Date: Tue, 14 Apr 1998 15:55:11 GMT
From: Tanstaafl@geocities.com (Tanstaafl)
Subject: RFC: Adding Commands in Filehandles...
Message-Id: <35337cba.434897@news.xs4all.nl>


	I'm currently reading the book on Perl 5 and I'm learning it
from scratch, so please forgive my ignorance. I've copied and run many
scripts that were in the book, but I wanted to see if I could create
something from scratch. This is my first attempt, please correct any
mistakes. I don't understand what's going wrong...

The idea:
	Basically I wanted to write a standard script I could add to
any program that I created that would handle any commands I used. To
this purpose and because I haven't gotten very far in the book I'm
trying it with file handles. (IOW, with $#ARGV.)

The code:

#! /usr/local/bin/perl
# by David Dune

if ($#ARGV < 1)
        {
        print << "end_tag";
        # Checks for at least one filehandle

end_tag
        exit (1);
        }

        # Now it should call the correct sub-routine to handle the
        # command.

if ($ARGV[0] =3D "?")
        {
        print "Query -?";
        # etc...
        }
else
        {
        if ($ARGV[0] =3D "s")
                {
                open ($ARGV[1])
                        {
                        print "...actual sub-routine...(s)";
                        }
                }
        elsif ($ARGV[0] =3D "r")
                {
                open ($ARGV[1])
                        {
                        print "...actual sub-routine...(r)";
                        }
                }
        }
print "by David Dune";
blaze your trail!
--
David Dune

=46orgive my questions, I'm a newbie.
Unsolicited commercial email read for $500 per message.


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

Date: Mon, 13 Apr 1998 22:22:02 -0800
From: ~arthur <star@sonic.net>
Subject: run script on icon
Message-Id: <35330087.5F67@sonic.net>

Good Morning,

I am not sure where to post this--

I am on a Mac and I have a program in macperl. My program runs great but
now I want it to run when you click on an icon. I do not want the
program itself opening and then having to say run script. 

Saying "run ---," is no problem for me but I am giving the program to
kids at Los Guilucos Juvenile Hall and it should not be too dificult for
them to open.Can anyone please help!

~arthur 
star@sonic.net

"David Blacks rule"


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

Date: Tue, 14 Apr 1998 09:13:56 -0700
From: Joshua Jarman <joshj@icat.com>
Subject: Re: running `ls $file` on a nt workstation in a search script pro blem?
Message-Id: <35338B44.6E070397@icat.com>

I had this same problem with this exact script.  I rewrote it from scratch
and it has some major improvments...unfortunatly searching every file on
every search is horriably slow and places unnecessary load on the
server....NT servers have enough trouble as it is =(

A TIP for those out there dealing with this problem:

#get all HTML files bellow a base dir with their full path, including sub
dir.
#no need to parse dirs anymore =) and note that a dir named whatever.htm
won't be included.
#many people make that mistake...
#remove the *.htm to get all files...

`cd c:\inetpub\wwwroot`;
@files = `dir /s /b /a-d *.htm`;

-josh

tony Hitchinson wrote:

> ls does not work under NT. as NT command language is Dos based try using
> dir instead this
> I have this problem quite alot as I switch between Unix and NT so I have
> written a batch file in NT called LS that simple say dir in it and I
> have written a shell script in Unix call dir. This way I never get it
> wrong
>
> Tony Hitchinson
> It's can't rain all the time
> > -----Original Message-----
> > From: Iqbal [SMTP:um@say.what]
> > Posted At:    Wednesday, April 08, 1998 4:08 PM
> > Posted To:    misc
> > Conversation: running `ls $file` on a nt workstation in a search
> > script problem?
> > Subject:      Re: running `ls $file` on a nt workstation in a search
> > script problem?
> >
> > tim pickup wrote:
> > >
> > > I have to implement a standard search script on a nt workstation and
> > > am
> > > using  a version of Matts search script. The script runs ok but
> > > returns no
> > > hits. The problem is that no files are gathered to search through.
> > >
> > > the relevent bits of code are
> > >
> > > ....
> > > $basedir = "C:/inetpub/wwwroot/pages/";
> > > @files = ('*.htm','*/*.htm');
> > > ....
> > >
> > > sub get_files {
> > >         chdir($basedir);
> > >         foreach $file (@files) {
> > >                 $ls = `ls $file`;
> > >                 @ls = split(/\s+/,$ls);
> > >                 foreach $temp_file (@ls) {
> > >                         print $temp_file;
> > > #===============this prints out nothing on execution==========
> > >                                 if (-d $file) {
> > >                                 $filename = "$file$temp_file";
> > >                                 if (-T $filename) {
> > >                                 push(@FILES,$filename);
> > >                                 }
> > >                         }
> > >                         elsif (-T $temp_file) {
> > >                                 push(@FILES,$temp_file);
> > >                         }
> > >                 }
> > >         }
> > > }
> > >
> > > the key line is                 $ls = `ls $file`;
> > > What exactly does this line do. I figure it is saying something like
> > > get a
> > > list of all files that are of the type <*/*.htm> for example.
> > > If so then it isn't getting hold of any files.
> > >
> > > Have tried several variations on the $basedir but i don't think this
> > > is the
> > > problem.
> > > Have run the script fine on other servers. This leads me to believe
> > > that it
> > > isn't the code at fault, but rather the implementation of this file
> > > gathering technique on the nt workstation.
> > >
> > > The perl interpreter is version 5.004.. downloaded from perl.com
> > >
> > > Thanks
> > >
> > > tim
> >
> > Not sure, but does ls even work on NT, write a quick one liner, or try
> > it from the command line, but I dont think it gives directory listing.
> > I
> > could be completely wrong but...
> >
> > Iqbal





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

Date: Tue, 14 Apr 1998 10:04:06 -0400
From: Senor Tool <Tool@box.noid>
Subject: Re: trying to use grep to give an exact match
Message-Id: <35336CD6.96F@box.noid>

Michael Shavel wrote:

[...]
> 
> Is there an option to grep I can use for an exact match?
> 
> Is there a perl pod someone could point me to for this answer please?
> 
> $c = "cat";
> 
> @string=("cat", "dog", "alligator", "tomcat");
> 
> @cats = grep(/$c/o, @string);

I believe if you use the anchoring characters $ and ^ in your
expression, it should do the trick.  Eg. replace

@cats = grep(/$c/o, @string);

with 

@cats = grep/^$c$/o, @string);

--john soares
--moodindi@grove.ufl.edu


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

Date: Tue, 14 Apr 1998 09:11:33 -0700
From: mknutson@websolution.com (Mick Knutson)
Subject: URGENT: Tracking down a spammer!!
Message-Id: <MPG.f9d2a909454679c9896d0@news.greatbasin.net>

URGENT: Tracking down a spammer!!

I perform a check prior to allowing anyone to use my system.
I check:

$ENV{'REMOTE_ADDR'};
$ENV{'REMOTE_HOST'};
$ENV{'REFFERRER'};

The problem is that the remote addr and remote host many times give the 
same value (I.e. 199.222.44.90 for both)

Is this an alias?
How do I identify a user correctly?
How else can I identify a user to ban them?

My script works just fine for banning users, but I really need to know 
that I can identify them correctly!

-- 

Please E-Mail directly =:)>
Thanks ...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  Mick Knutson					     ~
~  B.A.S.E. #454				     ~
~  mknutson@websolution.com			     ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  Support Legal B.A.S.E. Jumping!    		     ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  The BASE Board				     ~
~  http://www.websolution.com/base/board/index.shtml ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  Add yourself to The B.A.S.E. Mailer at:	     ~
~  http://www.websolution.com/base/mail/index.shtml  ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Tue, 14 Apr 1998 16:54:42 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Which Win32 Perl
Message-Id: <353390fd.366651346@news.mmc.org>

On Tue, 14 Apr 1998 13:31:26 GMT, rob@frii.com (Rob Greenbank) wrote:

>I noticed the other day there are now two choices (besides building it
>yourself) for Perl on the Win32 platform, both with links on the page
>"www.perl.com/latest.html".  
>
>I've read the description of the differences between "Active State"
>and "Gurusamy Sarathy's" versions.  I like the sounds of GS's, but
>before I blow away my "Active State" version I'd like to know if
>anyones had any problems with GS's.  Also, anyone had problems
>switching between the versions?
>
>Thanks,
>	Rob Greenbank
>	(rob@frii.com)

One "gotcha" that came up recently for me is that ActiveState expands file glob
characters (* and ? in the DOS/NT world) into @ARGV for you while the standard
distribution (including GSAR's) doesn't. This makes the AS port easier to use
for quickie one-liner file manipulation scripts.

That said, I personally found that GSAR's port was the more stable of the two,
and allows me to better maintain my sanity when moving scripts between Unix and
NT (all my Unix boxes are at 5.004_04, and I take advantage of some things that
were introduced in 5.004 . . . ActiveState's still at 5.003_07).

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Tue, 14 Apr 1998 19:06:33 +0200
From: "Thomas Nielsen" <thn@ehs.dk>
Subject: Win32:GetFreeDiskSpaceEx
Message-Id: <353397be.0@mnemosyne.ehs.dk>

We have a slight problem here. We use the Cisco Resource Manager, or rather
mean to, but unfortunately they have chosen to use GetDiskSpace() to
retrieve disk information and thus fail to work on disks larger than 2GB. I
have found some modules which implement other routines, such as admmisc by
David Roth but as the Cisco software is fairly comprehensive we are
reluctant to include complete libraries, so as not to introduce more points
of error than are already there, but would rather get around the problem by
using the correct API. The problem is now that GetFreeDiskSpaceEx() doesn't
seem to work. First of all I need to pack and unpack 64bit integers
(ULARGE_INTEGER) but I can't find any information as to how to come about
doing that. Secondly, I have no idea if this is the only problem as I'm
stranded already at the subject of packing. Does anyone know how to use this
API successfully with Perl? I just want the size and free space of a disk or
network drive above 7GB.

Kind regards, Thomas Nielsen
Esbjerg Handelsskole / IT Center






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

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

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