[10468] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4060 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 24 10:04:45 1998

Date: Sat, 24 Oct 98 07:00:24 -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           Sat, 24 Oct 1998     Volume: 8 Number: 4060

Today's topics:
    Re: *Why* does clpm attract non-perl posts? (Cameron Laird)
    Re: *Why* does clpm attract non-perl posts? (David Alan Black)
    Re: Encrypt (clay irving)
    Re: Encrypt (Joergen W. Lang)
    Re: Execute as root (Michael J Gebis)
        File upload script <michael@purestar.com>
    Re: File upload script (David Alan Black)
    Re: File upload script (Snowhare)
    Re: File upload script <michael@purestar.com>
    Re: File upload script <michael@purestar.com>
        How do I print one of many? <poohba@io.com>
    Re: interacting with alarm <jdf@pobox.com>
    Re: Interpolated, squared? (Mark-Jason Dominus)
        Looking for current maintainer of perlvision (Don O'Connell)
        Newbie help--perl won't run as CGI <dgibbons@towergroup.com>
    Re: Perl & Y2K - booby trap code (Mark-Jason Dominus)
        Problems with plus sign in perl script <bertilow@algonet.se>
        programing fun: trees: Part... <xah@best.com>
    Re: reference to array (Michael J Gebis)
    Re: Request for Perl script that emulate Remote Shell <sutton@lynxus.com>
    Re: splitting on . <jdf@pobox.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 24 Oct 1998 05:59:58 -0500
From: claird@Starbase.NeoSoft.COM (Cameron Laird)
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <70sbve$s0d$1@Starbase.NeoSoft.COM>

In article <70pk6n$6b$1@pilot.njin.net>,
David Alan Black <dblack@pilot.njin.net> wrote:
>What I don't get is.......
>
>If someone is interested in CGI programming and/or Web administration
>and/or the vagaries of Micros**t IE, etc., why wouldn't that person
>actually WANT to participate in the appropriate newsgroups?
			.
			.
			.
Among the other reasons already cited in this
thread, it could well be because the questioner
simply doesn't have the cognitive apparatus to
distinguish Microsoft, CGI, Webwork, and Perl.
I'm convinced that many, many of the people
responsible for Perl stuff in use in the world
out there have mental images of it all as a
stew simmered up by preternatural forces, un-
analyzable to mere humans.

A natural follow-up is, "What do we do with
such people?"  I leave that to a later time.
-- 

Cameron Laird           http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com      +1 281 996 8546 FAX


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

Date: 24 Oct 1998 08:44:46 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <70si3u$8is$1@pilot.njin.net>

Hello -

"Keith G. Murphy" <keithmur@mindspring.com> writes:

>Well, when I was in my naive late 30's, instead of the mature and
>seasoned 40 I find myself at now, I also seemed to think there was some
>tight coupling between Perl and CGI.  There's something about the more
>general articles and books that are out there that must encourage folks
>to make that connection stronger than it ought to be.  Not that I can
>cite anything.

One thing is the tendency of bookstores - definitely Borders, and others
to one degree or another - to shelve all Perl books in the CGI programming
section.  I wonder whether it would be worth campaigning to get this
changed.

I bow to your age and wisdom (I won't be 40 until Feb. :-)


David Black
dblack@pilot.njin.net



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

Date: 24 Oct 1998 09:43:47 -0400
From: clay@panix.com (clay irving)
Subject: Re: Encrypt
Message-Id: <70slij$d5v@panix.com>

In <01bdfed4$79deac40$a9410781@homepc.uh.edu> "Thy Thy" <tvo5@bayou.uh.edu> writes:

>How do I encrypt a text string?  Please help.

[ probably not the answer you're looking for... ]

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc/crypt.html

[ probably the answer you're looking for... ]

http://reference.perl.com/query.cgi?security

-- 
clay irving
clay@panix.com
http://www.panix.com/~clay/


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

Date: Sat, 24 Oct 1998 15:51:51 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Encrypt
Message-Id: <1dheu2n.13pli341a8xb2aN@host003-210.seicom.net>

Thy Thy <tvo5@bayou.uh.edu> wrote:

> How do I encrypt a text string?  Please help.
> 
> TT

If it's only one-way encryption and your text string is only 8
characters long (e.g. passwords), you can use Perl's crypt() function.

Otherwise, you could use one of the Crypt::* Modules from CPAN:
http://www.perl.com/CPAN-local//modules/by-module/Crypt/

hth, Joergen
-- 
  To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
   "Everything is possible - even sometimes the impossible"
             HOELDERLIN EXPRESS - "Touch the void"


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

Date: 24 Oct 1998 02:59:06 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Execute as root
Message-Id: <70rfpq$l0a@mozo.cc.purdue.edu>

Simon Biela <biela@netdienste.de> writes:

}I am new to perl. I wrote a script which should be executed as root.
}If I execute it via telnet it works fine, but I'd like to execute it
}over a browser. How does that work?

Like suicide.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Sat, 24 Oct 1998 12:50:53 +0200
From: Michael <michael@purestar.com>
Subject: File upload script
Message-Id: <3631B10C.34F3701C@purestar.com>

Hello,

Please see perl script below, its sort of a web based mini-FTP program I
found at www.zonecoaster.com where it's distributed free. It performs
basic file upload via the browser to a specified server directory, it
works with Mac, Windows, and Unix browsers/platforms.

I found it useful in helping my less net-literate clients transfer
images or texts to a server location via the Web-based upload page, more
reliable & user-friendly than sending e-mail attachments.
See example page: http://208.211.228.120/imagetransfer.html - password:
michael (you may test by uploading a small file or image).

I'm no a perl wizard and so I'm hoping someone could help me modify the
script adding the following features:

1) Delete and rename selected files on the remote server directory, by
i.e. clicking on each file listing launching another page with the
options: delete, rename, or just view-file.
Or/and: delete, rename, view buttons or text-links next to each file
listing on the main upload page.

