[19051] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1246 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 4 18:07:44 2001

Date: Wed, 4 Jul 2001 15:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <994284310-v10-i1246@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 4 Jul 2001     Volume: 10 Number: 1246

Today's topics:
        can't build perl 5.6.1 under Win98 <andrex@zzapp.org>
    Re: changing hash dynamically <ub98aa@brocku.ca>
        Chmod and File::Find (Tad M) (BUCK NAKED1)
    Re: clean up array from "holes"... <godzilla@stomp.stomp.tokyo>
    Re: clean up array from "holes"... <godzilla@stomp.stomp.tokyo>
    Re: clean up array from "holes"... <godzilla@stomp.stomp.tokyo>
        Date Subtraction Routine <david.mohorn@home.com>
        Debugging on the "Panic: mapstart" Error <rogerhsu2001@yahoo.com>
    Re: FAQ 9.26:   How can I do RPC in Perl? (Tramm Hudson)
    Re: flash and perl <bart.lateur@skynet.be>
        How to encrypt password for .htpasswd???? <fergonza@terra.com.pe>
    Re: How to timeout a socket recv under win32? <magilfix@us.ibm.com>
        how to use pod::html and pod::text <santiago@computer.org>
    Re: how to use pod::html and pod::text (E.Chang)
    Re: Net::Telnet logging on problem..... <danielperez@mediaone.net>
        Passing Variables to a Javascript from a Perl CGI scrip <mrdeza@phys.ucalgary.ca>
        Perl 5.00503 vs. 5.00554 - what's the difference? (Paul Laub)
    Re: Perl server (Randal L. Schwartz)
    Re: PHP <bwalton@rochester.rr.com>
        Request Advice for Proper Case of String <jc_va@spamisnotcool.hotmail.com>
        Script permissions problem. <mlaw@talk21.comNOSPAM>
        Text based menuing system in Perl with submenus??? <david.mohorn@home.com>
    Re: To Mac OS hackers! <bart.lateur@skynet.be>
    Re: two changes (Anno Siegel)
    Re: two changes <pne-news-20010704@newton.digitalspace.net>
    Re: Vapo-Rub (Tim Hammerquist)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Jul 2001 10:59:02 -0400
From: "Andrew E. Schulman" <andrex@zzapp.org>
Subject: can't build perl 5.6.1 under Win98
Message-Id: <3B432F36.D50F43FB@zzapp.org>

I've downloaded the perl 5.6.1 source and am trying to compile it under
Win98, using MSVC 5.3 SP3 with either bash or command.com as my command
interpreter.  I am blocked at every turn.

First I tried using nmake.  I read README.win32 and checked and adjusted my
win32/Makefile.  Despite much effort, it seems that nmake fails because the
Makefile includes && and || commands such as

       cd .. && miniperl configpm

and

	$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
	    || $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)

which command.com is far too stupid to comprehend.  Unfortunately with
nmake, I can't tell it to call bash as the shell; I'm stuck with
command.com.  So nmake fails.

Next I tried the DOS port of GNU make.  This is hopeless, since the
commands in Makefile aren't even indented with tabs, and who knows what
other problems would await if I tried to correct that.

Next I tried dmake.  I set SHELL=c:/fsf/bin/bash.exe -, which seems to
work.  But the makefile.mk is loaded with the path separator \, while of
course bash wants /.  I could go through makefile.mk by hand and carefully
change all of the path separators, but at this point I'm reluctant to do it
without some indication that I might succeed.

Has anyone else successfully built perl 5.6.1 under Win98?  Which version
of make did you use, and how much did you have to hack the makefiles to get
it to work?

I'm frustrated to be told "just build it from source, it's already ported
to win32" and then have the build process so persistently fail.  Any help
would be much appreciated.

Andrew.


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

Date: Wed, 04 Jul 2001 17:00:50 -0400
From: Umair Tariq Bajwa <ub98aa@brocku.ca>
Subject: Re: changing hash dynamically
Message-Id: <3B438401.E132EA@brocku.ca>


--------------C18761809A891E374AABF50C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

How can i print the values if i am using autovivification? I have an @info
and at each index i have reference to hash? I am trying to do it but it
won't work? Need some help

Umair


Philip Newton wrote:

> On Wed, 04 Jul 2001 12:36:28 -0400, Umair Tariq Bajwa <ub98aa@brocku.ca>
> wrote:
>
> > I am trying to store information in seperate hashes and I would like to
> > change the name of the hash within the for loop. Like that.
>
> You can do that, but it's generally considered not a good idea. Whenever
> you have variables names with "counting numbers" in them, you probably
> want another data structure instead. In this case, you might want an
> array of hashes instead, since your indexes appear to be small
> non-negative numbers.
>
> > my (%info1,%info2,%info3,%info4);
> >
> > $counter = 0;
> >
> > foreach $parameter (@paramlist)
> > {
> >    if ($parameter =~ m/employee_id$counter/)
> >    {
> >        $counter   = $counter + 1;
> >        $value     =  param($parameter);
> >        $info$counter{$parameter} = $value;
> >    }
> >    else
> >   {
> >        $value     =  param($parameter);
> >        $info$counter{$parameter} = $value;
> >    }
> > }
>
>     my(@info);
>
>     my $counter = 0;
>
>     foreach my $parameter (@paramlist)
>     {
>         if ($parameter =~ /employee_id$counter/)
>         {
>             $counter++;
>         }
>
>         $info[$counter]{$parameter} = param($parameter);
>     }
>
> > does anyone know how can i change the hash within the for loop.
>
> Yes, but I'm not telling. (It's called "symbolic references".) Use
> proper references instead (as the above example does, transparently,
> through the autovivification of @info's elements into hashrefs).
>
> Cheers,
> Philip
> --
> Philip Newton <nospam.newton@gmx.li>
> That really is my address; no need to remove anything to reply.
> If you're not part of the solution, you're part of the precipitate.

--
Favorite Quotes:
===============
"The box said 'Windows 95 or better', so I installed Linux"
                                                          -- Unknown
"A computer without Windows is like a chocolate cake without mustard."
                                                           -- Unknown



--------------C18761809A891E374AABF50C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
How can i print the values if i am using autovivification? I have an @info
and at each index i have reference to hash? I am trying to do it but it
won't work? Need some help
<p>Umair
<br>&nbsp;
<p>Philip Newton wrote:
<blockquote TYPE=CITE>On Wed, 04 Jul 2001 12:36:28 -0400, Umair Tariq Bajwa
&lt;ub98aa@brocku.ca>
<br>wrote:
<p>> I am trying to store information in seperate hashes and I would like
to
<br>> change the name of the hash within the for loop. Like that.
<p>You can do that, but it's generally considered not a good idea. Whenever
<br>you have variables names with "counting numbers" in them, you probably
<br>want another data structure instead. In this case, you might want an
<br>array of hashes instead, since your indexes appear to be small
<br>non-negative numbers.
<p>> my (%info1,%info2,%info3,%info4);
<br>>
<br>> $counter = 0;
<br>>
<br>> foreach $parameter (@paramlist)
<br>> {
<br>>&nbsp;&nbsp;&nbsp; if ($parameter =~ m/employee_id$counter/)
<br>>&nbsp;&nbsp;&nbsp; {
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $counter&nbsp;&nbsp; =
$counter + 1;
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $value&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; param($parameter);
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $info$counter{$parameter}
= $value;
<br>>&nbsp;&nbsp;&nbsp; }
<br>>&nbsp;&nbsp;&nbsp; else
<br>>&nbsp;&nbsp; {
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $value&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; param($parameter);
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $info$counter{$parameter}
= $value;
<br>>&nbsp;&nbsp;&nbsp; }
<br>> }
<p>&nbsp;&nbsp;&nbsp; my(@info);
<p>&nbsp;&nbsp;&nbsp; my $counter = 0;
<p>&nbsp;&nbsp;&nbsp; foreach my $parameter (@paramlist)
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($parameter =~ /employee_id$counter/)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$counter++;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $info[$counter]{$parameter}
= param($parameter);
<br>&nbsp;&nbsp;&nbsp; }
<p>> does anyone know how can i change the hash within the for loop.
<p>Yes, but I'm not telling. (It's called "symbolic references".) Use
<br>proper references instead (as the above example does, transparently,
<br>through the autovivification of @info's elements into hashrefs).
<p>Cheers,
<br>Philip
<br>--
<br>Philip Newton &lt;nospam.newton@gmx.li>
<br>That really is my address; no need to remove anything to reply.
<br>If you're not part of the solution, you're part of the precipitate.</blockquote>

<pre>--&nbsp;
Favorite Quotes:&nbsp;
===============
"The box said 'Windows 95 or better', so I installed Linux"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Unknown
"A computer without Windows is like a chocolate cake without mustard."
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Unknown</pre>
&nbsp;</html>

--------------C18761809A891E374AABF50C--



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

Date: Wed, 4 Jul 2001 16:10:37 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Chmod and File::Find (Tad M)
Message-Id: <22466-3B43864D-452@storefull-246.iap.bryant.webtv.net>

Thanks alot for your suggestions. I'm still not sure what "return" does.
Anyway, how'd I do?

use File::Find;

# Delete illegal characters and spaces in filename in $tmpdir

find sub {
-f or return; 
my $new = s/\`| |\~|\'|\"|\^|\#|\@|\$|\+|\=|\,//g; 
rename $_, $new or print "Could not delete illegal chars: $!<BR>\n";
  }, 
$tmpdir ; 


# Change all .exe files in $tmpdir to .exe.txt and chmod to 644

find sub { 
-f or return; 
if ( (my $new = $_) =~ s/\.exe$/\.exe\.txt/ig )  { 
rename $_, $new or print "Could not rename file to exe.txt: $!<BR>\n"; 
chmod 0644, $new or print "Could not chmod $_: $!<BR>\n";
}  
 }, $tmpdir ; 


# chmod all files in $tmpdir to 644

find sub {
-f or return;  
chmod 0644, $_ or print "Could not chmod $_: $!<BR>\n";
  }, $tmpdir ;


Hope everyone's having a great 4th!
--Dennis



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

Date: Wed, 04 Jul 2001 12:58:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: clean up array from "holes"...
Message-Id: <3B43754C.A0D9E068@stomp.stomp.tokyo>

Alexvalara wrote:
 
> Is it possible to get rid off "holes" in an array...

Those "holes" are referred to as null elements
and a host of other geeky terms of endearment.


> for example: i have something that looks like
> ($ref1,$ref2,"",$ref3,"",$ref4,"","")

> and i want to transform it into
> ($ref1,$ref2,$ref3,$ref4).


Piece of cake. This method I exemplify works very nice
for small to small-medium size arrays. I would suggest
a different method for large arrays. You will note, for
a brief period of time, an original array will double
in size using this simple method below my signature.

For large arrays, it would be more logical to simply
push non-null elements into a new array. However,
would not you then have two large arrays for a period
of time?  I would say, 

"Half a dozen of one, a Baker's Dozen of the other."

Imaginative use of shift will turn these large fattening
half dozens into a small delicious cream puff;
push it in, shift it out.


* her butt gains ten pounds with just the thought *


Annoyingly, women tend not to shift out as much
as we push in.


Godzilla!
--

TEST SCRIPT:
____________


#!perl

print "Content-type: text/plain\n\n";

@Array = ("Godzilla", "", "Rocks", "And", "", "Rolls", "", "!", "", "0", "¿", "0");

$element_count = $#Array;

for ($iterate = 0; $iterate <= $element_count; $iterate++)
 {
  if ($Array[$iterate] ne "")
   { push (@Array, $Array[$iterate]); }
 }

for ($iterate = 0; $iterate <= $element_count; $iterate++)
 { shift (@Array); }

print "@Array";

exit;


PRINTED RESULTS:
________________

Godzilla Rocks And Rolls ! 0 ¿ 0


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

Date: Wed, 04 Jul 2001 13:06:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: clean up array from "holes"...
Message-Id: <3B43772C.B9EEE650@stomp.stomp.tokyo>

Anno Siegel wrote:
 
> Uri Guttman wrote:
> > Tom Melly wrote:

> >   TM> @array = ("", "hello", "", "goodbye");
> >   TM> foreach(@array){
> >   TM>   push @array2, $_ if $_;
> >   TM> }
> >   TM> @array = @array2;

> > that is what grep is for:

> > @array = grep $_, @array ;
 
> That fails to convey "0".


All three of you have it wrong.
Both methods fail to recognize
a numerical value of zero.

Godzilla!


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

Date: Wed, 04 Jul 2001 13:56:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: clean up array from "holes"...
Message-Id: <3B4382E1.5FFD649B@stomp.stomp.tokyo>

Godzilla! wrote:
 
> Alexvalara wrote:

(dietary snippage)
 
> > Is it possible to get rid off "holes" in an array....
 
> Those "holes" are referred to as null elements
> and a host of other geeky terms of endearment.
 
 
> Piece of cake. This method I exemplify works very nice
> for small to small-medium size arrays. I would suggest
> a different method for large arrays....

 
> For large arrays, it would be more logical to simply
> push non-null elements into a new array. However,
> would not you then have two large arrays for a period
> of time?  I would say,
 
> "Half a dozen of one, a Baker's Dozen of the other."
 
> Imaginative use of shift will turn these large fattening
> half dozens into a small delicious cream puff;
> push it in, shift it out.
 

I hear a Sissified Geek whimpering "Aunt" over and over...

These Sissified Geeks know to cry "Aunt" rather than "Uncle"
simply because I cannot be an uncle, nor an aunt, actually,
although some Sissified Geeks claim me to be a pissant.

You boys just don't know how to turn your fat beer bloated
arrays into tasty little champagne cream puffs, like mine.

This method might be of interest to those whom have such
difficulty dealing with disproportionately large arrays;
an intellectual dietary method.


Godzilla!  Queen Of The Shifty.
--

TEST SCRIPT:
____________


#!perl

print "Content-type: text/plain\n\n";

@Array = ("Godzilla", "", "Rocks", "And", "", "Rolls", "", "!", "", "0", "¿", "0");

$element_count = $#Array;

for ($iterate = 0; $iterate <= $element_count; $iterate++)
 {
  $non_null = shift (@Array);
  if ($non_null ne "")
   { push (@Array, $non_null); }
 }

print "@Array";

exit;


PRINTED RESULTS:
________________

Godzilla Rocks And Rolls ! 0 ¿ 0


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

Date: Wed, 04 Jul 2001 21:35:49 GMT
From: "David Mohorn" <david.mohorn@home.com>
Subject: Date Subtraction Routine
Message-Id: <V_L07.147009$qc.17443925@news1.rdc1.va.home.com>

I need a way to calculate a previous date from a start date.  For example,
if I want to get the date 7 days for today, I need something like "Today -
7" and it will give me the date a week ago.  Of course, I need the date in
MM/DD/YYYY format.

Anyone know an efficient way of doing this?  Do I need a perl module or is
there an easy way to do this...??

Thanks!










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

Date: Wed, 04 Jul 2001 21:24:34 GMT
From: Roger Hsu <rogerhsu2001@yahoo.com>
Subject: Debugging on the "Panic: mapstart" Error
Message-Id: <3B4389C5.95E6E09F@yahoo.com>

Hi all,

Has anyone seen this type of error:
    panic: mapstart at /usr/local/lib/perl5/5.6.1/Tk/Widget.pm line 1106

Perl 5.6.1 + Tk800.022 + Solaris 7 is the environment I used.

The codes around line 1106 of Widget.pm are:
    sub Scrolled
{
 my ($parent,$kind,%args) = @_;
 # Find args that are Frame create time args
 my @args = Tk::Frame->CreateArgs($parent,\%args);
 my $name = delete $args{'Name'};
 push(@args,'Name' => $name) if (defined $name);
 my $cw = $parent->Frame(@args);
 @args = ();
 # Now remove any args that Frame can handle
***** next line is 1106 *******
 foreach my $k ('-scrollbars',map($_->[0],$cw->configure))
  {
   push(@args,$k,delete($args{$k})) if (exists $args{$k})
  }
 # Anything else must be for target widget - pass at widget create time
 my $w  = $cw->$kind(%args);
 # Now re-set %args to be ones Frame can handle
 %args = @args;
 $cw->ConfigSpecs('-scrollbars' =>
['METHOD','scrollbars','Scrollbars','se'],
                  '-background' => [$w,'background','Background'],
                  '-foreground' => [$w,'foreground','Foreground'],
                 );
 $cw->AddScrollbars($w);
 $cw->Default("\L$kind" => $w);
 $cw->Delegates('bind' => $w, 'bindtags' => $w, 'menu' => $w);
 $cw->ConfigDefault(\%args);
 $cw->configure(%args);
 return $cw;
}

Can anyone give me pointers of documents that can teach me how
to debug this type of error.

Thanks,

-roger




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

Date: 4 Jul 2001 14:02:53 GMT
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: FAQ 9.26:   How can I do RPC in Perl?
Message-Id: <9hv7md$11q$1@sloth.swcp.com>

In article <5PD07.349$T3.194419200@news.frii.net>,
PerlFAQ Server  <faq@denver.pm.org> wrote:
>  How can I do RPC in Perl?

And in article <xxy07.344$T3.193812480@news.frii.net>,
PerlFAQ Server  <faq@denver.pm.org> wrote:
>  How can I do RPC in Perl?

So which is it?  Question 9.25 or 9.26?

Tramm
-- 
  o   hudson@swcp.com                  hudson@turbolabs.com   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.323.38.81   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.986.60.75   \ \/\_\  
  0                                                            U \_  | 


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

Date: Wed, 04 Jul 2001 20:20:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flash and perl
Message-Id: <rju6ktcnqrv5hcm1eo7rlqkk0fe8tbv2qt@4ax.com>

Deneb Pettersson wrote:

>hi there, i'm doing a perl script atm which makes up a text form given
>variables, and at some point i will also have a picture catalogue with
>pictures corresponding to the different options, so that once you have
>chosen and press enter you will get a slideshop with your options....
>this is nice, but then i jsut realised, that if it is possible to do
>this into a flash then it would be alot cooler....

	<http://2shortplanks.com/flash/>

-- 
	Bart.


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

Date: Wed, 04 Jul 2001 20:10:03 GMT
From: "Fernando Gonzalez" <fergonza@terra.com.pe>
Subject: How to encrypt password for .htpasswd????
Message-Id: <vKK07.34271$Ob.722552@news.easynews.com>

How to encrypt password for .htpasswd????

I found two scripts to encrypt passwords and write the to my .htpasswd file.
However, when I access the protected directory and fill in the username and
password, they don't seem to work. Here are the two scripts I use:
Script A.:

    sub encrypt {
        my($plain) = @_;
        my(@salt);
        @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/');
        srand(time() ^ ($$ + ($$ << 15)) );
        return crypt($plain, $salt[int(rand(@salt))] .
$salt[int(rand(@salt))]  );
    }

$encpass = &encrypt($password);

Script B:
$encpass=crypt($password, substr($password, 0, 2));

Could somebody explain me which is the correct method to encrypt a password
so it can be written down on the .htpasswd and work properly.






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

Date: Wed, 4 Jul 2001 15:59:38 -0500
From: Michael Gilfix <magilfix@us.ibm.com>
Subject: Re: How to timeout a socket recv under win32?
Message-Id: <9i000l$d4o$1@ausnews.austin.ibm.com>


        The parameters to select (in order) are: The read vector, the write vector, 
the exception vector, and the timeout. The first two are bit vectors that tell 
select which file descriptors to monitor (these are set by the vec call). The 
third argument specifies the file descriptors that will be watched for 
exceptions. The last parameter, the timeout specifies how long select should 
block before returning, provided that no input was seen.

        Basically in the example below, you can think of $rin as a set of file 
descriptors to monitor. When you first create $rin with my, the set is empty. 
Then, using vec, you add file descriptors to the set. Finally, when you want 
to poll all the file descriptors in the set, you pass them to select. The 
reason that $rout is in the line is mostly for clarity and gets assigned the 
file descriptor that changed while polling.

        Hope that helps give you a better idea. If not, check out the C man page for 
select because the perl one follows it closely (man select on any unix 
machine).

                -- Mike


On Tuesday 03 July 2001 22:02%, Horace wrote:

> Although I'm still not really clear what each paramter in select() represents
> and what they do (excpet the timeout parameter), but by following your code,
> I've got the timeout running, Thank you very much.
> 
> Horace Tang

>> if ( select ($rout = $rin, undef, undef, undef) ) {

-- 
Michael Gilfix
Extreme Blue Group - IBM (Austin)
magilfix@us.ibm.com


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

Date: Wed, 4 Jul 2001 22:15:44 +0200
From: "Santiago Alvarez" <santiago@computer.org>
Subject: how to use pod::html and pod::text
Message-Id: <9i00o2$2re7m3@news1s.iddeo2.es>

I have a perl script that I want to return depending on a parameter the pod
documentation included in the same file.

I've been searching perl documentation and sites looking for this feature
and I always see the library been used by the pod2html script.

Anyone has experience in using this module returning the documentation for
the same file?

Thanks in advance.
Santiago




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

Date: Wed, 04 Jul 2001 21:56:47 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: how to use pod::html and pod::text
Message-Id: <Xns90D4B7102638Dechangnetstormnet@207.106.93.86>

"Santiago Alvarez" <santiago@computer.org> wrote in
<9i00o2$2re7m3@news1s.iddeo2.es>: 

> I have a perl script that I want to return depending on a parameter
> the pod documentation included in the same file.
> 
> I've been searching perl documentation and sites looking for this
> feature and I always see the library been used by the pod2html
> script. 
> 
> Anyone has experience in using this module returning the
> documentation for the same file?

Here's a simple example.  It uses the Pod::Html module, which I am 
guessing is the one to which you are referring.  pod2html processes the 
POD markup in an input file and prints the results to an output file.  
In this example, the special variable $0 contains the name of the 
program being executed, so the input file is the script file.  The 
default output file for pod2html is STDOUT.  


#!/usr/bin/perl -w
use strict;
use Pod::Html;

print "Content-type: text/html\n\n"; 

if ($ENV{QUERY_STRING}) {
   my $title = 'Example of POD Documentation';
   pod2html('--header', 
           "--infile=$0",       
           "--title=$title",
           '--header' );
}
else {
   print "Hello world.  Normal script output.";
}

=pod 

A SIMPLE EXAMPLE OF POD DOCUMENTATION

=head1 Instructions

A *minimal* example script that will print either "normal" script 
output or its internal POD documentation. 

Call it with http://path_to_file/file for normal output and with 
http://path_to_file/file?nonblank_value for the pod output.

=cut


-- 
EBC


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

Date: Wed, 04 Jul 2001 19:59:14 GMT
From: "Daniel Colin Perez" <danielperez@mediaone.net>
Subject: Re: Net::Telnet logging on problem.....
Message-Id: <mAK07.476$9a4.562940@typhoon.ne.mediaone.net>

This is just what I have been looking for, others who use this package!....
I have used all the features discussed in this email, and they only
intermittantly work.  I have corresponded with the author of the code, but
he just thought it was a server side problem and didn't give much feeback.
What I am trying to figure out is how it can be the remote server with the
results I get.

 If the far end device has not returned a value for a command and I try to
do a get or getline or even use cmd with the right prompt, it times out even
after 100 seconds (while the far end is done within 1 second).  If the far
end device is ready prior to my get, it works.  Note that it is not a matter
of waiting longer for the return, the return is lost if I read early!  So if
I read in 1/2 second I never get the response, if I read in 2 seconds I get
it.  Why doesn't the response get received after a 2 second wait within the
telnet code?  Why are reads destructive?  I have tried output dump and input
dumps, but none of the diagnostics explain it, the characters are lost in
those dump files as well.  The dumps confirm that the characters are not
received by Net::Telnet yet two other telnet packages (Teraterm & Python
Telnet) get all the characters, always.  I know the code is built on sockets
and I looked at the calls, they look good.  If the socket does not have data
the select should block until there is data.  The act of waiting should not
affect the remote device.

I am using $host->cmd, but I have tried get, getline, print etc.  Note that
I my communications all work depending on the speed or sleeps between calls,
so there are no "bugs" I can find on my end.  Any thoughts on this would
help as I'm debating going directly to sockets.

"Rickey Ingrassia" <r1ckey@home.com> wrote in message
news:maI07.12100$wr.62100@news1.frmt1.sfba.home.com...
> In comp.lang.perl.misc Yasser Nabi <yasser.nabi@uk.easynet.net> wrote:
> >Hi,
>
> >Below is my test script :
>
> >#!/usr/bin/perl
>
> >use Net::Telnet ();
>
> >$host="<my host>";
>
> >$username="admin";
>
> >$passwd="<my password>";
>
> >$t = new Net::Telnet(Timeout => 10,
>
> >Dump_Log => "/tmp/dump.log",
>
> >Input_log => "/tmp/input.log",
>
> >Output_Log => "/tmp/output.log",
>
> >Port => "10001");
>
> >$t->open($host);
>
> >$t->waitfor('/login: /');
>
> >print "Recieved login prompt -- sending $username\n";
>
> >$t->print("$username");
>
> >$t->waitfor('/password: /');
>
> >print "Recieved password prompt -- sending password\n";
>
> >t->print("$passwd");
> --snip--
>
> It seems to me you're making this harder than it needs to be.  I use the
> Telnet module daily, and the following code works on 98.865% of the
devices
> I connect to. The prompt may need to be adjusted depending on the device
> you're connecting to.
>
> use Net::Telnet;
> my $host = new Net::Telnet( Host => <IP ADDRESS>,
>                             Errmode => "return",
>                             Prompt => '/[?>:#\]][ ]*$/' # generic prompt
>                           );
>
> # just use input_log not dump_log or output_log
> # input_log is human readable
> $host->input_log("/tmp/input.log");
>
> # use login not print statements
> $host->login("$username","$password");
>
> # use cmd not print, requires accurate prompt setting
> my @who = $host->cmd("who");
> $host->cmd("exit");
> $host->close;
>
> print @who."\n";
>
> --
>        ____        __
> ______/_   | ____ |  | __ ____ ___.__.
> \_  __ \   |/ ___\|  |/ // __ <   |  |
>  |  | \/   \  \___|    <\  ___/\___  |
>  |__|  |___|\___  >__|_ \\___  > ____|
> _________________\/_____\/____\/\/_____
> ---------------------------------------




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

Date: Wed, 04 Jul 2001 12:34:30 -0600
From: Jason Mrdeza <mrdeza@phys.ucalgary.ca>
Subject: Passing Variables to a Javascript from a Perl CGI script...
Message-Id: <3B4361B5.5EDEB875@phys.ucalgary.ca>

Hello, I am having some issues passing variables to a Javascript from a
Perl CGI program. What I want is to send back a set of variables to a
Javascript program which is to make appropriate alterations to an html
document according to the variables which it had been passed....

what I've tried...

-printing out the code from the Perl script as a javascipt
application... I then used the cgi program as a source for the
javascript for the html doc. The problem that arose was that I couldn't
figure out how to link to the html doc and pass it the variables instead

of going straight back to the same html doc...

-printing out plain text which stated <script> variables blah blah
blah</script> and plugged in an alert call at the beggining of the
javascript to watch out for the variables... I just couldn't get this
idea to work...

Any solution, new ideas of plain advice is kindly appreciated... thanks
for your time.





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

Date: 4 Jul 2001 12:01:22 -0700
From: paul@margalo.com (Paul Laub)
Subject: Perl 5.00503 vs. 5.00554 - what's the difference?
Message-Id: <13027756.0107041101.7804b09c@posting.google.com>

Dear all, 

I just noticed that for pretty printing data structures, 5.00554
relies on dumpvar.pl whereas 5.00503 uses Dumpvalue.pm. This is
perplexing as 5.00554 is a higher version number than 5.00503 yet
Dumpvalue.pm appears to be an updated, modularized version of the old
dumpvar.pl.

So what is going on? What am I missing?

Thanks, 
Paul


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

Date: 04 Jul 2001 11:20:15 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl server
Message-Id: <m13d8cy2sg.fsf@halfdome.holdit.com>

>>>>> "Jens-Ole" == Jens-Ole Frimann <jens-ole.frimann@thomson.dk> writes:

Jens-Ole> I have tried to use the following ( which I copied from an early posting )
Jens-Ole> It works Ok, but it won't stay up.
Jens-Ole> When it have had a couple of client connects it dies.

Jens-Ole> How can I have it running 'forever' ?

I suggest you toss that code and start by looking at HTTP::Daemon.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 04 Jul 2001 21:40:01 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: PHP
Message-Id: <3B438C18.52A338B5@rochester.rr.com>

Sebastijan Vacun wrote:
> 
> I wonder, how in PHP get n-th character from string
 ...
>  bye, sebastijan
 ...
Maybe if you checked a PHP newsgroup like alt.php you would have better
luck?
-- 
Bob Walton


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

Date: Wed, 04 Jul 2001 21:35:42 GMT
From: "Buck Turgidson" <jc_va@spamisnotcool.hotmail.com>
Subject: Request Advice for Proper Case of String
Message-Id: <O_L07.73014$Md.19914230@typhoon.southeast.rr.com>

I have some text in the format employee_rec, always with the underbar.  I am
relatively new to perl, and I see that it has a uc(), and an ucfirst() function.
What I want to do is transform that string to Employee_Rec.

I have thought about using split on the underbar and then lcfirst(), and then
rebuilding the string.  Is there a better way?  Please help this novice.

Thanks.




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

Date: Wed, 4 Jul 2001 20:40:38 +0100
From: Matt L. <mlaw@talk21.comNOSPAM>
Subject: Script permissions problem.
Message-Id: <9hvqtl$9j1$1@neptunium.btinternet.com>

Hi,

I appologise if this is old news or is off topic,but it is frustrating me 
immensley.

I have a perl CGI script that takes an image file from me and writes it to 
the images file on my linux box.  The script is failing with 'permission 
denied' in the error log.  What exactly should the images directory 
permissions be set to for this to work properly?

Many, Many thanks for any help given!

Matt L.

Here is the code:

#!/usr/bin/perl -wT
use CGI qw/:standard/;
print header,
start_html('file upload'),
$file = param('file');
open (SAVE, ">../images/$file") || die $!;
while (<$file>) {
    print SAVE $_;
}

close SAVE;
print_results();
print end_html;

sub print_results {
    if(!$file)  {
        print "No file uploaded.";
        return;
    }
    print h3('File', $file, ' Uploaded Successfully');
}


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

Date: Wed, 04 Jul 2001 21:35:03 GMT
From: "David Mohorn" <david.mohorn@home.com>
Subject: Text based menuing system in Perl with submenus???
Message-Id: <b_L07.147006$qc.17443600@news1.rdc1.va.home.com>

Does anyone have any sample code of a text base menu system in Perl that is
flexible and easy to maintain?  I could have nested menus, meaning: menu 1
could have an option to menu 2.  Menu 2 could have an option for menu 3.  As
users back out from menu 3, it should return to menu 2, then back to menu 1.

I currently do something like:

my $TRUE=1;

while($TRUE) {
   printf("MAIN MENU:\n");
   printf("01  Option 1\n");
   printf("02  Option 2\n");
   printf("03  Menu #2\n");
   printf("99  Exit\n");

   my $response = <STDIN>;

   redo  if($response eq "");

   if($response eq "01") {
      printf("You selected option 1\n");
      redo;
    }
   if($response eq "02) {
      printf("You selected option 2\n");
     redo;
   }
   if($response eq "03" {
      my $TRUE2=1;
      while($TRUE) {
         displayMenu2();
          my $response = <STDIN>;

         redo  if($response2 eq "");

        if($response2 eq "01") {
           printf("You selected option 1 from Menu 2\n");
          redo;
        }
        if($response2 eq "99") {
        $TRUE2=0;
        }
   }
   if($response eq "99") {
      $TRUE=0;
      redo;
   }
   printf("\n? Invalid option selected!\n");





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

Date: Wed, 04 Jul 2001 20:15:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: To Mac OS hackers!
Message-Id: <09u6kt09icu2cbjavt3pagls1mp5vkedk7@4ax.com>

Ann Bancroft wrote:

>I have to call some perl scripts from an application written in C
>[CodeWarrior] under Mac OS.
>How to handle this?

AppleEvents?

Try the MacPerl mailing list. Friendly people, several of those you want
to reach, do not hang around here.

	<http://lists.perl.org/showlist.cgi?name=macperl>

-- 
	Bart.


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

Date: 4 Jul 2001 18:18:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: two changes
Message-Id: <9hvmlj$59n$1@mamenchi.zrz.TU-Berlin.DE>

According to Philip Newton  <nospam.newton@gmx.li>:
> On 4 Jul 2001 15:41:54 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
> 
> > Interesting, but changing the shebang doesn't solve the OP's problem.
> 
> Why not?
> 
> > He wants people to upload CGI scripts and just run them.
> 
> It sounded as if he had control over the CGI scripts, as though they
> came from him:
> 
> : I default my CGI scripts to /usr/local/bin/perl.

 ...but the quote goes on:

: I default my CGI scripts to /usr/local/bin/perl.  For 20% of my customers,
: that path just doesn't seem to exist and they get all confused because
: Apache returns internal server error, etc.

He wants do deal with the 20% before they get confused.  "I default..."
is a way of saying, "My perl is located at...".
 
> I presume this means "I put a shebang line including
> #!/usr/local/bin/perl in my CGI scripts". So if he "defaulted his CGI
> scripts" to "#!/usr/bin/env perl" instead, they should work everywhere
> that has a perl in the $PATH, wherever they're uploaded. Unless I'm
> missing something.
> 
> > Put symlinks to your perl in every sensible and semi-sensible location
> > that crops up.  That should limit complaints quickly.
> 
> Well, sort of; on one shell account I have, /usr/bin/perl and
> /usr/local/bin/perl *both* exist, but one's the system-supplied 5.004,
> and the other is a hand-compiled 5.005_03. I'd prefer the 5.005_03 that
> the administrators compiled (since it's newer). Symlinking doesn't
> really help here, since both versions can't share the same pathname, but
> they presumably had their reason for not completely replacing the
> existing /usr/bin/perl.

Sure, you can't have both.  But then, the OP doesn't seem to have
the kind of customers you'd want to confuse with different Perl
versions both under the name of perl.  Come to think of it, I wouldn't
like to be confused by it either.

Anno


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

Date: Wed, 04 Jul 2001 20:58:38 +0200
From: Philip Newton <pne-news-20010704@newton.digitalspace.net>
Subject: Re: two changes
Message-Id: <8np6ktcghut8k35qh8bt25sp420qpgp5cj@4ax.com>

On 4 Jul 2001 18:18:27 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

> According to Philip Newton  <nospam.newton@gmx.li>:
> > On 4 Jul 2001 15:41:54 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> > Siegel) wrote:
> > 
> > > Interesting, but changing the shebang doesn't solve the OP's problem.
> > 
> > Why not?
> > 
> > > He wants people to upload CGI scripts and just run them.
> > 
> > It sounded as if he had control over the CGI scripts, as though they
> > came from him:
> > 
> > : I default my CGI scripts to /usr/local/bin/perl.
> 
> ...but the quote goes on:
> 
> : I default my CGI scripts to /usr/local/bin/perl.  For 20% of my customers,
> : that path just doesn't seem to exist and they get all confused because
> : Apache returns internal server error, etc.
> 
> He wants do deal with the 20% before they get confused.  "I default..."
> is a way of saying, "My perl is located at...".

Oh, well. I understood it as "I write CGI scripts and give them to
customers who use them on their web server. Some of those customers have
Perl installed in a different place than I anticipated when I wrote my
CGI scripts. I would like to know whether it is possible to write my CGI
scripts so that I can distribute them to my customers and they will
'just work', regardless of where their perl is located -- even if it is
in a different place than my perl." So /usr/bin/env should be able to
help him and his customers.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 04 Jul 2001 20:29:14 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Vapo-Rub
Message-Id: <slrn9k6vqv.1rv.tim@vegeta.ath.cx>

Dallas McCarthy <whitetip@iprimus.com.au> wrote:
> OK, then, RACK OFF Losers

Most people would leave a thread they're not interested in.

So I wonder, if we "racked off", would you be left bored?

-- 
-Tim Hammerquist <timmy@cpan.org>

Any emotion, if it is sincere, is involuntary.
    -- Mark Twain


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 1246
***************************************


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