[11425] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5025 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 15:07:35 1999

Date: Mon, 1 Mar 99 12:01:55 -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           Mon, 1 Mar 1999     Volume: 8 Number: 5025

Today's topics:
        Howto open COM1: in dos Perl (Aart Koelewijn)
    Re: Is there a more efficient routine? <ebohlman@netcom.com>
        Linux vs. BSD Unix question <hislop@pconline.com>
    Re: Linux vs. BSD Unix question <jason.holland@dial.pipex.com>
    Re: localtime -> time <gellyfish@btinternet.com>
    Re: localtime -> time (Larry Rosler)
    Re: localtime -> time <rra@stanford.edu>
        London.pm March Meeting dave@mag-sol.com
    Re: Looking for a perl/cgi programmer who can maintain  <staffan@ngb.se>
        make an index of links to html files in a directory <seugenio@man.amis.com>
    Re: matching multiple times and remembering each match (Larry Rosler)
        MySQL and Perl Question <john@terminalreality.com>
    Re: Newbie : bash doesn't want to run my script ! (Ronald J Kimball)
    Re: Newbie Perl32 Question <gellyfish@btinternet.com>
    Re: newbie: How couuld I find my IP? <gellyfish@btinternet.com>
    Re: nmake, adding modules in Win 98 <gellyfish@btinternet.com>
    Re: nmake, adding modules in Win 98 (Martin Vorlaender)
    Re: Note Tab lite <gellyfish@btinternet.com>
    Re: Note Tab lite (Ken )
    Re: Numeric Sort <gellyfish@btinternet.com>
    Re: PC - UNIX text converter <gellyfish@btinternet.com>
        Perl REQUIRE question <john@terminalreality.com>
    Re: Q on TZ <gellyfish@btinternet.com>
    Re: read from stdin <gellyfish@btinternet.com>
    Re: read from stdin (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 1 Mar 1999 15:12:10 GMT
From: aart@mtack.xs4all.nl (Aart Koelewijn)
Subject: Howto open COM1: in dos Perl
Message-Id: <7beaoa$39j$1@mtack.xs4all.nl>

I have a Linux Perl program working on a laptop, but as this program has
to run on a number of laptops on which only DOS is installed, I have the
choice of either trying to run it in DOS-perl or to install Linux on all
these laptops. As the laptops have to be used by people without any
Linux experience, and they also have to use other DOS programs, I would
rather have this program running in DOS. The laptops will be connected
to microcontrollers and will have to write to and read from these
microcontrollers through COM1:.

The Linux code which gives the problem in DOS is:

$poort = "/dev/ttyS0";
$| = 1;
open(URS, "+>$poort") or die "Can't open $poort $!\n";
system("stty 9600 -echo raw clocal -crtscts < $poort");
$SIG{'ALRM'} = 'timeout';

As this gave problems in DOS (also when using sysopen), I tried to track
the problem down be doing seperate write and read calls:

$poort = "com1";
$| = 1;
SCHRIJVEN: for ($try = 0; $try < $maxtry; $try++) {
                open(URS, ">$poort") or die "Can't open $poort $!\n";
                foreach $elem (@opdr) {
                        syswrite (URS, $elem, 1);
                        }
                close URS;
                select(undef, undef, undef, 0.3);
                $inp_error = 0;
                $r = 0;
                open(URS, "<$poort") or die "Can't open $poort $!\n";
                alarm(5);
                eval {$r = sysread(URS, $antwoord, 20)};
                alarm(0);
                close URS;
                
                next SCHRIJVEN if ($r < 11 || $inp_error);

The problem is, as far as I can deduce, with the 
sysread(URS, $antwoord, 20);

At that point DOS gives something like:
"General failure reading from device COM1
Abort, Retry, Ignore, .."

I tried to catch this with the "eval", but that does not seem to work,
tried to set "$SIG{__BREAK__} = 'IGNORE';" but nothing seems to help. 

On com1 is the microcontroller, the writing seems to go ok, but it does
not always answer, so you have to give it a few tries. Before I put the
select call in in Linux it sometimes needed a few hundred tries before
it gave an acceptable answer. With the 0.3 in select in Linux it gives
the right answer the first time, most of the time. Changing this to
"sleep 1;"  in the Dos version does not help. 

Anything else I can try?

BTW: the Laptops are Thoshiba T1910, 486SX25, 4Mb ram. I first tried the
perl542b.zip version on one, but could not get that to work (needs a
coprocessor??), and then installed the os2 version according to the
instructions. This seems to work ok.

Aart

-- 
Aart Koelewijn                |  Linux 2.0.36
E-mail: aart@mtack.xs4all.nl  |  my newsserver kills all
http://www.xs4all.nl/~mtack/  |  Content-Type: multipart/* messages


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

Date: Mon, 1 Mar 1999 12:46:09 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is there a more efficient routine?
Message-Id: <ebohlmanF7x24x.61M@netcom.com>

Bill Chase <jaybyrd@macs.net> wrote:
:  All of the following works but is there a way of making it more efficient?
: I also need to make sure that all items are unique and sorted after being read
: back out of tempdb.txt.

:    $pg = $formdata{'pg_id'};

Am I correct in guessing that this is a CGI program?

:   #tempdb.txt is only for temporary holding
:   #til all selections have been made
:   #each tempdb.txt file must be unique for each customer

:   open(DB, ">>tempdb.txt");
:     print DB $pg;

:    open(DB, "tempdb.txt");
:      @tempdb = <DB>;
:      close (DB);

Ugh.  No attention to file locking (important if this is a CGI program) 
or error checking.  Also not very efficient.  Put

use Fcntl ':flock';

at the beginning of your code and replace the above lines with:

open(DB,"+<tempdb.txt") or die "Can't open tempdb.txt: $!";
flock(DB,LOCK_EX);
@tempdb=<DB>;
push @tempdb,$pg;
seek(DB,0,2);
print DB $pg;
close(DB);

: #this works but theres got to a more efficient way

:    foreach $page (@ tempdb) {
:      foreach $page (@page = split(/\|/, $page)){
:        foreach  $item (@item = split(/\:/,$page)){
:        }

Your repetition of variable names is confusing.

That last foreach loop is superfluous; replace it with:

@item=split(/:/,$page);

:    $title = $item[0];
:    $url = $item[1];

:   # remove commas and whitespce
:    $text = $title;
:    $text =~ s/\, / /g ;
:    $text =~ s/ / /g ;
:    $doc_title = $text;

Replace everything after the comment with:

($doc_title=$title) =~ tr/, \t\r\n//d;

:    print "$title\n";
:    print "$url\n";
:  }
: }




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

Date: Sun, 28 Feb 1999 01:26:32 -0600
From: "Krys and Rog Hislop" <hislop@pconline.com>
Subject: Linux vs. BSD Unix question
Message-Id: <7baqp9$g35$1@bell.pconline.com>

Hi all,

I have a fairly complex Perl program which runs very well on a particular
Linux machine at an ISP.  However, when I copied the program to a BSD
machine at a different ISP, it fails miserably.

The following code is a very-much simplified snippet of the problem area of
my program.  Please note that I am not looking for a one-line version of
this code that would achieve the same function, or any other such
suggestions, as this piece of code does not resemble the original code by
any means.  It is simply a very simple program which runs fine on the Linux
machine and fails on the BSD machine:

#!/usr/bin/perl

open (READFILE, "orig.bmp") || die "Can't open READFILE";
binmode (READFILE);

open (WRITEFILE, ">copy.bmp") || die "Can't open WRITEFILE";
binmode (WRITEFILE);

for ($i=1; $i<615479; $i++)
{
   sysread (READFILE, $temp, 1);
   syswrite (WRITEFILE, $temp, 1);
}

close (READFILE);
close (WRITEFILE);

exit(0);

Also, please note that I have tried various combinations of syswrite and
write along with the sysread, thinking it may be a buffering problem.

The error message I get if I execute the above snippet from the BSD machine
is "Terminated" or "Killed" -- that's all -- and it randomly occurs,
sometimes after writing 34K to the new file, sometimes after 400K, but
generally somewhere in between.  I have plenty of disk space left, on the
order of 12 MB, and I believe I am alloted a paltry 8 MB of RAM use, though
this should not be an issue here as far as I can see.

Can anyone offer any suggestions or insight so that I may make the necessary
changes to my real program, allowing it to run successfully on the BSD
server?

Thanks in advance,

Roger Hislop
in beautiful St. Paul, MN





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

Date: Sun, 28 Feb 1999 18:14:04 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Krys and Rog Hislop <hislop@pconline.com>
Subject: Re: Linux vs. BSD Unix question
Message-Id: <36D9876C.CDBF7EE4@dial.pipex.com>

Hello Roger,

 
> #!/usr/bin/perl
> 
> open (READFILE, "orig.bmp") || die "Can't open READFILE";
> binmode (READFILE);
> 
> open (WRITEFILE, ">copy.bmp") || die "Can't open WRITEFILE";
> binmode (WRITEFILE);
> 
> for ($i=1; $i<615479; $i++)
> {
>    sysread (READFILE, $temp, 1);
>    syswrite (WRITEFILE, $temp, 1);
> }
> 
> close (READFILE);
> close (WRITEFILE);
> 
> exit(0);


You probably don't need that binmode() in there, that's just for
Windows.

Other than that, why don't you try modifying the syswrite() and
sysread() to use a larger buffer, calculating the amount read/written
each time through the loop?




This is a method from one of my socket classes. Showing a buffered use
of sysread(). It may help...




sub socketRead {
	# This method reads an arbitrary number of bytes from a socket.
	# Parameters Required:
	#    object
	#    reference    Reference to scalar to store data
	#    [scalar]     Number of bytes to read (optional)
	# Returned:
	#    boolean
	# Example
	#    $object->socketRead( $scalarReference, [$bytes] );
	my $object      =
shift;                                                       # Get
object
	my $dataRef     =
shift;                                                       # Reference
to scalar
	my $bytes       =
shift;                                                       # Number of
bytes to read
	my $bytesReq    =
$bytes;                                                      # Store
bytes required
	my $socketRef   =
$object->{HANDLE};                                           # Get
socket handle reference
	my $READ_LENGTH =
1;                                                           # Constant
holds number of bytes to read
	my $minibuf     =
"";                                                          #
Minibuffer temporarily holds incoming data
	if( $object->checkSocketReady( $socketRef, 50 ) == 0 )
{                       # Return on socket read fail
		$object->debugMessage( "socketRead\tSocket Not Ready"
);                   # DEBUG
		$$dataRef = undef;
		return(0);
	}
	if( $bytes )
{                                                                 # Read
number of bytes from socket
		#$object->debugMessage( "socketRead\tREQ\t$bytes"
);                       # DEBUG
		my $success = 0;
		while( $bytes > 0 )
{                                                      # Loop until
remainder depleted
			$success   = sysread( $socketRef, $minibuf, $bytes
);                  # Attempt socket read
			$bytes     = $bytes - $success;
			$$dataRef .=
$minibuf;                                                 # Store data
		}
		#$object->debugMessage( "socketRead\tTOTAL\t" . length( $$dataRef )
);     # DEBUG
		if( length( $$dataRef ) != $bytesReq )
{                                   # Check required data received
			$$dataRef .=
undef;                                                    # Undefine
data scalar
		
return(0);                                                             #
Return on socket read error
		}
	} else
{                                                                      
# Read socket until no more data
		my $success = sysread( $socketRef, $minibuf, $READ_LENGTH
);               # Attempt socket read
		if( $success == $READ_LENGTH )
{                                           # Attempt socket read
			$$dataRef .= $minibuf;
			while( $success = sysread( $socketRef, $minibuf, $READ_LENGTH ) ) {
				if( $success == $READ_LENGTH ) {                                   #
Attempt socket read
					$$dataRef .= $minibuf;
				} else {
					#$object->debugMessage( "socketRead\t$bytes\t$success" );      #
DEBUG
					$$dataRef .= undef;                                            #
Undefine data scalar
					return(0);                                                     #
Return on socket read error
				}
			}
		} else {
			$$dataRef =
undef;                                                     # Clear data
buffer reference
			return(0);
		}
	}
	return( length( $$dataRef )
);                                                 # Return number of
bytes read
}




