[12263] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5863 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 2 15:07:26 1999

Date: Wed, 2 Jun 99 12:00:20 -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           Wed, 2 Jun 1999     Volume: 8 Number: 5863

Today's topics:
        CGI volunteer? (BKrapf9811)
    Re: comparing 3 numeric values (Larry Rosler)
    Re: comparing 3 numeric values (I R A Aggie)
        execute perl on Windows NT via Netscape (j.k.)
    Re: FAQ 7.22: How do I create a switch or case statemen (Kevin Reid)
        I pass an array to a subroutine, but that array is brok jwmoser@aragorn.sandia.gov
    Re: I pass an array to a subroutine, but that array is  (Larry Rosler)
    Re: I pass an array to a subroutine, but that array is  <inca@incaic.engr.sgi.com>
    Re: I pass an array to a subroutine, but that array is  <tchrist@mox.perl.com>
    Re: micro$~1 perl <camerond@mail.uca.edu>
    Re: micro$~1 perl <dgris@moiraine.dimensional.com>
    Re: microso?t perl (I R A Aggie)
    Re: microso?t perl (I R A Aggie)
    Re: micros~1 perl <dgris@moiraine.dimensional.com>
        piping to Java to perl <shaykevi@ptolemy.arc.nasa.gov>
        Programmer Needed - Quick job? <mark@injection-moldings.com>
        Sboard, interesting new problem (was: ooPerl is harder  <kensai@nortel.com>
    Re: scalar question: how can you tell the difference be (Tad McClellan)
    Re: sendmail doesn't work <vision4@bigplanet.com>
        Testing for cgi-bin weakness (Danny Aldham)
        userid/password authentication on UNIX <yiywang@ca.ibm.com>
    Re: Y2K infected Perl code <swd@strata-group.Xcom>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 2 Jun 1999 18:00:20 GMT
From: bkrapf9811@aol.com (BKrapf9811)
Subject: CGI volunteer?
Message-Id: <19990602140020.07397.00000148@ng-ce1.aol.com>

I was hoping that someone out there might be looking for a CGI project?  I am
trying to get a web-based non-profit, public service organization off the
ground and I am in need of some CGI help.

In a nutshell, here's my project:

After working with a number of non-profit, public services organizations I have
realized that one of their fundamental obstacles is public awareness -- the
community just doesn't know that the specific agency exists and is there to
help.  It is for this reason that I have conceived the "Web Site Adoption
Agency" -- itself a non-profit agency (www.adopt-a-site.org).

The primary mission of the Web Site Adoption Agency is to enhance awareness of
non-profit services and activities by directing internet traffic to the web
sites of the non-profit, public service organizations.

I feel that there are many, many great organizations providing wonderful
services to the public.  The more people that know of these organizations the
better.

I think that the best way to implement the site would be through CGI scripting
-- which I lack experience in.  What I am looking for is a person or persons to
team up with me to design the CGI scripting for the site.  I don't want to get
into all the dirty details, but in general, the CGI script will collect,
organize, and display information on participants.

If working on this project is something that interests you, or if you know
someone else who may like to help, please let me know.  I am sorry to say that
there is no financial compensation for the work, only the reward of helping the
national community of non-profit agencies.  I have been working on the project
for a couple of months now -- gathering information, surveying web owners, and
non-profits.  If you would like some more information, please feel free to
contact me at brian@adopt-a-site.org or bpk@mail.com.

Thanks again,
Brian



PLEASE HELP SUPPORT VIRTUAL VOLUNTEERISM



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

Date: Wed, 2 Jun 1999 10:56:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: comparing 3 numeric values
Message-Id: <MPG.11bf101f3ad0fb9b989b58@nntp.hpl.hp.com>

In article <%hd53.407$cb5.38316@ord-read.news.verio.net> on Wed, 02 Jun 
1999 16:51:07 GMT, elvis@NOTGRACELANDclark.net 
<elvis@NOTGRACELANDclark.net> says...
> I have 3 values:
> $start = "6/15/1999" ;
> $end = "6/30/1999" ;
> $current = "6/16/1999" ; 
> 
> Ok, so that is easy to get the numeric values off those dates (month/day/year)
> 
> I want to find out if $current lies between (or on) $start and $end dates.
> 
> Is there an easy way to do this.
> 
> I am thinking...seconds from January, 1970 but I forget how to do that.

As those values are easy to split into date/time components, the most 
direct way to convert to epoch seconds is using the timelocal() function 
in the Time::Local module (which is part of the standard perl 
distribution).  Be sure to read the description of the localtime() 
function to make proper use of the arguments to timelocal().

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


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

Date: 2 Jun 1999 18:04:33 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: comparing 3 numeric values
Message-Id: <slrn7lasnr.sn.fl_aggie@thepentagon.com>

On Wed, 02 Jun 1999 16:51:07 GMT, elvis@NOTGRACELANDclark.net
<elvis@NOTGRACELANDclark.net>, in
<%hd53.407$cb5.38316@ord-read.news.verio.net> wrote:

+ Any suggestions?

You mean like 'use Time::Local;'??

James


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

Date: 2 Jun 1999 17:19:57 GMT
From: cljlk@hotmail.com (j.k.)
Subject: execute perl on Windows NT via Netscape
Message-Id: <7j3p3t$g98$1@swlmail.msd.ray.com>

Please help.  How to execute the following prgram on Netscape. I use
Windows NT4.0

Thanks in advance.


#!/perl -- -*-perl-*-


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


print "<html>\n";
print "<head>";
print "<title>Hello from ", $ENV{SERVER_NAME}, "</title>\n";
print "</head>\n";
print "<body>\n";
print "<h3>Hello from ", $ENV{SERVER_NAME}, "</h3>\n";


print "<pre>\n";
print "You're visiting from: ", $ENV{REMOTE_HOST}, "\n";
print "Your browser is:      ", $ENV{HTTP_USER_AGENT}, "\n";
print "</pre>\n";

print "<hr>\n";

print "Return to: <a href=\"http://", $ENV{SERVER_NAME}, "/\">\n";
print $ENV{SERVER_NAME}, "</a>\n";

print "</body>\n";
print "</html>\n";



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

Date: Wed, 2 Jun 1999 14:31:02 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: FAQ 7.22: How do I create a switch or case statement?
Message-Id: <1dsnuem.9detcwoylozoN@[192.168.0.1]>

Tom Christiansen <perlfaq-suggestions@perl.com> wrote:

>     A totally different approach is to create a hash of function
>     references.
> 
>         my %commands = (
>             "happy" => \&joy,
>             "sad",  => \&sullen,
>             "done"  => sub { die "See ya!" },
>             "mad"   => \&angry,
>         );
> 
>         print "How are you? ";
>         chomp($string = <STDIN>);
>         if ($commands{$string}) {
>             $commands{$string}->();
>         } else {
>             print "No such command: $string\n";
>         } 

This code can be written in a much shorter (and, IMHO, cleaner) way:

print 'How are you? ';
chomp($string = <STDIN>);
&{{
  'happy' => \&joy,
  'sad'   => \&sullen,
  'done'  => sub { die "See ya!" },
  'mad'   => \&angry,
}->{$string} || sub {print "No such command: $string\n"}};

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.
    


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

Date: Wed, 02 Jun 1999 17:56:16 GMT
From: jwmoser@aragorn.sandia.gov
Subject: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <37556e42.526737874@news.sandia.gov>


#What I'm doing is something like:


sub foo
{
    @bar = shift;
    foreach $foo (@bar){
	print "$foo\n";
    }
}

@di = (1,2,3,4);
foo(@di);

# What I expect the output to be is 
# 1
# 2
# 3
# 4

# but instead I'm getting
# 1

# My array is being broken up into @_ so that if I do
 
sub foo
{
    foreach $foo (@_){
	print "$foo\n";
    }
}

@di = (1,2,3,4);
foo(@di);

# I would get
# 1
# 2
# 3
# 4

# How can I prevent my array from being broken up into seperate
# scalars and just get the whole array out of @_ with one shift?

Thanks.


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

Date: Wed, 2 Jun 1999 11:31:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <MPG.11bf1856e97e09bd989b59@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37556e42.526737874@news.sandia.gov> on Wed, 02 Jun 1999 
17:56:16 GMT, jwmoser@aragorn.sandia.gov <jwmoser@aragorn.sandia.gov> 
says...
 ...
> # How can I prevent my array from being broken up into seperate
> # scalars and just get the whole array out of @_ with one shift?

Pass a reference to the array.

    foo(\@di);

Then inside the function,

   my @bar = @{+shift};

+shift could be written shift() if you prefer.  Just the bareword shift 
won't work.

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


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

Date: Wed, 02 Jun 1999 11:33:49 -0700
From: Edwin Salgado <inca@incaic.engr.sgi.com>
To: jwmoser@aragorn.sandia.gov
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <3755790D.C8D2280F@incaic.engr.sgi.com>

jwmoser@aragorn.sandia.gov wrote:
> 
> #What I'm doing is something like:
> 
> sub foo
> {
>     @bar = shift;
>     foreach $foo (@bar){
>         print "$foo\n";
>     }
> }
> 
> @di = (1,2,3,4);
> foo(@di);

instead of:

	@bar = shift;

do:

	@bar = @_;

By definition "shift" shifts the
first value of the array, shortening
the array by 1 and moving all remaining
valued down.


> # How can I prevent my array from being broken up into seperate
> # scalars and just get the whole array out of @_ with one shift?


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

Date: 2 Jun 1999 12:46:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <37557bf8@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, jwmoser@aragorn.sandia.gov writes:
:#What I'm doing is something like:
:sub foo
:{
:    @bar = shift;

Well, that's wrong.  Please read the perlsub(1) manpage that comes
with Perl.  Get back to the newsgroup if you still have a problem.

--tom
-- 
`Wer mit Ungeheuern kampft, mag zusehn, dass er nicht dabei zum Ungeheur wird.'
`He who fights with monsters must take care that he does not become a monster.'
				- Nietzsche


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

Date: Wed, 02 Jun 1999 13:11:19 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: micro$~1 perl
Message-Id: <375573C7.92B150C6@mail.uca.edu>

[cc'd to tc]

Tom Christiansen wrote:
> 
> [snip]
> You should go read what's on p5p about it today before you
> get too creeped out.

Might you copy/summarize what's taking place there for those of us
without access to p5p?

Thanks.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: 02 Jun 1999 12:36:06 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: micro$~1 perl
Message-Id: <m3d7zefo15.fsf@moiraine.dimensional.com>

Cameron Dorey <camerond@mail.uca.edu> writes:

> [cc'd to tc]
> 
> Tom Christiansen wrote:
> > 
> > [snip]
> > You should go read what's on p5p about it today before you
> > get too creeped out.
> 
> Might you copy/summarize what's taking place there for those of us
> without access to p5p?

Sure, here's a summary.

Most people are a little concerned that the same sort of codefork that
happened after the original win32 port will happen again.  They are
worried (IMO justifiably) that we may soon see a Winperl in addition
to real perl.

Sarathy is going to great lengths to assure everyone that so long as
he has any say in perl development (and the only person with more say
is Larry :-) any decisions he makes will be for sound technical
reasons.

Most people seem unconvinced.  Especially after considering the
amazing lack of participation in the perl community by Activestate.
With the exception of Sarathy, I don't believe that there are any
Activestate employees taking an active role in our community.

Everything is exacerbated by residual distrust left over from last
year's oneperl effort (the merging of the win32 port with real perl).
Very, very little of that development occurred in public and very
little of what was being done was visible to non-pumpkings until well
after the fact.  People are worred that that may happen again.

Finally, Sarathy said this morning that the work being done to enable
fork() on windows will actually make it available on all perl
platforms that lack the functionality.  That, at least, is a good
thing and will hopefully not be an isolated example of Activestate
work coming back to the community.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 2 Jun 1999 18:10:09 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: microso?t perl
Message-Id: <slrn7lat2c.sn.fl_aggie@thepentagon.com>

On Wed, 02 Jun 1999 15:44:50 GMT, Marcel Grunauer
<marcel.grunauer@lovely.net>, in <375550af.2554943@enews.newsguy.com>
wrote:

+ Probably. I don't know what extension to Perl they have in mind, but

>From the docs on activestate's website, fork() is one...

+ the worst-case scenario surely is that they take the Perl source,
+ modify it in some way that integrates it tightly with Windows, then
+ try to take it from there. Like with Java.

And this effects Perl how?

+ And although I write this from an NT box, I feel the dark shadows
+ looming behind me. Time to make the jump to Linux.

"Use the Linux, Luke!"

James


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

Date: 2 Jun 1999 18:21:02 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: microso?t perl
Message-Id: <slrn7latmo.sn.fl_aggie@thepentagon.com>

On Wed, 02 Jun 1999 16:02:45 GMT, Marcel Grunauer
<marcel.grunauer@lovely.net>, in <37565449.3476759@enews.newsguy.com>
wrote:

+ No one says that, but if MS releases some proprietary extensions to
+ Perl and enough people start using them you get a fragmentation just
+ like we had (have) with Java.

Again, so? We've already had that fragmentation -- v4 vs v5. It has been
a while since I've seen a v4 post, but certainly within the last 8 months.

+ (imaging people asking questions about those proprietary extensions 
+ in c.l.p.m - I know what Tom's response will be

It'll probably be along the lines of "go download the real perl at
<url:blah//:blah.blah.blah/real-perl-for-pob/>" if Microsquid goes too
far. No matter, there already questions about the Win[whatever]::
modules, and I don't answer them because I don't use them...

+ Sorry about the scaremongering.

Microsquid is the one to be worrying. They'll be doing the development
on this is going to be undergoing a lot of scrutiny by a lot of people
who don't like 'em. They would be well advised to be very cool about
doing anything too radical. Politically speaking, they don't need
a bunch o' people coming down on. Not now, any way...

James


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

Date: 02 Jun 1999 11:54:23 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: micros~1 perl
Message-Id: <m3n1yifpyo.fsf@moiraine.dimensional.com>

lr@hpl.hp.com (Larry Rosler) writes:

> In article <3755548a@cs.colorado.edu> on 2 Jun 1999 09:58:02 -0700, Tom 
> Christiansen <tchrist@mox.perl.com> says...
> 
> In article <m3lne2hcmx.fsf@moiraine.dimensional.com> on 02 Jun 1999 
> 08:59:18 -0600, Daniel Grisinger <dgris@moiraine.dimensional.com> 
> says...
> 
> > :[subject line intentionally munged to avoid my killfile :-)]
> > 
> > And mine. :-)
> 
> Keep your heads buried, guys!  The problems will go away if you ignore 
> them.

It's nice to know that my strategy will work.  :-)

> Now I know how to slip stuff past you into this newsgroup.  :-)

Nope, it won't work.  Here's the relevant excerpt from
my killfile-

  (("subject"
   ("\\b[Nn][Tt]\\b" -10000 nil R)
   ("^.*[wW][iI][nN]\\s-*\\(32\\|9[58x]?\\|[nN][tT]\\)" -10000 nil R)
   ("\\s-+m\\(icrosoft\\|s\\)\\s-+" -10000 nil r)
  ("from"
   ("lr@hpl" 15000 nil s))

Anything from you gets marked up far enough that it cancels
out the effect of any undesired terms in the subject. :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Wed, 02 Jun 1999 11:19:30 -0700
From: Alex Shaykevich <shaykevi@ptolemy.arc.nasa.gov>
Subject: piping to Java to perl
Message-Id: <375575B2.ABB7BD78@ptolemy.arc.nasa.gov>

Hi,

I'm trying to write some perl code in which a pipe is opened to a java
application and the resulting output is read back by the perl code.
Something like

open(IN,"java myapp |");
while(IN) {
    # do stuff with $_
}
close(IN);

This works with a command like 'ls', but not with Java since the IO
pipes seem to get all messed up.  BTW, I'm running on IRIX 6.3 with perl
5.004_04 and java version "3.1 (Sun 1.1.5)" and using Netscape
Fastrack Server.  Has anyone else had success do this?

Any help would be much appreciated.

Thanks.

--Alex Shaykevich
     NASA Ames Research Center



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

Date: Wed, 02 Jun 1999 11:39:02 -0700
From: Mark Bannister <mark@injection-moldings.com>
Subject: Programmer Needed - Quick job?
Message-Id: <37557A45.AEF33401@injection-moldings.com>

I have run out of time (and patience) and need a perl programer to
finish this project.
Web cgi program does file uploads and logs information-- this part is
complete more or less.
I need help on launching a daemon process to do the upload.
Should be a few easy bucks for someone who has done similiar things
before.
My web host service runs unix and perl 5.x
Contact me by email or at 800-889-7674
Mark Bannister
American Precision Products
Huntsville, AL



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

Date: Wed, 02 Jun 1999 13:37:52 -0400
From: digital kensai <kensai@nortel.com>
To: kensai@bellsouth.net
Subject: Sboard, interesting new problem (was: ooPerl is harder than it looks)
Message-Id: <37556BF0.837146DE@nortel.com>

A while ago I wrote in for some basic help (thanks!!) designing a board
and piece object model for the sliding pieces puzzle (that's what I'm
calling it, anyways).  I've got my model now, and thought to share it
(I'm also looking to extend it).

So, what I want to do with this (2-fold, really) is;
A. finish my sliding piece puzzle itself:
1. add a workspace within which getline must draw its lines (enables my
program to solve most simplified positions, rather than rare cases)
2. There is also the case (usually only once per puzzle, following the
strategy above) where there is no solution for the current piece without
moving an already positioned piece.  This contingiency is the fun part
of the code.  :)
3. add a multi-piece solution contingiency for leftmost pieces.
CLAIM: most if not all solvable positions are solvable by placing pieces
at their home squares in descending order without moving any pieces
already thusly positioned (ie, if a piece happens to be on its end
square, but it hasn't been moved yet, we can still move it for solving
the piece we are currently on).  Excepting that the last (leftmost)
piece, which must be solved within one shift of the solving move for the
piece before it.)

B. {actually not far at all from doing this }  Alter Sboard into a set
of AIboard packages, each of which contain a family of methods that
describe the dynamics of a given game (like chess, checkers, sliding
piece puzzles, etc).  [bitboards and the like will be cool to add.]  The
goal is to provide an easy interface to the board, for use with strategy
as well as user interface.


I'm feeling pretty afloat now, on this pet project  -- just wanted to
see if anyone else out there would be interested in taking up this hobby
with me  -- or could suggest good references given what I'm working on?

#--##--# sb.pl #example-case use of Sboard.pm
#!/usr/bin/perl -w

use strict;
require "Sboard.pm";


my $board = Sboard->new(4,4);
my($irow, $icol, $row, $col, $zrow, $zcol, @line);
# with my goal = ((0,1,2,3),(4,5,6,7),(8,9,10,11),(12,13,14,15));
my $population = ((15,2,1,3),(4,5,6,7),(8,9,10,11),(12,13,14,0));

$board->populate($population);


# For each piece in turn, from greatest to least ...
#0. Set the workspace for getline
#1. Find the ideal position for the piece
#2. Find the piece
#3. Draw a line between the piece's current position and the ideal
position
#4.I Move the piece along the line.
## For every step along the x-axis
## a. Draw aline between the zero-piece and the current step's position
## b. Move zero to where the piece goes next.
### Move the zero along the x-axis and y-axis of its line.
## c. Move the piece to the current step's position
#4.II Continue to move the piece along the line (other axis now

foreach (15..0){
 $board->workspace($_);

 $irow=int($_/ 4);
 $icol=$_%4;

 ($row, $col) = $board->positionof($_);

 @line = $board->getline($_, $irow, $icol);

 foreach (0..$line[0]){

  ($zrow, $zcol) = $board->getline(0, $row - $_, $col);

  $board->dirmove($zrow, "R");
  $board->dirmove($zcol, "C");

  $board->dirmove($_, "R");
 }

 foreach (0..$line[1]){
  ($zrow, $zcol) = $board->getline(0, $row - $_, $col);

  $board->dirmove($zrow, "R");
  $board->dirmove($zcol, "C");

  $board->dirmove($_, "C");
 }}



#--##--# Sboard.pm
package Sboard;

sub new { return bless map([(undef)x$_[2]],1..$_[1]), ref($_[0]) ||
shift; }

#--#Methods

# populate grants a piece at a position, iteratively through a 2d vector

 sub populate {
  my ($self, $arrayRef) = @_;
  my ($row, $col);

  foreach $row (0..$#{$self}){
   foreach $col (0..$#{$self}[$row]){
    $self->[$row][$col] = $arrayRef->[$row][$col];
   }}}


# pieceat sets a piece at a row/col (optionally), and returns the piece
at row/col
 sub pieceat {
     my($self,$row,$col,$piece)=@_;
     $self->[$row][$col]=$piece if @_==4;
     return $self->[$row][$col];
 }

# positionof sets a position to contain a given piece (optionally), and
returns the position of a
#given piece
 sub positionof {
  my($self,$piece,$row,$col)=@_;
  my($row, $col);

     if(@_ == 4){
   $self->[$row][$col] = $piece;
   return $row, $col;
  }else{
   foreach $row (0..$#{$self}){
    foreach $col (0..$#{$self}[$row]){
     return $row, $col
       if($self->[$row][$col] == $piece);
    }}}}


# teleportzero specifies row/col to swap with zero
 sub teleportzero {
  my($self,$row,$column,$altzero)=@_;
  my($zerorow, $zerocol);

  ($zerorow, $zerocol) = $self->positionof($altzero||0);

  $self->pieceat($zerorow, $zerocolumn, $self->pieceat($row, $column));
  $self->pieceat($row, $column, $altzero||0);
 }

# movezero moves zero in the specified direction across the board
 sub movezero {
  my($self,$direction,$altzero)=@_;
  my($zerorow, $zerocol, $row, $column);

  $direction = uc($direction);

  ($zerorow, $zerocol) = $self->positionof($altzero||0);

  $row = $zerorow;
  $column = $zerocol;

  if($direction =~ /U/){
   $row--;
  }elsif($direction =~ /D/){
   $row++;
  }elsif($direction =~ /L/){
   $column--;
  }elsif($direction =~ /R/){
   $column++;
  }

  $self->pieceat($zerorow, $zerocolumn, $self->pieceat($row, $column));
  $self->pieceat($row, $column, $altzero||0);
 }

#--##--# This will take some work...
#workspace defines the area available for getline
 sub workspace { push( ref(shift)->workspace, shift); }
#--##--#

# dirmove takes as input a row/col-adjusting integer and runs a movezero
rcai times in the correct
#direction

#USAGE: shifts the zero along a given line segment.  Wrap this in a line
engine and you can move
#the zero to the correct position for your next ideal move
 sub dirmove {
  my($self,$rcai,$xy,$altzero)=@_;
  my($zerorow, $zerocol, $row, $column);

  if(uc($xy) =~ 'R'){
   ($rcai > 0)? $direction = "R": $direction = "L";
  }else{
   ($rcai > 0)? $direction = "D": $direction = "U";
  }
  $direction = uc($direction);

  $rcai *= -1 if($rcai > 0);
  while($rcai-- > 0){
   ($zerorow, $zerocol) = $self->positionof($altzero||0);

   $row = $zerorow;
   $column = $zerocol;

   if($direction =~ /U/){
    $row--;
   }elsif($direction =~ /D/){
    $row++;
   }elsif($direction =~ /L/){
    $column--;
   }elsif($direction =~ /R/){
    $column++;
   }

   $self->pieceat($zerorow, $zerocolumn, $self->pieceat($row, $column));

   $self->pieceat($row, $column, $altzero||0);
  }}


# creates a sequence of points that define a line (shortest path)
between two points.  (should
#operate in a workspace)
 sub getline {
  my($self, $s, $one, $two)=@_;
  my($sr, $sc, $ir, $ic);

  ($sr, $sc) = $self->positionof($s);
  $two? ($ir, $ic) = ($one, $two): ($ir, $ic) = $self->positionof($i);

  return $ir - $sr, $ic - $sc;
 }



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

Date: Wed, 2 Jun 1999 08:52:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: scalar question: how can you tell the difference between numbers and strings?
Message-Id: <3e93j7.9u6.ln@magna.metronet.com>

John Hilgedick (jhilgedi@indiana.edu) wrote:
: I can't find the answer to this question anywhere.  Can you help?

: I have an array that contains a bunch of integers and strings.  I want to
: iterate over the array and find particular integers and strings.  If I'm
: looking for a string I have to use 'eq' - but if I'm looking for a number I
: have to use "==".  What do I do if I don't know what 'type' one of the
: arguments is?


   Perl FAQ, part 4:

      "How do I determine whether a scalar is a number/whole/integer/float?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 2 Jun 1999 12:50:02 -0600
From: "Sherry" <vision4@bigplanet.com>
Subject: Re: sendmail doesn't work
Message-Id: <928349037.26114@proxy1.bigplanet.com>

Thank you for having a look.  I think the bottom line says it all.  Do you
know of a place I can download a script that will make a Free For All Links
page with autoresponces sent back to the e-mail address of the poster?

I am quite impressed at the help I've gotten in this newsgroup.  Thank you
so much.


Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:3755515b@newsread3.dircon.co.uk...
>Sherry <vision4@bigplanet.com> wrote:
>> http://easyhomebiz.virtualave.net
>>
>> I'm having trouble with a pre-written perl script.  It functions
beautifully
>> in accepting links, collecting e-mail addresses and posting links.  It
does
>> not send an automatic e-mail after a link is posted like it should.
>>
>
><big snip>
>
>>
>> # Server path of sendmail or equivalent.
>> $mailprog = "/usr/sbin/sendmail";
>>
>
>You will almost certainly find that your sendmail is somewhere else
>you will need to confirm with your service provider but it is more
>often to be found at /usr/lib/sendmail.
>
>
>>
>>
############################################################################
>> ##
>> # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING!!!
>>
############################################################################
>>
>
>I Just loved that - lets have a little look shall we ?
>
>>
>> read (STDIN, $input, $ENV{'CONTENT_LENGTH'});
>
>Doesnt check that it got everything it should.
>
>>
>> open (FILE, "badwords.txt");
>
>Doesnt check whether the open failed or not.
>
>>
>>
>> open (FILE, "bademail.txt");
>
>Doesnt check whether the open failed or not.
>
>>
>> open (FILE, "badurls.txt");
>
>Doesnt check whether the open failed or not.
>
>>
>>
############################################################################
>> ##
>> # Make sure the user entered a valid email address format.
>>
############################################################################
>> ##
>>
>> if ($email !~
>> /^[\w\d][\w\d\,\.\-]*\@([\w\d\-]+\.)+([a-zA-Z]{3}|[a-zA-Z]{2})$/) {
>>
>
>He he he he he he he
>
>
>>
>> open(FILE,"+>>$htmlpath");
>
>Doesnt check whether the open failed or not.
>
>> open (ADNUM, "+<$CountFile");
>
>Doesnt check whether the open failed or not.
>
>>
>
>
>Ooh good dates.
>
>> @months =
>>
('January','February','March','April','May','June','July','August','Septembe
>> r','October','November','December');
>>
>> @days =
>> ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
>>
>> ($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];
>>
>
>My Word - Its that Code again ;-{
>
>> if ($sec < 10) { $sec = "0$sec"; }
>> if ($min < 10) { $min = "0$min"; }
>> if ($hour < 10) { $hour = "0$hour"; }
>> if ($mday < 10) { $mday = "0$mday"; }
>>
>
>Hmmm#
>
>** WARNING NON Y2K Compliant code below
>
>> $date = "on $days[$wday], $months[$mon] $mday, 19$year at
$hour:$min:$sec";
>                                                 ^^^^^^^
>
>Er what can I say.
>
>>
>> open (FILE,"$emaildatabase");
>
>
>Doesnt check whether the open failed or not.
>
>> open (FILE,">>$emaildatabase");
>
>Doesnt check whether the open failed or not.
>
>> open (EMAIL, "email.txt");
>
>
>Doesnt check whether the open failed or not.
>
>> @body = <EMAIL>;
>>
>> open(MAIL,"|$mailprog -t");
>>
>
>Doesnt check whether the open failed or not.
>
>> close (MAIL);
>>
>
>The close should be checked as its on a pipe.
>
>>
>> Thanks,
>>
>
>I'd send it back to where it came from.
>
>I think that "Do not edit below here ... " was rather a hostage to fortune
>under the circumstances.
>
>
>/J\
>--
>Jonathan Stowe <jns@gellyfish.com>
>




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

Date: 2 Jun 1999 18:30:56 GMT
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Testing for cgi-bin weakness
Message-Id: <7j3t90$lu7$1@hendrix.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

I have been contracted to find possible security problems in a server
running Perl cgi scripts. I would like to use LWP to toggle thru all
of their links, but am not sure how to test the scripts. If I just add
say a semicolon and then an ls command, will this give me enough to
tell if my customer is vulerable. Are there other escapes beside shell
escapes I should or can test for.



--
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Mail Lists, Web Databases, SQL & Perl


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

Date: Wed, 2 Jun 1999 14:16:03 -0400
From: "Yi Wang" <yiywang@ca.ibm.com>
Subject: userid/password authentication on UNIX
Message-Id: <375575e8@news1.us.ibm.net>

Hi,

I am new to Perl but need perl to do userid/password
authentication for UNIX system.(I think this is an old question) Now I have
two questions:

1. how to pass parameters to a perl program from the
command line, like this?
            perl myProgram.perl par1 par2
2. how to directly capture a return value of a program within the perl
script (etc. keep it in a variable), I know by using system function, we can
run a system program.

    @args = ("myProgram", "arg1", "arg2");
    system(@args)

But how to assign its return value to a variable, can we use "$?"

I will appreciate if anyone can help.

Yi





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

Date: Wed, 02 Jun 1999 11:59:44 -0500
From: Steve Dover <swd@strata-group.Xcom>
Subject: Re: Y2K infected Perl code
Message-Id: <37556300.B649A100@strata-group.Xcom>

Abigail wrote:
> 
> Eric Bohlman (ebohlman@netcom.com) wrote on MMC September MCMXCIII in
> <URL:news:ebohlmanFCo3xF.5HI@netcom.com>:
> ??
> ?? Theorem: for every language L and any correct program P in L which takes N
> ?? lines of code, there exists an incorrect program PP in L which takes NN
> ?? lines of code, NN<=N, and NN<N for N>1.
> ??
> ?? Proof: Let P be a correct N-line program in L accomplishing some task T, and
> ?? assume WLOG that N is the minimum number of lines in which such a program
> ?? can be encoded.  Transform P to PP by the following rules:
> ??
> ?? 1) If N>1, delete an arbitrarily-chosen line from P.
> ?? 2) If N=1, delete an arbitrarily-chosen syntactically-significant
> ?? character from P.
> ??
> ?? By the assumption, PP cannot be a correct program.
> 
> You're assuming empty programs aren't correct. That's incorrect for some
> languages L.
>
Good point.  Plus, empty programs can not have any Y2k problems.
Or can they?  Perhaps more accurately, empty programs will not
need to be corrected for Y2k problems.

-- 
Are you ready for year MM?
The Mother of all Messes.
212 Days to go before 'Ignorance is bliss' is obsolete.
news:comp.software.year-2000  Come for the signal, stay for the noise.


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

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

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