2) In case the user attempts to upload duplicate file names. Launch a
warning page with options, overwrite or change the name of the file that
is about to be uploaded. (This is probably a tricky one as I guess a
file cannot be renamed locally by the server script). But maybe there's
some other way, i.e. send duplicate image names to a temp directory,
where its automatically renamed adding a number to the file name, and
then moved to the target directory or something?

I have included the original perl script below, I hope with the author
Bernard Sowa's approval.

Thanks!

Michael
Michael@purestar.com


Upload.pl 2.01  --  By Bernard Sowa
--------------

Upload.pl is a script which allows for HTTP upload as implemented by 
Netscape Navigator 3.0.  It allows you to upload to any directory you 
specify rather than to a set upload directory.  Uploaded files are 
automatically chmodded 777 so that they can be manipulated by other 
means(shell access, FTP, etc).

The script uses a simple navigational tool to allow you to change
directories and have a look at what each directory contains before
uploading a file to it.

Once you have set it up, call it from your browser location
window.

Please do not redistribute this script.

Thank you.

Bernard Sowa <bernard@zonecoaster.com>


2.01    --      -set binmode (solve Win problem)
2.00    --      -added navigator
                -fixed many bugs with universality

1.10    --      -fixed problems with determining filename

1.00    --      -first release
                -allows user to choose destination directory

#!/usr/local/bin/perl

#############################################################################################
#Upload.pl 2.01 -- April 27, 1998
#
#Please do not redistribute this script.
#
#Thank you.
#
#       DISCLAIMER: I AM IN NO WAY RESPONSIBLE FOR ANY DAMAGE THIS
SCRIPT MAY CAUSE
#############################################################################################