Any good?

Bye!

-- 
sub jasonHolland {
    my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
                 email   => 'jason.holland@dial.pipex.com' );
}


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

Date: 28 Feb 1999 17:37:41 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: localtime -> time
Message-Id: <7bbut5$cp$1@gellyfish.btinternet.com>

On Sun, 28 Feb 1999 15:46:46 GMT johan.levin@mbox300.swipnet.se wrote:
> Hi!
> 
> I'm making a perl script that parses my syslog-file.
> There are times that I want to convert to "seconds-since-1970".
> 
> There are two functions to convert from seconds-since-1970 to human-readable,
> but I haven't found an easy way to convert in the other direction.
> 
> Is there a similar builtin for this (that I can't find) or do I have to do
> it manually?
> 

There is no builtin that will do that however there is Date::Parse that
does - it is part of the TimeDate package available from CPAN.

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


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

Date: Sun, 28 Feb 1999 10:39:23 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: localtime -> time
Message-Id: <MPG.11432d2f81c673819896b3@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7bbut5$cp$1@gellyfish.btinternet.com>, on 28 Feb 1999 
17:37:41 -0000 gellyfish@btinternet.com says...
> On Sun, 28 Feb 1999 15:46:46 GMT johan.levin@mbox300.swipnet.se wrote:
 ...
> > There are two functions to convert from seconds-since-1970 to human-readable,
> > but I haven't found an easy way to convert in the other direction.
> > 
> > Is there a similar builtin for this (that I can't find) or do I have to do
> > it manually?
> 
> There is no builtin that will do that however there is Date::Parse that
> does - it is part of the TimeDate package available from CPAN.

Two problems with this solution:

1.  The file has to be located, downloaded from CPAN, unzipped, and 
installed.

2.  The package is humongous and -- presumably -- correspondingly slow 
(certainly slow to load, which would hamper most CGI applications).

Unless one needs to parse locutions such as "noon on next Tuesday", this 
package represents serious overkill.  I offered two much more manageable 
solutions.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 28 Feb 1999 11:56:55 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: localtime -> time
Message-Id: <ylzp5yjo8o.fsf@windlord.stanford.edu>

Larry Rosler <lr@hpl.hp.com> writes:
> gellyfish@btinternet.com says...

>> There is no builtin that will do that however there is Date::Parse that
>> does - it is part of the TimeDate package available from CPAN.

> 2.  The package is humongous and -- presumably -- correspondingly slow
> (certainly slow to load, which would hamper most CGI applications).

Date::Parse actually isn't too bad.

windlord:~> wc `perlwhich Date::Parse`
    308     887    6130 /usr/local/lib/perl5/site_perl/5.005/Date/Parse.pm

I think you're thinking of Date::Manip.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 01 Mar 1999 11:32:28 GMT
From: dave@mag-sol.com
Subject: London.pm March Meeting
Message-Id: <7bdtsc$7o5$1@nnrp1.dejanews.com>

Tempus just keeps on fugiting and it's already time for the next London Perl
M[ou]ngers meeting.

We'll be in Penderel's Oak on High Holborn (in the cellar bar) from about
6:15pm on Thursday 4th March.

As an added incentive, at this meeting I'll be taking orders for Perl Mongers
baseball caps.

More details about London.pm is on our web site at <http://london.pm.org>.

Dave...

p.s. A quick reminder - as far as I know, Penderel's Oak is the only regular
 .pm venue where you can buy as drink called 'Thirsty Camel'. It's not
alcoholic but, hell, you can't have everything.

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 01 Mar 1999 13:27:33 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Looking for a perl/cgi programmer who can maintain a meta search  engine
Message-Id: <36DA87B5.1E720876@ngb.se>

raj@NOSPAMnetpromote.com wrote:
 
> You're hired if the price is right and you can maintain it.

Some research said that $90 an hour would buy you 90% of the perl
programmers. I'd say 65% of them could do the job. If you're lucky, you
might even be able to get one for less.

What do you mean with maintain, what is the task, how much data, and
give us an email if you want an answer. Please don't use one-liners,
they're hard to build a budget on. I could do it for somewhere between
$10 and $50,000,000... OK?

Staffan


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

Date: 1 Mar 1999 09:17:26 GMT
From: "Sheila  Eugenio" <seugenio@man.amis.com>
Subject: make an index of links to html files in a directory
Message-Id: <01be63c4$4ad5d4a0$2bbe10ac@amipnet>

I want to create a table of links as an index to html files in my
directory. I have the ff codes but it prints out a link to 0.htm only when
I have 01845.htm in the directory as my first html file. All of the other
filenames are 5-digit. The last filenme in that directory is 15513.htm
Thanks for your assistance.

@files="$html_dir/[0-9]*.htm";

open(INDEX,">$html_dir/index.htm");
#write out a title
$date = localtime(time);
print INDEX '
<HTML>
<HEAD>
<TITLE> Status Index Page</TITLE>
</HEAD>
<BODY bgcolor="ffffff">
<center>

<H2>Last updated: Manila ' . $date . '</H2>


<p>
<table border=0 width=100%>
<tr>
';

foreach $p (sort @files) {
   if(($part)=$p=~/(\d+)/){
      $counter++;
      print INDEX "<td><a HREF=\"$part.htm\" >$part</a><br>\n";
      if ($counter %10 == 0){
         print INDEX "</tr>\n<tr>\n";
      }
   }
}

print INDEX "
</table>
</p>
</center>

<hr>

</html>
";

sub by_num {
   get_num($a) <=> get_num($b);
}

sub get_num {
   ($part)=$_[0]=~/(\d+)/;
   $part;
}                         
                         


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

Date: Sun, 28 Feb 1999 10:17:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: matching multiple times and remembering each match
Message-Id: <MPG.1143281b699956799896b2@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <slrn7ditfs.7f9.eric@plum.fruitcom.com>, on 28 Feb 1999 
16:44:06 GMT eric@fruitcom.com says...
> undef $/;
> $_ = (<>);

Superfluous parentheses (but no harm).

> if ($_ =~ s/tagA(matchedstring)tagB//g) { 
      ^^^^^^
Superfluous specification (but no harm).  Also, unless you care about 
the contents of the string after the match, the following is more 
efficient:

if (/tagA(matchedstring)tagB/g) { 

>                   push(@contents,$1);   # (<- I think the syntax is ok here)
> }
> <snip>
> print @contents;
> 
> Now, I need to accomodate thos instances when there may be more than one
> occurance of tagA(matchedstring)tagB.  Problem is that the $1 keeps getting
> reset so that only the final instance of the match is left in $1.  My
> effort above tries to stack the @contents array with all the $1 matches as
> they occu, but it seems that perl parses the file in one go with this
> construct and does not iterate like a `for' or `while' loop - the debugger
> confirms that.
> 
> Any ideas how I can (hopefully with minor surgery) remember each match.

Yes.  You said it yourself.  Your 'if' statement executes once only, and 
should pick up only the first match.  Replace 'if' by 'while'.  That's 
about as minor as surgery can get.

A more extensive surgery would replace the whole construct by this:

  @contents = /tagA(matchedstring)tagB/g; 

Much cooler, no?

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 28 Feb 1999 12:54:24 -0600
From: "John" <john@terminalreality.com>
Subject: MySQL and Perl Question
Message-Id: <7bc3ej$dpe$1@news.onramp.net>

The other day I was unable to connect to my database because there were too
many connections. The MySQL database is shared amongst several web sites. My
questions are as follows:

(1) Is there a way to see what databases or whom is taking all of the
connections?
I just want to make sure it isn't some bad code of mine out there that is
leaving a connection open?

(2) Is the MySQL connection open until you execute a disconnect Perl or does
it close after the script ends without a disconnect? If a disconnect is not
issued does it timeout after a certain period of inactivity?

(3) Is there a list of possible errors that can be returned? I used to work
with DB2 for example and a -911 was a timeout. Is there a list of error
return codes for MySQL? I capture the error in Error: $DBH->errstr
I assume that returns a string description of the error. Is there a way to
get a numeric error number so that I can act on the error?

My system is a LINUX box running Apache and Perl 5 with MySQL and the DBI
Perl module.

If you reply to this message to the newsgroup could you please also email me
at john@terminalreality.com

Thanks for any help provided!

John




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

Date: Sun, 28 Feb 1999 15:27:09 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie : bash doesn't want to run my script !
Message-Id: <1dnxzm2.1d9bfp21klx2m8N@bay1-187.quincy.ziplink.net>

Tad McClellan <tadmc@metronet.com> wrote:

> Matthew O. Persico (mpersico@erols.com) wrote:
> : I bet your current directory is not in the PATH. Don't add it to the
> : PATH. Simply execute ths script as
> 
> : ../script
> 
> 
>    But, since he said he is using a shebang line, the path matters
>    not at all.

The shebang line matters not at all if the file to be executed can't be
found in the path.


~> cat > tmp
#!/usr/local/bin/perl

print "Hello world.\n";
~> chmod +x tmp
~> tmp
tmp: Command not found.
~> ./tmp
Hello world.
~> echo $PATH
/sbin:/usr/sbin:/usr/bsd:/usr/bin:/usr/bin/X11:/usr/local/bin:/usr/etc


-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
          perl -le 'print "Just another \u$^X hacker"'


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

Date: 28 Feb 1999 20:29:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Newbie Perl32 Question
Message-Id: <7bc8uh$nm$1@gellyfish.btinternet.com>

On Fri, 26 Feb 1999 23:34:17 -0500 Joe M wrote:
> I just installed Perl32 on windows98 and PWS.
> I can get the scripts to run from command line, but the HTML examples, I'm
> not sure how to call the scriptsin the pages instead of #!/usr/local/bin
> 

Whilst frequently asked in this group this question is nonetheless nothing
to do with Perl itself.  This is a server configuration issue that would
best be asked in some group such as:

comp.infosystems.www.servers.ms-windows

Actually the question does get answered here a remarkable number of times
and a quick search of Dejanews for something like 'Script Map' should
give you the answer.

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


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

Date: 28 Feb 1999 17:31:35 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: newbie: How couuld I find my IP?
Message-Id: <7bbuhn$b0$1@gellyfish.btinternet.com>

On Sat, 27 Feb 1999 23:00:26 -0800 Mark Davis wrote:
> Jonathan Stowe wrote:
> 
>> BTW you can always redirect the output of some cron run program somewhere
>> else so it doesnt get mailed.
> 
> Now how would I do that? So far all of the system calls fro a perl
> script executed by cron have come up empty. Is there something I can put
> in the crontab? I have done "ifsetup >foo.txt" and system ("ifsetup
>>foo.txt"); in both cases, foo.txt is created with 0 bytes.
> 

<warning minimal Perl content>

Bear in mind that a program that is run by 'cron' is not run in the same
environment as one that is run from the command prompt - it might be that
your program is not being run at all because it is in a location that is
not in the PATH in that environment, try using a full pathname.  Also you
might want to do something like:

/usr/local/bin/ifsetup >foo.txt 2>&1

to get both STDOUT and STDERR into your file lest there is some error.

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


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

Date: 28 Feb 1999 17:58:42 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: nmake, adding modules in Win 98
Message-Id: <7bc04i$d3$1@gellyfish.btinternet.com>

In comp.lang.perl.misc tbird99@my-dejanews.com wrote:
> I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02, and
> the path is correct. I get the error, "Bad command or file name" whenever I
> try to do the nmake step for adding a module. Am I doing something wrong?
> 

You probably have some other required tool missing - I would suggest using
PPM to install the module.

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


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

Date: Sun, 28 Feb 1999 17:58:44 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: nmake, adding modules in Win 98
Message-Id: <36d975c4.524144494f47414741@radiogaga.harz.de>

tbird99@my-dejanews.com wrote:
: I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02, and
: the path is correct. I get the error, "Bad command or file name" whenever I
: try to do the nmake step for adding a module. Am I doing something wrong?

Micro$oft's excuse for a command line interpreter won't work. Get yourself
a decent one, like bash or 4dos (or whatever it's called for Win98).

cu,
  Martin
--
                        | Martin Vorlaender | VMS & WNT programmer
 VMS is today what      | work: mv@pdv-systeme.de
 Microsoft wants        |       http://www.pdv-systeme.de/users/martinv/
 Windows NT 8.0 to be!  | home: martin@radiogaga.harz.de


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

Date: 28 Feb 1999 17:08:34 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Note Tab lite
Message-Id: <7bbt6i$an$1@gellyfish.btinternet.com>

On Sun, 28 Feb 1999 03:32:20 GMT Ken wrote:
> Hello:
> 
> I've been writting some Perl using Note Tab lite, which has served me
> well for quick and dirty HTML, but I was having a devil of a time
> getting some programs to run.  I rewrote them in notepad and they all
> ran.  Anybody got any idea what's up with that!?
> 

Without an example of the way in which programs fail to run it is
difficult to make a sensible judgement.

At a guess I would suggest that your editor is inserting some extraneous
characters in your program file.

Before the usual boring off-topic thread starts over peoples prefered
editors I will point you to:

<http://reference.perl.com/query.cgi?editors>

Wherein are sources discussing the merits of various editors.

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


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

Date: Mon, 01 Mar 1999 19:30:49 GMT
From: cant_take@thespam.com (Ken )
Subject: Re: Note Tab lite
Message-Id: <36da9d31.3341282@news.tiac.net>

Jonathan Stowe <gellyfish@btinternet.com> wrote:

>On Sun, 28 Feb 1999 03:32:20 GMT Ken wrote:
>> Hello:
>> 
>> I've been writting some Perl using Note Tab lite, which has served me
>> well for quick and dirty HTML, but I was having a devil of a time
>> getting some programs to run.  I rewrote them in notepad and they all
>> ran.  Anybody got any idea what's up with that!?
>> 
>
>Without an example of the way in which programs fail to run it is
>difficult to make a sensible judgement.
>
>At a guess I would suggest that your editor is inserting some extraneous
>characters in your program file.
>
>Before the usual boring off-topic thread starts over peoples prefered
>editors I will point you to:
>
><http://reference.perl.com/query.cgi?editors>
>
>Wherein are sources discussing the merits of various editors.
>

Thanks.  By the way I was getting the 500 error message. 


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

Date: 28 Feb 1999 18:09:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Numeric Sort
Message-Id: <7bc0og$e4$1@gellyfish.btinternet.com>

On Sat, 27 Feb 1999 23:11:49 -0800 coyote38 wrote:
> I enclosed a file that will do this type of sort for your specific problem.
> 
> begin 666 test.pl
> M:68H(2 D05)'5ELP72D@(" C($EF('EO=2!D;VXG="!G970@=&AE(&9I;&5N
> M86UE(&%S(&%N(&%R9W5E;65N= T*>PT*"7!R:6YT(").86UE(&]F(&9I;&4@

That doesnt look like any Perl program I've ever seen ;-}

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


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

Date: 28 Feb 1999 18:19:01 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: PC - UNIX text converter
Message-Id: <7bc1al$eg$1@gellyfish.btinternet.com>

On Sat, 27 Feb 1999 16:15:22 GMT Fred O'Brian wrote:
> Am I missing something REALLY obvious here?
> All I need is a tool to add/remove the carrage returns in
> text files.  Surely this must already exsist! Can anybody suggest
> one? (I am using Redhat linux / Win95)
> 

I think that Redhat in common with other Linux has a utility called
'duconv' which will convert in either direction.  On almost any Intel
unix that you can think of there will be some program that will do this:
SCO has xtod for instance.

You might also want to look at the page of my fellow 'Monger Dave Cross
on this subject at:

<http://www.mag-sol.com>

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


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

Date: Sun, 28 Feb 1999 12:56:32 -0600
From: "John" <john@terminalreality.com>
Subject: Perl REQUIRE question
Message-Id: <7bc3ej$dpe$2@news.onramp.net>

How does the Perl REQUIRE function work? Is the file listed in the require
function loaded when the line that contains the REQUIRE function is reached
or as soon as the PERL file that contains the REQUIRE function is loaded?

The reason I ask is that I was wondering if I could speed up the performance
of a perl script by not having the whole script loaded at once. If I break
up the
script into commonly used and non-commonly used parts and if I only
load the parts that are in demand it might speed things up???

My system is a LINUX box running Apache and Perl 5 with MySQL and the DBI
Perl module.

If you reply to this message to the newsgroup could you please also email me
at john@terminalreality.com

Thanks for any help provided!

John




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

Date: 28 Feb 1999 18:53:26 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Q on TZ
Message-Id: <7bc3b6$lg$1@gellyfish.btinternet.com>

On Mon, 22 Feb 1999 21:37:11 -0600 Walter wrote:
> It was my understanding that the format for time zone was...
> 
>       $ENV{TZ}: EST5EDT
> 
> But my ISP Sun box says...
> 
>      $ENV{TZ}: US/Eastern
> 
> Or is ther (as usual) more than one way to do it?
> 

Yes that is a valid time zone on my system.

gellyfish@gellyfish:/usr/lib/zoneinfo > ls
Africa       Chile        GMT          Jamaica      Navajo       UCT
America      Cuba         GMT+0        Japan        PRC          US
Antarctica   EET          GMT-0        Kwajalein    PST8PDT      UTC
Arctic       EST          GMT0         Libya        Pacific      Universal
Asia         EST5EDT      Greenwich    MET          Poland       W-SU
Atlantic     Egypt        HST          MST          Portugal     WET
Australia    Eire         Hongkong     MST7MDT      ROC          Zulu
Brazil       Etc          Iceland      Mexico       ROK          iso3166.tab
CET          Europe       Indian       Mideast      Singapore    localtime
CST6CDT      Factory      Iran         NZ           SystemV      posixrules
Canada       GB           Israel       NZ-CHAT      Turkey       zone.tab
gellyfish@gellyfish:/usr/lib/zoneinfo > cd US
gellyfish@gellyfish:/usr/lib/zoneinfo/US > ls
Alaska          Central         Hawaii          Mountain        Samoa
Aleutian        East-Indiana    Indiana-Starke  Pacific
Arizona         Eastern         Michigan        Pacific-New

However this is possibly OS dependent if your sustem is not POSIX
compliant in this respect and is also not much to do with Perl despite
your couching it in terms of $ENV{TZ}

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


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

Date: 28 Feb 1999 17:44:40 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: read from stdin
Message-Id: <7bbva8$cs$1@gellyfish.btinternet.com>

On Sun, 28 Feb 1999 14:28:29 GMT Gilad Finkelstein wrote:
> simple one:
> How do i read an input line to a variable ?
> Can i open a file with open(.....) and then replace some strings in the
> file( s/// command ) so that the file is rewriten in place ?
> 

The simplest way to do inplace editing like that is to use the:

perl -pi.bak -e's/blah/wood/;' <filename>

locution.

Otherwise you will probably want to open your file, read and alter it
and write to some temporary file which when you finish you should rename
over your original file.

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


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

Date: 1 Mar 1999 19:12:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: read from stdin
Message-Id: <7beoqb$biq$1@client2.news.psi.net>

Gilad Finkelstein (finkelg@cpm.elex.co.il) wrote on MMVII September
MCMXCIII in <URL:news:Pine.HPP.3.96.990228162543.10254A-100000@tlprh12>:
&& simple one:
&& How do i read an input line to a variable ?

Did you try reading the manual?

&& Can i open a file with open(.....) and then replace some strings in the
&& file( s/// command ) so that the file is rewriten in place ?


Yes. See the perlrun manpage.



Abigail


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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