#############################################################################################
#Configuration Section
#
#$meurl
#       URL for this script
#
#$basedir
#       You can upload to this directory and subdirectories of it.
#
#$windows
#       If you run a Windows server set this to 'yes'.  If not set to
'yes,' when the upload
#       is completed the script will chmod the uploaded file to 777. 
Windows servers do not
#       require this.
#
#@valid
#       These are the urls that are allowed to access the script.  For
example, I have set it
#       up so that only pages set up on my sites can access them.  As
long as the page is on my 
#       site, even if it's
http://www.zonecoaster.com/Scripts/upload/index.html, it has the root
#       http://www.zonecoaster.com/ in it so it can use the script.  
#
#       If you try to set up an upload form on your
site(http://www.yoursite.here/~you/)to upload 
#       to *my* site, it won't allow it because your site doesn't
contain either of the root 
#       addresses in @valid.  This prevents people from uploading to
directories you don't want
#       them to upload to unless you let them edit that part of the
from.  Because of this, I
#       suggest that if you're allowing others to upload to your site
and don't want them uploading
#       to any directory they want, you put the directory in a hidden
field as it is in the sample
#       upload form.
#
#       **Set @valid to contain the URL representing $basedir and you
should be fine.
#
#       As it's set up below, only upload forms located on my websites
can access the script.
#
#$dircommand
#       The command for "list files in this directory."  For unix
systems, the best choice
#       is "ls -l" and for windows you'll probably want to go with "dir"
unless you have
#       downloaded a windows port of "ls."
#############################################################################################

$meurl="http://www.zonecoaster.com/cgi-bin/upload.pl";
$basedir='/usr/local/www/bernard/html/guest/';
$windows = 'no';        #'yes' or 'no'
@valid = ('http://www.zonecoaster.com/');
$dircommand = 'ls -l';

#############################################################################################
#If method=get
#############################################################################################

if($ENV{'REQUEST_METHOD'} =~ /get/i)
{
        if($ENV{'QUERY_STRING'} ne "")
        {
                &get_form_data;
                $current = $formdata{'directory'};
        }
        else
        {
                $current = $basedir;
                $inbase = "yes";
        }

        print "Content-type: text/html\n\n";
        print "<html>\n";
        print "<title>Upload a File</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "<center><h2>Change Directory</h2></center>\n";
        print "<center><table border=1>\n";
        print "<tr><td><center><b>Current
Directory</b></center></td></tr>\n";
        print "<tr><td>$current</td></tr></table></center>\n";
        if($inbase eq "yes")
        {
                opendir(DIR,"$basedir") || &unable("$basedir");
        }
        else
        {
                opendir(DIR,"$formdata{'directory'}") ||
&unable("$formdata{'directory'}");
        }
        @dirs=grep(/\w/,readdir(DIR));
        close(DIR);

        foreach $item (@dirs)
        {
                if($item =~ /\w/)
                {
                        if(-d "$basedir$item")
                        {
                                push(@direct,"$basedir$item\/",$item);
                        }
                }
        }
        %direct=@direct;
        $number=@direct;
        if($number ne "0")
        {
                print "<br><br>You can change directories by selecting a
directory from the \n";
                print "drop-down list below.  Also on this page is a
listing of files in the \n";
                print "current directory.  You can upload to the current
directory using the \n";
                print "form at the bottom of this page.\n";
                print "<form method=get action=\"$meurl\">\n";
                print "<center>Change directory: \n";
                print "<select name=\"directory\">\n";
                foreach $key (sort keys(%direct))
                {
                        print "<option value=\"$key\">$direct{$key}\n";
                }
                print "</select>\n";
                print "<input type=submit value=\"Change
Directory\"></center>\n";
        }
        else
        {
                print "<br><br>Below you will find a list of files in
the \n";
                print "current directory.  If you wish to upload a file
to this directory, just \n";
                print "fill out the form at the bottom of the page and
press the button.<br>\n";
                print "<br><center><b>This directory has no
subdirectories.</b></center>\n";
        }
        print "</form>\n";

        print "<hr>\n";
        print "<center>\n";
        print "<table border=1>\n";
        print "<tr><td><center><b>Directory
Listing</b></center></td></tr>\n";
        print "<tr><td>\n";
        $dirlisting = `$dircommand $current`;
        print "<pre>$dirlisting</pre>\n";
        print "</td></tr></table>\n";
        print "</center>\n";
        print "<hr>\n";

        print "<center><h2>Upload to the current
directory</h2></center>\n";
        print "<form ENCTYPE=\"multipart/form-data\" method=post
action=\"$meurl\">\n";
        print "<center>Select a File: <input type=file
name=\"uploaded_file\">\n";
        print "<input type=hidden name=\"directory\"
value=\"$current\">\n";
        print "<input type=submit value=\"Upload This File\">\n";
        print "</form></center>\n";
        print "<br><br><center>This script can be obtained from <a
href=\"http://www.zonecoaster.com/\">";
        print "The Zone Coaster</a>\n";
        print "</html>\n";
        exit 0;
}

#############################################################################################
#Check if the URL(HTTP REFERER) is valid
#############################################################################################

foreach $referer (@valid)
{
        if($ENV{'HTTP_REFERER'} =~ /$referer/)
        {
                $good_ref="yes";
        }
}
if($good_ref ne "yes")
{
        print "Content-type: text/html\n\n";
        print "<title>Please go away</title>";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">";
        print "You tried to access this script either through the
location window or ";
        print "using an unauthorized form.  Neither of these activities
is permitted.";
        print "</html>\n";
        exit 0;
}

#############################################################################################
#Do the upload stuff.
#############################################################################################

$| = 1;

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
$buffer =~ /^(.+)\r\n/;
$bound = $1;
@parts = split(/$bound/,$buffer);

$filename=$parts[1];
$parts[1] =~ s/\r\nContent\-Disposition.+\r\n//g;
$parts[1] =~ s/Content\-Type.+\r\n//g;
$parts[1] =~ s/^\r\n//;

@subparts = split(/\r\n/,$parts[2]);
$directory = $subparts[3];
$directory =~ s/\r//g;
$directory =~ s/\n//g;  #got the directory name

$filename =~ s/Content-Disposition\: form-data\;
name=\"uploaded_file\"\; filename\=//g;
@stuff=split(/\r/,$filename);
$filename = $stuff[1];
$filename =~ s/\"//g;
$filename =~ s/\r//g;
$filename =~ s/\n//g;

@a=split(/\\/,$filename);
$totalT = @a;
--$totalT;
$fname=$a[$totalT];

@a=split(/\//,$fname);          #then ignore stuff before last
forwardslash for Unix machines
$totalT = @a;
--$totalT;
$fname=$a[$totalT];

@a=split(/\:/,$fname);          #then ignore stuff before last ":" for
Macs?
$totalT = @a;
--$totalT;
$fname=$a[$totalT];

@a=split(/\"/,$fname);          #now we've got the real filename
$filename=$a[0];

if($parts[1] !~ /[\w\d]/)
{
        print "Content-Type: text/html\n\n";
        print "<html>\n<title>Error!</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "You did not provide a file to be uploaded or it is
empty.\n";
        print "</html>\n";
        exit 0;
}

open(REAL,">$directory$filename") || &error($!);
binmode REAL;
print REAL $parts[1];
close(REAL);

if($windows ne 'yes')           #chmod it for unix systems
{
        `chmod 777 $directory$filename`;
}

#############################################################################################
#Let the user know that the upload's complete and give him the relevant
information
#############################################################################################

if(-e "$directory$filename")
{
        print "Content-Type: text/html\n\n";
        print "<html>\n<title>Upload Successful</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "The upload was successful.  Here is the data concerning
the file\:\n";
        print "<ul>\n";
        print "<li><b>New Filename</b>: $directory$filename\n";
        print "<li><b>Size</b>: $ENV{'CONTENT_LENGTH'} bytes\n";
        print "</ul><br>";
        print "</html>\n";
        exit 0;
}
else
{
        print "Content-Type: text/html\n\n";
        print "<html>\n<title>Upload Unsuccessful</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "The upload was unsuccessful\.\.\.unable to create
$directory.\n";
        print "<br><b>Error Message</b>\n";
        print "<pre>$!</pre>\n";
        print "</html>\n";
        exit 0;
}

#############################################################################################
#Subroutines
#############################################################################################

sub error{

        print "Content-Type: text/html\n\n";
        print "<html>\n<title>Error!</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "Could not create <b>$directory</b>\n";
        print "<br><b>Error message:</b>$_[0]\n";
        print "</html>\n";
        exit 0;
}

sub get_form_data{

        @pairs=split(/\&/,$ENV{'QUERY_STRING'});
        foreach $pair (@pairs)
        {
                ($name,$value) = split(/\=/,$pair);
                $name =~ s/\+/ /g;
                $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;
                $value =~ s/~!/ ~!/g;
                $value =~ s/\+/ /g;
                $value =~ s/\n//g;
                $value =~ s/\r/\[ENTER\]/g;
                push (@formdata,$name);
                push (@formdata,$value);
        }
        %formdata=@formdata;
        return %formdata;
}

sub unable{
        print "Content-type: text/html\n\n";
        print "<html>\n";
        print "<title>Error</title>\n";
        print "<body bgcolor=\"\#ffffff\" text=\"\#000000\">\n";
        print "Unable to open: $_[0]\n";
        print "</html>\n";
        exit 0;
}


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

Date: 24 Oct 1998 08:37:52 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: File upload script
Message-Id: <70shn0$8hf$1@pilot.njin.net>

Michael <michael@purestar.com> writes:

[snip]

>I have included the original perl script below, I hope with the author
>Bernard Sowa's approval.

>From original script:

>Please do not redistribute this script.

>Thank you.

>Bernard Sowa <bernard@zonecoaster.com>


What is your "hope" based on?  It appears that Bernard has stated in
the clearest possible terms that he does NOT want you to redistribute
the script.


David Black
dblack@pilot.njin.net


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

Date: 24 Oct 1998 13:06:31 GMT
From: snowhare@devilbunnies.org (Snowhare)
Subject: Re: File upload script
Message-Id: <70sjcn$7td$1@nnrp3.snfc21.pbi.net>



Nothing above this line is part of the signed message.

In article <70shn0$8hf$1@pilot.njin.net>,
David Alan Black <dblack@pilot.njin.net> wrote:
>Michael <michael@purestar.com> writes:
>
>[snip]
>
>>I have included the original perl script below, I hope with the author
>>Bernard Sowa's approval.
>
>From original script:
>
>>Please do not redistribute this script.
>
>>Thank you.
>
>>Bernard Sowa <bernard@zonecoaster.com>
>
>
>What is your "hope" based on?  It appears that Bernard has stated in
>the clearest possible terms that he does NOT want you to redistribute
>the script.

Additionally, that script has security holes you can drive a train
through. Don't use it if you value your system at all.

Benjamin Franz


Version: 2.6.2

iQCVAwUBNjHRMejpikN3V52xAQEhXwP+Oo2KBQ8E2NGfwaqJ8Va8f5YhKIJ6fMxO
n6TgqFEiEFpEtxhnfPxn/CPG9rskcq4awcvF5YdwSt4gV6n8Bum/xO2NtaFglJfb
o4XuCWtCDR7nVmyr6A6Pw0AYw3PYTM+rqbWTLw1/xS2Fy13atlKrvX9OROSo7Ga9
k3rvAw7xSAs=
=hQd/
-----END PGP SIGNATURE-----


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

Date: Sat, 24 Oct 1998 15:16:50 +0200
From: Michael <michael@purestar.com>
To: David Alan Black <dblack@pilot.njin.net>
Subject: Re: File upload script
Message-Id: <3631D342.2CD9D02@purestar.com>

David,

Based on the following facts: 1) Firstly sending the author a message
prior to newsposting but not having got a reply as yet. 2) Sending a CC
of the newsposting to the author so he may express his wishes. 3)
Pointing the newsreaders to author's Site where the script is already
publicly offered for others to use (including the script directly on the
posting was for reason of clarity only as some people might find it
difficult to navigate to the specific section of the Site). 4) If the
author objects I would cancel the newsposting.

Michael

David Alan Black wrote:
> 
> Michael <michael@purestar.com> writes:
> 
> [snip]
> 
> >I have included the original perl script below, I hope with the author
> >Bernard Sowa's approval.
> 
> From original script:
> 
> >Please do not redistribute this script.
> 
> >Thank you.
> 
> >Bernard Sowa <bernard@zonecoaster.com>
> 
> What is your "hope" based on?  It appears that Bernard has stated in
> the clearest possible terms that he does NOT want you to redistribute
> the script.
> 
> David Black
> dblack@pilot.njin.net


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

Date: Sat, 24 Oct 1998 21:28:17 +0200
From: Michael <michael@purestar.com>
Subject: Re: File upload script
Message-Id: <36322A51.98AFEA40@purestar.com>

Snowhare,

Could you elaborate on those secury holes, what are the risks involved to
other parts of a Site except the target directories where the script is set
to upload files?

Thanks,

Michael

Snowhare wrote:

> 
>
> Nothing above this line is part of the signed message.
>
> In article <70shn0$8hf$1@pilot.njin.net>,
> David Alan Black <dblack@pilot.njin.net> wrote:
> >Michael <michael@purestar.com> writes:
> >
> >[snip]
> >
> >>I have included the original perl script below, I hope with the author
> >>Bernard Sowa's approval.
> >
> >From original script:
> >
> >>Please do not redistribute this script.
> >
> >>Thank you.
> >
> >>Bernard Sowa <bernard@zonecoaster.com>
> >
> >
> >What is your "hope" based on?  It appears that Bernard has stated in
> >the clearest possible terms that he does NOT want you to redistribute
> >the script.
>
> Additionally, that script has security holes you can drive a train
> through. Don't use it if you value your system at all.
>
> Benjamin Franz
>
> 
> Version: 2.6.2
>
> iQCVAwUBNjHRMejpikN3V52xAQEhXwP+Oo2KBQ8E2NGfwaqJ8Va8f5YhKIJ6fMxO
> n6TgqFEiEFpEtxhnfPxn/CPG9rskcq4awcvF5YdwSt4gV6n8Bum/xO2NtaFglJfb
> o4XuCWtCDR7nVmyr6A6Pw0AYw3PYTM+rqbWTLw1/xS2Fy13atlKrvX9OROSo7Ga9
> k3rvAw7xSAs=
> =hQd/
> -----END PGP SIGNATURE-----



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

Date: Sat, 24 Oct 1998 07:23:28 -0500
From: Poohba <poohba@io.com>
Subject: How do I print one of many?
Message-Id: <Pine.BSF.4.02A.9810240709470.4303-100000@dillinger.io.com>

Hey all,
	
Lets say I have this data file that looks like this:

#Catagory|Sub1|Sub2|Titel|Address|Comments
Travel|Reservations|Air|Name Of Site|www.site.com|This is an airline reservation page
Travel|Reservations|Air|Name Of Site|www.site.com|This is an airline reservation page
Travel|Reservations|Air|Name Of Site|www.site.com|This is an airline reservation page
Travel|Reservations|Car|Name Of Site|www.site.com|This is an car reservation page
Travel|Reservations|Car|Name Of Site|www.site.com|This is an car reservation page
Travel|Reservations|Car|Name Of Site|www.site.com|This is an car reservation page
Search|Internet|Sites|Name Of Site|www.site.com|This is a search engine
Search|Internet|Sites|Name Of Site|www.site.com|This is a search engine
Search|Internet|Sites|Name Of Site|www.site.com|This is a search engine

This is the result I want on my web page:

Travel<ul>
    Reservations<ul>
	Air<ul>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	</ul>
	Car<ul>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a airline reservation</blockquote>
	</ul>
    </ul>
</ul>
Search<ul>
    Internet<ul>
	Search Engines<ul>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a search engine</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a search engine</blockquote>
	    <li><a href=www.site.com>Name Of Site</a><br>
	    <blockquote>This is a search engine</blockquote>
	</ul>
    </ul>
</ul>

How do I do this?
I know how to get the tags and things like that using a foreach loop but I
don't know how to get "Internet to show up just once" or Reservations or
Air.  Please help
	      *		Web Page Designs	  *
	    <  poohba@io.com  |  www.io.com/~poohba >
	      *		  (919)599-5543		  * 
		



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

Date: 24 Oct 1998 14:16:11 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: interacting with alarm
Message-Id: <m3zpamayn8.fsf@joshua.panix.com>

Mark Sholund <msholund@wans.net> writes:

> So will implementing this suggestion solve my problem?

What happened when you tried it?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 24 Oct 1998 08:44:00 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Interpolated, squared?
Message-Id: <70si2g$ead$1@monet.op.net>

In article <36306DD3.7A1559B6@harris.com>,
PERL ROCKS! <emills@harris.com> wrote:
>http://www.plover.com/~mjd/perl/varvarname.html  has an interesting article on
>this.

No, my article is about something something else.

>At any rate, here is a statement where I have 0..n global instances of a
>variable seln (sel0, sel1, etc..). I think what you're missing is the
>concatentation operator "." in your statement.
>
>   for ($i=0;$i<=$in{recs};$i++)
>     { if ($in{sel.$i}==1) {$dx += 1;} }

That's not the same as what I was talking about in my article.  Here
you've packaged up the `variable names' into a hash, where they can't
leak out and interfere with the variables in the rest of the program
anyway.  That's exactly what I recommended in my article:

	``This is precisely the problem that namespaces were invented to
	  solve, and that's just what a hash is: A portable namespace.''

To commit the mistake I was warning about in my article, you have to
use soft references:

    foreach $var (keys %in) {
      ${$var} = $in{$var};
    }

    for ($i=0;$i<=$in{recs};$i++)
      { if (${"sel$i"}==1) {$dx += 1;} }

Even this isn't so bad if all the input variables begin with `sel';
that's something like a namespace.  It's of an intermediate badness.



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

Date: Sat, 24 Oct 1998 12:58:09 GMT
From: donroc@lh2.rdc1.tx.home.com (Don O'Connell)
Subject: Looking for current maintainer of perlvision
Message-Id: <slrn733jjm.5mc.donroc@linux.home>

I am making modification to perlvision at work, and would
like to put the improvements back into the community.

Who is the current maintainer, and if none how do
updates to packages get put into usage.

Remove nospam. from email addr.
-- 
Thanks
Don O'Connell -- email  - donroc@nospam.home.net


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

Date: 24 Oct 1998 12:30:24 GMT
From: David Gibbons <dgibbons@towergroup.com>
Subject: Newbie help--perl won't run as CGI
Message-Id: <3631D670.3F88C1A0@towergroup.com>

I am using Windows NT 4 server and IIS 4.  I have installed perl, and
made all ofthe associations, as per the documentation.  My perl scripts
run fine from the command line, but when I try them as a cgi script from
a web page, the system just sits there.  I have checked in Task Manager,
and the perl interpreter is starting up, but not doing anything,
apparently (at least it is not consuming any processor time).

Can anyone help?

Thanks,

David L. Gibbons



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

Date: 24 Oct 1998 08:34:39 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70shgv$e8s$1@monet.op.net>

In article <36349d97.3264632@news.ping.be>,
Bart Lateur <bart.mediamind@ping.be> wrote:
>You then would have through a lot of trouble to turn this year into
>something that is Y2K-unsafe. Very few people would actually use
>something like ($year-1900) in their code.

Yeah.  You know what's really funny?  There is *only one* advantage to
the existing design.  This advantage is that during the 20th Century,
you don't have to transform the year before you can print it out in
short dates.  But if you make use of this advantage, your program has
a Y2K bug and will break in Y2K.  The only way to get any benefit from
the `convenient'  design is to write a broken program.

Of course, many people did this.





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

Date: Sat, 24 Oct 1998 15:17:57 +0200
From: "Bertil Wennergren" <bertilow@algonet.se>
Subject: Problems with plus sign in perl script
Message-Id: <70sk2g$inm$1@zingo.tninet.se>

What's wrong with this script?

#!/usr/bin/perl

use strict;

my $plus_sign = "+";
my $plus_word = "plus";

my $string1 = "word $plus_sign word";

print "$string1\n";

$string1 =~ s|$plus_sign|$plus_word|g;

print "$string1\n";
------------------------------------

When I run it, I get:

word + word + word
/+/: ?+*{} follows nothing in regexp at test.pl line 12.
------------------------------------

The following works as expected:

#!/usr/bin/perl

use strict;

my $plus_word = "plus";

my $string1 = "word $plus_sign word";

print "$string1\n";

$string1 =~ s|\+|$plus_word|g;

print "$string1\n";
------------------------------------

It prints:

word + word
word plus word
------------------------------------

I've tried this on perl 5.004_02 (on Windows 98) and 
perl 5.004_04 on sun4_solaris. Same result.

Bug in perl? Bug in my head (probably)?

___________________________________________________________________

                         Bertilo Wennergren
                 <http://purl.oclc.org/NET/bertilo>
                     <bertilow@hem1.passagen.se>
___________________________________________________________________






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

Date: Sat, 24 Oct 1998 04:24:33 +0000
From: "Xah" <xah@best.com>
Subject: programing fun: trees: Part...
Message-Id: <3631b78a$0$6392@nntp1.ba.best.com>

Here's another fun programing problem on trees.

Attached below is the problem description. I'll be coding a solution this weekend. Gurus, masters, and experts: please join in the fun and show us your solution! I'll post mine when I'm done.

 Xah, xah@best.com
 http://www.best.com/~xah/PageTwo_dir/more.html
 Petty penguins make way: GNU HURD is coming! <www.gnu.org>


#_____ Part _____ _____ _____ _____

=pod

B<Part>

Part(tree, e1, e2, e3,...) returns a branch of the tree at position index (e1, e2, e3,...). The e_i are integers. If negative, counting starts form right. For example, Part([[['0','a','b'],'h'],'x','t'], 0, 0, 2) returns 'b'. If a component (an integer) of the position index is longer than the length at that position, then cyclic counting is used. For example, Part([0,1,2], 3) returns 0 and Part([0,1,2], -4) returns 2.

Each element e_i can also be a list of integers of the form [e_i_1, e_i_2, e_i_3,...]. In such case, Part returns the Cartesian product of all e_i. For example, Part([[['0','a','b'],'h'],'x','t'], 0, 0, [1,2]) returns ['a','b'], which has position indexes (0,0,1) and (0,0,2). Part($tree, [1,2],0,[3,4]) will return [['part 1 0 3', 'part 1 0 4'],['part 2 0 3', 'part 2 0 4']].

Related: Extract, Level.

Example:

 Part(['a','b','c'], 0); # returns 'b'.
 
 Part(['a','b','c'], 3); # returns 'a'.
 
 Part(['a','b','c'], -1); # returns 'c'.

 Part([5,[98, 44],'x'], 1, 0); # returns 98.

 Part([5,[98, 44],'x','y'], [3,2,3]); # returns ['y', 'x', 'y'].

 $tree = [[['000', '001'], ['010', '011']], [['100', '101'], ['110', '111']]];
 Part($tree, 0, 0); # returns ['000', '001'].
 Part($tree, 0, -1); # returns ['010', '011'].
 Part($tree, 0, 1, 0); # returns '010'.
 Part($tree, 0, 1, [0,0]); # returns ['010', '010'].
 Part($tree, 0, [1,0], 0); # returns ['010', '000'].
 Part($tree, 0, [1,0], [1,0]); # returns [['011','010'],['001','000']].

 Part($tree, [1,-4], [4,1,4], [0]);
 # returns [[['100'], ['110'], ['100']], [['000'], ['010'], ['000']]].

--


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

Date: 24 Oct 1998 02:55:10 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: reference to array
Message-Id: <70rfie$kvj@mozo.cc.purdue.edu>

Tk Soh <r28629@email.sps.mot.com> writes:
}Uri Guttman wrote:
}>   UG> you can index from the end of any array (anon or real) with
}>   UG> negative numbers. so the last element is @array[-1]. i leave it as
}>   UG> an very easy exercise to make that work for an anon array.
}> me brain dead. it is friday. the phase of the moon bothering me.  it
}> should be $array[-1]. somedays i just can't type what i mean.

}but @array[-1] still works, in this case:

}  DB<31> @a = (1,2,3,4,5)
}  DB<32> $s = @a[-1]

It works, but for the wrong reasons.  Really.

If writing unharmonious perl doesn't deter you, perhaps the fact that
it's not -w clean will.  "Scalar value @a[-1] better written as $a[-1]
at - line 3."


-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Sat, 24 Oct 1998 09:22:17 +0200
From: "CS" <sutton@lynxus.com>
Subject: Re: Request for Perl script that emulate Remote Shell
Message-Id: <RAkY1.117$Kb6.3624@news2.randori.com>

I have successfully used Net::Telnet to login to a remote system that does
not support rsh, issue a command and print the output.  You can get
Net::Telnet from CPAN.  Install it and look at the doc, it has examples.

As another poster suggested you need to look at the security issues,
especially with this method as you need to supply the password to login.
One method that I use is to store the password in a file with 400
permissions to prevent others from reading that file.

Chip Sutton


Tamir Hagit wrote in message ...
>Hello All,
>
>I need help in writing a script that will connect to a non UNIX machines
and
>do something
>that look like remote shell, which means that the program should do telnet
>to any other
>machine, ask something, get an answer, print it and exit.
>
>Any ideas....???
>
>I try to use other packages like chat2.pl, telnet.pl but had problem with
>these scripts.
>
>I have perl5 and perl4 install on my HPUX machines.
>
>Thanks
>
>Hagit
>
>
>
>




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

Date: 24 Oct 1998 14:18:47 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: msholund@bigfoot.com
Subject: Re: splitting on .
Message-Id: <m3yaq6ayiw.fsf@joshua.panix.com>

Mark Sholund <msholund@wans.net> writes:

> I have been trying to split a string into parts that are delimited
> by periods.  I started by trying split(/./,$IP), but since "."
> matches everything, split has no effect.

"No effect"?  I think not.

You want to quote the . metacharacter, for which the quotemeta()
function or its double-quotish escape sequence \Q is just the ticket.
Or you may simply quote it yourself like

   /\./

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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