[17897] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 57 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 13 18:05:42 2001

Date: Sat, 13 Jan 2001 15:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979427111-v10-i57@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 13 Jan 2001     Volume: 10 Number: 57

Today's topics:
        Active Perl 5 Paths <m.j.schurhoff@chello.nl>
        Active Perl 5 Paths <m.j.schurhoff@chello.nl>
        Active Perl 5 Paths <m.j.schurhoff@chello.nl>
    Re: Active Perl 5 Paths (FDShah)
        Can't associate .PL files in Win98 <glburton@mindspring.com>
    Re: Code breaking <garryknight@bigfoot.com>
    Re: Code breaking (Mike Stok)
    Re: converting a form value <brondsem@my-deja.com>
        DB connection from Perl - Server Config 4rfa1_901@my-deja.com
        File Upload <rmerrit@bigpond.com>
    Re: File Upload billgerba@my-deja.com
        Help me append <eddyneal@earthlink.net>
    Re: HTTP::Request encoding query <joe+usenet@sunstarsys.com>
    Re: Jobs: Senior Software Engineer (Alan Barclay)
    Re: Net::Telnet with W2K NTLM <Petri_member@newsguy.com>
    Re: Net::Telnet with W2K NTLM <davidkirk@mediaone.net>
    Re: Net::Telnet with W2K NTLM <davidkirk@mediaone.net>
    Re: Perl crashes on exit <bart.lateur@skynet.be>
    Re: perlscript: can't figure out what's wrong <iltzu@sci.invalid>
    Re: perlscript: can't figure out what's wrong (Garry Williams)
    Re: Problem with while loop regexp? (Ilya Zakharevich)
        Replacing the "\" character in Perl. shiloam@my-deja.com
        Replacing the "\" character using s///. shiloam@my-deja.com
    Re: Replacing the "\" character using s///. <artd@artd3.com>
    Re: Replacing the "\" character using s///. <uri@sysarch.com>
    Re: Replacing the "\" character using s///. <artd@artd3.com>
    Re: socket send to client problem (Garry Williams)
        Trouble with range operator and unitialized variable. <jbritain@home.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 13 Jan 2001 19:51:07 GMT
From: "M.J. Schürhoff" <m.j.schurhoff@chello.nl>
Subject: Active Perl 5 Paths
Message-Id: <Lk286.633090$%C1.7896034@Flipper>

Hello,

I'm using a search script in which I need to specify the basedirectory on
the server (the path on the server where the website resides). The script
used to run on a Unix server, so the path would for example be /path/dir/etc
Now I moved to another provider which uses Windows NT as a server where the
website is located somewhere on G:\activewebroot\etc. Using something like
this doesn't work. Can anyone tell me how to get around this G:\......
notation?

Any help would be welcome.

With kind regards,
M.J. Schürhoff




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

Date: Sat, 13 Jan 2001 20:02:45 GMT
From: "M.J. Schürhoff" <m.j.schurhoff@chello.nl>
Subject: Active Perl 5 Paths
Message-Id: <Fv286.633266$%C1.7900077@Flipper>

Hello,

I'm using a search script in which I need to specify the basedirectory on
the server (the path on the server where the website resides). The script
used to run on a Unix server, so the path would for example be /path/dir/etc
Now I moved to another provider which uses Windows NT as a server where the
website is located somewhere on G:\activewebroot\etc. Using something like
this doesn't work. Can anyone tell me how to get around this G:\......
notation?

Any help would be welcome.

With kind regards,
M.J. Schürhoff




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

Date: Sat, 13 Jan 2001 20:02:08 GMT
From: "M.J. Schürhoff" <m.j.schurhoff@chello.nl>
Subject: Active Perl 5 Paths
Message-Id: <4v286.633256$%C1.7899828@Flipper>

Hello,

I'm using a search script in which I need to specify the basedirectory on
the server (the path on the server where the website resides). The script
used to run on a Unix server, so the path would for example be /path/dir/etc
Now I moved to another provider which uses Windows NT as a server where the
website is located somewhere on G:\activewebroot\etc. Using something like
this doesn't work. Can anyone tell me how to get around this G:\......
notation?

Any help would be welcome.

With kind regards,
M.J. Schürhoff




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

Date: 13 Jan 2001 20:29:21 GMT
From: fdshah@aol.com (FDShah)
Subject: Re: Active Perl 5 Paths
Message-Id: <20010113152921.15064.00000117@ng-fn1.aol.com>

It seems you're looking for the absolute pathname to your cgi script.
Essentially, there are two kinds, absolute pathnames & relative pathnames.

Absolute pathnames start with a slash (/).

Omit the "G:\" and trace the directory of your script from the root. That is,
if you're website is located somewhere on "G:\activewebroot\etc." change it to:

/activewebroot/etc

For a better explanation, refer to Ch. 4, pg 51 of Jennifer Niederst's
excellent book, Web Design in a Nutshell (pub. by O'Reilly).

Hope this helps,
Dipesh ;-)
fdshah@aol.com







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

Date: Sat, 13 Jan 2001 12:39:37 -0800
From: Gary Burton <glburton@mindspring.com>
Subject: Can't associate .PL files in Win98
Message-Id: <3A60BD09.B0DAA9F6@mindspring.com>

	I am a newbie using Win98.  I am using ActivePerl v5.6, and working from the ActivePerl online documentation.  I can run my example programs from a DOS window by typing in "Perl filename"; but when I associate the .PL extension as the literature suggest, all I get is a DOS window that closes so quickly that I can't read the error message.  

	I followed the instructions in "How do I associate Perl scripts with perl?" found in perlwin32faq4.  I believe I followed the instructions precisely.  I researched the archived mail subscription site "perl-win32-users" and found a comment to the effect that this will not work in Win95 or Win98 although it does work in WinNT.  

	Before I believe that completely, I would like to get substantiation from an expert.  It is a major inconvenience to do all that typing, and one would expect FAQ to not be that misleading.


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

Date: Sat, 13 Jan 2001 16:08:14 +0000
From: "Garry Knight" <garryknight@bigfoot.com>
Subject: Re: Code breaking
Message-Id: <93puhe$ngm$2@taliesin.netcom.net.uk>

In article <93pjqp$7e6$1@newsg1.svr.pol.co.uk> "James Boulter"
<jbou@bunker79.fsnet.co.uk> wrote:

> I am writting a perl program to translate normal words into code.  In
> order to do this I need to be able to put each letter in a variable
> through the same process.

Depending on the process, you might be able to use transliteration. For
example, here's a small program that applies ROT13 to anything you
enter (or to any files you name on the command line):

#!/usr/bin/perl -w
use strict;
while (<>) {
  tr /a-zA-Z/n-za-mN-ZA-M/;
  print $_;
}
 
It works by converting any lowercase or uppercase letter into its
equivalent but shifted by half the alphabet. In other words, 'a'
becomes 'n' and vice versa, 'b' becomes 'o' and vice versa, and so on.

For more details 'man perlop' and search for 'tr/'.

-- 
Garry Knight
garryknight@bigfoot.com


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

Date: Sat, 13 Jan 2001 17:34:08 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Code breaking
Message-Id: <kk086.974$zK4.73645@typhoon.austin.rr.com>

In article <t60m511moorhe4@corp.supernews.com>, Art <artd@artd3.com> wrote:

>Not an expert, but this may work:
>
>
>#!/usr/bin/perl -w
>
>$data = 'This is a string';
>
>#Reverses the order so when you do chop, it adds them to the array in order
>$data = reverse $data;
>
># Gets the chopped value and pushes it (adds it) to the array
>while ($data) {
>        push @letters, chop($data);
>};
>
>foreach $letter (@letters) {
>        print "$letter\n";
>        # do whatever you want with the individual letter now.
>};
>
>I'm sure this scriptlet will be criticize by our cordial list members for
>not using use strict, I am recomending use strict, I just want to write the
>damned thing and get this post over with :).

I don't worry too much about -w and use strict, but I would worry about 
perl's notions of truth and falseness and how they might bite you:

  DB<1> $data = 'I need $1000000'

  DB<2> $data = reverse $data

  DB<3> while ($data) { push @letters, chop $data }

  DB<4> print "@letters"
I   n e e d   $ 1 0 0 0 0 0
  DB<5> 

One way to help the original poster might be 

  foreach my $character (split //, $string) {
    ...
  }

or you could use substr to grab bits of the string by index if you didn't 
want to create an array of the characters.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |
GPG PGP Key 1024D/059913DA         | Fingerprint      0570 71CD 6790 7C28 3D60
stok@colltech.com (CT - work)      |                  75D2 9EC4 C1C0 0599 13DA


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

Date: Sat, 13 Jan 2001 16:11:35 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: converting a form value
Message-Id: <93punj$lan$1@nnrp1.deja.com>

In article <93po2u$giq$1@nnrp1.deja.com>,
  sandywadkins123@my-deja.com wrote:
> problem: when getting a form value that = Black/white it comes out
> Black%2FWhite and is written to file that way.
>
> I can't seem to convert it?? What am I doing wrong
>
> here's what I'm doing.
>
> $color=~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;
               -----------^
no space

>
> thanks
>
> Sent via Deja.com
> http://www.deja.com/
>

--
Dave Brondsema


Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 13 Jan 2001 20:14:23 GMT
From: 4rfa1_901@my-deja.com
Subject: DB connection from Perl - Server Config
Message-Id: <93qcuq$3s$1@nnrp1.deja.com>

Hey dudes

Im having a small problem. I have 2 Solaris 2.6 boxes, 1 running Oracle
(v7 or 8, Im not sure). Box B is running oracle. I want to
write a perl script on Box A which hits the DB on box B. Now,
in order to do this I need to have DBI installed on Box A,
which been done. Box A doesnt have squat on it except for
perl, gcc, and DBI1.14. I read through some doc and apparently I need
DBD:Oracle installed on A as well (and I cant get it to install, the
readme isnt helping). Furthermore, Im told I need to install
some more stuff on Box A to make this work (like SQL*net or something).
Could anyone tell me what exactly I need to have on Box A
to make this work? And is there any particular order
to the install?

Also, any DBD install tips would be nice. Im not a sysadmin
and I dont have any access to one, so Im really struggling
with setting up this environment...funny thing is that the
script is done.

Any help is appreciated.
Thanks
-dude





Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 14 Jan 2001 03:27:06 +1000
From: "rmerrit" <rmerrit@bigpond.com>
Subject: File Upload
Message-Id: <3a609050$0$15490$7f31c96c@news01.syd.optusnet.com.au>

I have the script just about working. The problem is that I cannot exceed
file size of 99kb. It excepts any file type, just not file size. Several
files can be uploaded at anyone time, as long as it doesn't exceed 99kb. I


Any help would be much appreaciated thanks!!!!

Here is the script

=====================


#!c:\perl\bin\perl.exe
#
# File Upload Script        Version 7.00
# ---------------------------------------------------------------------
# Configurable Options Follow:
#

BEGIN {
        $NT_SERVER = 1;
    # This is needed to work on Windows/NT platforms.
    # Set to 1 for Windows/NT.
           # Set to 0 for UNIX/LINUX.
    #

 $SAVE_DIRECTORY = "C:/sambar44/dexrix.dynip.com/Uploads";
                              #
                              # --> Variable:
                              #         $SAVE_DIRECTORY
                              # --> Function:
                              #         Defines the path to the directory
                              #         on the server that should be used
                              #         as the folder to save files into.
                              # --> Directory Permissions:
                              #         a+rwx
                              # --> Additional Notes:
                              #         This path should not have a
         #         trailing forward slash.  Also
         #         remember that this is a path, not
         #         a URL.  Use something similar to:
         #
         #         /home/myself/www/uploads
         #

 $MAXIMUM_UPLOAD = 0;
                              #
                              # --> Variable:
                              #         $MAXIMUM_UPLOAD
                              # --> Function:
                              #         Defines the number of bytes that
                              #         can be uploaded.  Files that exceed
                              #         this limit will not be saved on the
                              #         server.
                              # --> Additional Notes:
         #         Set this to zero in order to
                        #         disable size checking.
         #

 $ALLOW_INDEX = 0;
                              #
                              # --> Variable:
                              #         $ALLOW_INDEX
                              # --> Function:
                              #         If set to zero, files whose
         #         names begin with the word
         #         index will not be saved.
                              #
         #         Set to one to allow files
         #         named index* to be uploaded.
                              # --> Additional Notes:
                              #

 $SUCCESS_LOCATION = ""
                              #
                              # --> Variable:
                              #         $SUCCESS_LOCATION
                              # --> Function:
                              #         Defines the URL that users
                              #         should be redirected to if
         #         the script works properly.  If
         #         this is left blank, a default
         #         page will be returned to the
         #         user.
                              # --> Additional Notes:
                              #         This is a COMPLETE URL, not
                              #         a path.
}
#
# End of Configurable Options.
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------
# -->           Do Not Change Anything Below This Line.           <-- #
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------

 $| = 1;
 chop $SAVE_DIRECTORY if ($SAVE_DIRECTORY =~ /\/$/);
 use CGI qw(:standard);
 $query = new CGI;

 if ( (!(-e $SAVE_DIRECTORY)) ||
   (!(-W $SAVE_DIRECTORY)) ||
   (!(-d $SAVE_DIRECTORY)) ) {
  print header;
  print <<__END_OF_HTML_CODE__;

  <HTML>
  <HEAD>
   <TITLE>Error: Bad Directory</TITLE>
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">
  <H1>Bad Directory</H1>
  <P>
  The directory you specified:
  <BR>
  <BLOCKQUOTE>
   <TT>\$SAVE_DIRECTORY = "<B>$SAVE_DIRECTORY</B>";</TT>
  </BLOCKQUOTE>
  <BR>
  is invalid.  This problem is caused by one of the three following reasons:
  <OL>
   <LI>The directory doesn't exist.  Make sure that this directory is a
complete path name, not
       a URL or something similar.  It should look similar to
<TT>/home/username/public_html/uploads</TT>
   <P>
   <LI>The directory isn't writable.  Make sure that this directory is
writable by all users.  At
    your UNIX command prompt, type <TT>chmod 777 $SAVE_DIRECTORY</TT>
   <P>
   <LI>The directory you specified isn't really a directory.  Make sure that
this is indeed a directory
    and not a file.
  </OL>
  <HR SIZE=1>
  <CENTER><A HREF="http://www.dexrix.com">www.dexrix.com</A></CENTER>
  </BODY>
  </HTML>

__END_OF_HTML_CODE__
  exit;
 }

 foreach $key (sort {$a <=> $b} $query->param()) {
  next if ($key =~ /^\s*$/);
  next if ($query->param($key) =~ /^\s*$/);
  next if ($key !~ /^file-to-upload-(\d+)$/);
  $Number = $1;

  if ($query->param($key) =~ /([^\/\\]+)$/) {
   $Filename = $1;
   $Filename =~ s/^\.+//;
   $File_Handle = $query->param($key);

   if (!$ALLOW_INDEX && $Filename =~ /^index/i) {
    print header;
    print <<__END_OF_HTML_CODE__;

    <HTML>
    <HEAD>
     <TITLE>Error: Filename Problem</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF">
    <H1>Filename Problem</H1>
    <P>
    You attempted to upload a file that isn't properly formatted.  The
system administrator
    has decided that you can't upload files that begin with the word
'<B>index</B>'. Please
    rename the file on your computer, and try uploading it again.
    <P>
    <HR SIZE=1>
  <CENTER><A HREF="http://www.dexrix.com">www.dexrix.com</A></CENTER>
    </BODY>
    </HTML>

__END_OF_HTML_CODE__
    exit;
   }
  } else {
   $FILENAME_IN_QUESTION = $query->param($key);

   print header;
   print <<__END_OF_HTML_CODE__;

   <HTML>
   <HEAD>
    <TITLE>Error: Filename Problem</TITLE>
   </HEAD>
   <BODY BGCOLOR="#FFFFFF">
   <H1>Filename Problem</H1>
   <P>
   You attempted to upload a file that isn't properly formatted.  The file
in question
   is <TT><B>$FILENAME_IN_QUESTION</B></TT>  Please rename the file on your
computer, and
   attempt to upload it again.  Files may not have forward or backward
slashes in their
   names.  Also, they may not be prefixed with one (or more) periods.
   <P>
   <HR SIZE=1>
  <CENTER><A HREF="http://www.dexrix.com">www.dexrix.com</A></CENTER>
   </BODY>
   </HTML>

__END_OF_HTML_CODE__
   exit;
  }

        if (!open(OUTFILE, ">$SAVE_DIRECTORY\/$Filename")) {
            print "Content-type: text/plain\n\n";
            print "-------------------------\n";
            print "Error:\n";
            print "-------------------------\n";
            print "File: $SAVE_DIRECTORY\/$Filename\n";
            print "-------------------------\n";
         print "There was an error opening the Output File\n";
         print "for Writing.\n\n";
         print "Make sure that the directory:\n";
         print "$SAVE_DIRECTORY\n";
         print "has been chmodded with the permissions '777'.\n\n";
         print "Also, make sure that if your attempting\n";
         print "to overwrite an existing file, that the\n";
         print "existing file is chmodded '666' or better.\n\n";
         print "The Error message below should help you diagnose\n";
         print "the problem.\n\n";
         print "Error: $!\n";
            exit;
        }

if ($NT_SERVER) {
  binmode(OUTFILE); }
     {   next;

}
  undef $BytesRead;
  undef $Buffer;

        while ($Bytes = read($File_Handle,$Buffer,16528)) {
   $BytesRead += $Bytes;
            print OUTFILE $Buffer;
        }

  push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
  $TOTAL_BYTES += $BytesRead;
  $Confirmation{$File_Handle} = $BytesRead;

        close($File_Handle);
  close(OUTFILE);

        chmod (0666, "$SAVE_DIRECTORY\/$Filename");
    }

 $FILES_UPLOADED = scalar(keys(%Confirmation));


 if ($TOTAL_BYTES > $MAXIMUM_UPLOAD && $MAXIMUM_UPLOAD > 0) {
  foreach $File (@Files_Written) {
   unlink $File;
  }

  print header;
  print <<__END_OF_HTML_CODE__;

  <HTML>
  <HEAD>
   <TITLE>Error: Limit Reached</TITLE>
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">
  <H1>Limit Reached</H1>
  <P>
  You have reached your upload limit.  You attempted to upload
<B>$FILES_UPLOADED</B> files, totalling
  <B>$TOTAL_BYTES</B>.  This exceeds the maximum limit of
<B>$MAXIMUM_UPLOAD</B> bytes, set by the system
  administrator.  <B>None</B> of your files were successfully saved.  Please
try again.
  <P>
  <HR SIZE=1>
  <CENTER><A HREF="http://www.dexrix.com">www.dexrix.com</A></CENTER>
  </BODY>
  </HTML>

__END_OF_HTML_CODE__
  exit;
 }

 if ($SUCCESS_LOCATION !~ /^\s*$/) {
  print $query->redirect($SUCCESS_LOCATION);
 } else {


  print header;
  print <<__END_OF_HTML_CODE__;

  <HTML>
  <HEAD>
   <TITLE>Upload Finished</TITLE>
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">
  <H1>Upload Finished</H1>
  <P>
  You uploaded <B>$FILES_UPLOADED</B> files totalling <B>$TOTAL_BYTES</B>
total bytes.  Individual
  file information is listed below:
  <PRE>

__END_OF_HTML_CODE__

  foreach $key (keys (%Confirmation)) {
   print "$key - $Confirmation{$key} bytes\n";
  }

  print <<__END_OF_HTML_CODE__;

  </PRE>
  <P>
  Thank you for using the File Upload! system.
  <P>
  <HR SIZE=1>
  <CENTER><A HREF="http://www.dexrix.com">www.dexrix.com</A></CENTER>
  </BODY>
  </HTML>

__END_OF_HTML_CODE__
  exit;
 }

# ---------------------------------------------------------------------
# EOF





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

Date: Sat, 13 Jan 2001 22:15:29 GMT
From: billgerba@my-deja.com
Subject: Re: File Upload
Message-Id: <93qk1t$5hr$1@nnrp1.deja.com>

What sort of HTTP server are you running?  I had the exact same
problem, but it turned out that the default configuration for my HTTP
server didn't allow POSTs over 100kb.  A quick edit of a config file
fixed it all (I was running Sambar 4.3).

Hope this helps,

Bill


Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 13 Jan 2001 22:56:45 GMT
From: "E.Neal" <eddyneal@earthlink.net>
Subject: Help me append
Message-Id: <N2586.8300$U4.402153@newsread1.prod.itd.earthlink.net>

I'm trying to update a text.  For some reason the way I'm trying to
append doesn't work.  I have scoured the net and my local help files for the
answer, but I haven't been able to find it.  I can append when running local
scripts, but through the browser is where I'm running into trouble.  I would
appreciate any help.
  Thanks,
        Neal

#!perl

use CGI ':standard';

print header();
print start_html();

$firstname = param(firstname);
$lastname = param(lastname);
$telephone = param(telephone);

open (APPEND, '>> contact.txt');
print APPEND $firstname," ",$lastname," ",$telephone;
close APPEND;

print end_html();







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

Date: 13 Jan 2001 13:49:27 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: HTTP::Request encoding query
Message-Id: <m366jj1e4o.fsf@mumonkan.sunstarsys.com>

iain_hogg@my-deja.com writes:

> No arguments there.  Having a brief look over RFC 2396 did seem 
> to suggest though that a URI only identifies the resource and not 
> the context i.e a URI would be 'www.foo.com/cgi-bin/test.cgi' and 
> would exclude any arguments to the script i.e. 
> 'www.foo.com/cgi-bin/test.cgi?attr=val', hence the arguments would 
> be considered outside the URI?  This is only my take on it though.

RFC 2396 applies to the query string as well. Section 3.4 gives the
specification, but it's quite brief. Here is a excerpt from the intro
to section 3:

 This "generic URI" syntax consists of a sequence of four main 
 components:

      <scheme>://<authority><path>?<query>

> As a side note, both Opera 4.0 and IE 5.0 ignore this RFC, they 
> send a '|' unescaped.

I guess this is the real issue.  Unfortunately not enough browsers/CGI 
scripts are fully compliant with the specification.  IME many CPAN 
modules are usually flexible enough to allow you to do the Wrong Thing 
if you really need to. In a followup to my post, Ilmari points out 
that HTTP::Request appears to be less flexible in this regard, and 
inadequately so for your needs.  DWIMery seems to work against you here.

When this happens, you aren't necessarily powerless to "fix" the 
problem yourself.  If the code is OO, by identifying the offending 
subroutine/data structure and "overriding" it, you can usually solve 
the problem.  In your case it's a twisty path, but you could try 
something like this

% cat try.pl
#!/usr/bin/perl -wT
use strict;

use HTTP::Request;
my $r = new HTTP::Request GET => "http://www.foo.com/cgi-bin/test?bar=|";
${$r->uri->[0]} =~ s/%7C/|/;# force broken query string

print $r->as_string; #test request string

% try.pl
GET http://www.foo.com/cgi-bin/test?bar=|


%

or you could encapsulate the brokenness into a package (untested):

#!/usr/bin/perl -wT
use strict;

package HTTP::Request::Broken;
use HTTP::Request;
use vars qw(@ISA);
@ISA = qw( HTTP::Request );

sub new {
        my $class = shift;
        my $r = $class->SUPER::new(@_);

        # "fixes" go here
        ${$r->uri->[0]} =~ s/%7C/|/; # force broken "|"

        bless $r, ref $class || $class;
}

package main;
use HTTP::Request::Broken;

my $r = new HTTP::Request::Broken GET => 
        "http://www.foo.com/cgi-bin/test?bar=|";

print $r->as_string;

__END__

HTH
-- 
Joe Schaefer


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

Date: 13 Jan 2001 21:21:54 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <979420799.643206@elaine.furryape.com>

In article <t5vp3gdb1d4obc@corp.supernews.com>,
Chris Stith  <mischief@velma.motion.net> wrote:
>Alan Barclay <gorilla@elaine.furryape.com> wrote:
>> That doesn't sound terribly reliable. By your method, Larry Wall has
>> no experience in Perl, because he never posts here. 
>
>Note I said `wanting to make use of this newsgroup', not that it
>is the most reliable method. If Larry never posts here, he probably
>never reads here and therefore wouldn't see a rude job offering
>post either. Whether or not any of us could afford to hire

Lurkers always outnumber posters by at least 100:1. 1000:1 isn't
terribly uncommon either. Do a search on phrases like 'long time
lurker' and see how many hits you get.



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

Date: 13 Jan 2001 08:23:27 -0800
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: Net::Telnet with W2K NTLM
Message-Id: <93pvdv0n9g@edrn.newsguy.com>

In article <3A6058DD.FB01FA28@mediaone.net>, David says...

>   I'm sending commands to another unix machine via Net::Telnet login
> etc.  It works fine.  When I try to access an NT 2000 machine it does
> not work.  I get an EOF and the session closes.  The NT side seems to
> use some form of login dialogue which I not sure Net::Telnet is capable
> of handling.
> What do I need to do to get logged into the NT 2000 Machine (advanced
> server).

Yes, it is an annoying "feature" of the Win2K Telnet service, isn't it?
I was investigating this very problem a few weeks ago, and it seems that the
author of Net::Telnet is correct when he states in the docs:
"Connecting to a Remote Win32 Machine
 ...
One particularly nasty problem is a server that sends ANSI terminal escape
sequences despite being told not to. These escape sequences make your job of
parsing the data much more difficult. You can sometimes avoid this with a server
that prompts you for console mode. Choose no to console mode."

I looked at the telnet sessions I started with a packet analyser, and saw that
the server always demands a terminal-type to be used and declared.
As I recall, it will always use some sort of terminal-emulation, which means
that no carriage returns or line feeds will ever be returned from the server,
only escape-codes moving the cursor to the beginning of the next line.
That seemed to be the cause of the problem.

I experimented a while with sending back different IAC codes to turn off the
terminal stuff, but I ran out of time and ended up using Kermit as client
instead.

You could try your luck with different third-party telnet servers, but don't
waste your time on SeattleLabs Telnet, it has the same behaviour.

I suggest you try Kermit, it handles all types of terminals, even bad ones:
http://www.columbia.edu/kermit/


Petri Oksanen



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

Date: Sat, 13 Jan 2001 20:59:16 GMT
From: David Kirkpatrick <davidkirk@mediaone.net>
Subject: Re: Net::Telnet with W2K NTLM
Message-Id: <3A60C1F2.3BF116B2@mediaone.net>

Petri,
   Thank you - gives me more stuff to go on.
Davidk

Petri Oksanen wrote:

> In article <3A6058DD.FB01FA28@mediaone.net>, David says...
>
> >   I'm sending commands to another unix machine via Net::Telnet login
> > etc.  It works fine.  When I try to access an NT 2000 machine it does
> > not work.  I get an EOF and the session closes.  The NT side seems to
> > use some form of login dialogue which I not sure Net::Telnet is capable
> > of handling.
> > What do I need to do to get logged into the NT 2000 Machine (advanced
> > server).
>
> Yes, it is an annoying "feature" of the Win2K Telnet service, isn't it?
> I was investigating this very problem a few weeks ago, and it seems that the
> author of Net::Telnet is correct when he states in the docs:
> "Connecting to a Remote Win32 Machine
> ...
> One particularly nasty problem is a server that sends ANSI terminal escape
> sequences despite being told not to. These escape sequences make your job of
> parsing the data much more difficult. You can sometimes avoid this with a server
> that prompts you for console mode. Choose no to console mode."
>
> I looked at the telnet sessions I started with a packet analyser, and saw that
> the server always demands a terminal-type to be used and declared.
> As I recall, it will always use some sort of terminal-emulation, which means
> that no carriage returns or line feeds will ever be returned from the server,
> only escape-codes moving the cursor to the beginning of the next line.
> That seemed to be the cause of the problem.
>
> I experimented a while with sending back different IAC codes to turn off the
> terminal stuff, but I ran out of time and ended up using Kermit as client
> instead.
>
> You could try your luck with different third-party telnet servers, but don't
> waste your time on SeattleLabs Telnet, it has the same behaviour.
>
> I suggest you try Kermit, it handles all types of terminals, even bad ones:
> http://www.columbia.edu/kermit/
>
> Petri Oksanen



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

Date: Sat, 13 Jan 2001 22:04:52 GMT
From: David Kirkpatrick <davidkirk@mediaone.net>
Subject: Re: Net::Telnet with W2K NTLM
Message-Id: <3A60D151.78008B6@mediaone.net>

Petri,
   I did some more reading on this.  MS says to change the NTLM challange you go to
Telnet Admin and option 3 (Display settings) then 7 (NTLM options) to change from
option 2 which is NTML challange to option 0 which is no NTML challange - use text
authentication.  I checked this according to a MS bullitan which suggested get up a
telnet prompt and type in display to see what authentication is being used.  The
report I get is its using option 2 which is NTLM.  I had set this to 0 no NTLM.  I
checked the registry parameter and its set to 0.   So someones fibbing.  The
registry says don't use NTLM and the display command at the telnet prompt says its
using NTLM.  ??  It seems like its being used.
   Also my Net::Telnet says I must have a command prompt listed as an arg to the
telnet session. I've been using C:\> as I though it meant that prompt.  Now I'm not
sure if it really wants thte prompt of the telnet sessions. For W2K machines thats
Microsoft Telnet with a space.   I'll try that later.
davidk
Later:  I think I'm getting logged in.  The NTML turnoff in Telnet Admin does not
seem to be working.  If you isssue telnet from the command line you'll get the
telnet prompt.  If you enter a ? you get a list of commands - one is to set NTLM
on/off.  Setting it off there then doing a display shows NTLM off.  I then ran the
script and got to the line after the login so I think I'm logged in or partly logged
in.  My next command in the script was a cmd with dir as the parameter which did not
execute.  ?? so all in all I'm further along.
Thanks dk




Petri Oksanen wrote:

> In article <3A6058DD.FB01FA28@mediaone.net>, David says...
>
> >   I'm sending commands to another unix machine via Net::Telnet login
> > etc.  It works fine.  When I try to access an NT 2000 machine it does
> > not work.  I get an EOF and the session closes.  The NT side seems to
> > use some form of login dialogue which I not sure Net::Telnet is capable
> > of handling.
> > What do I need to do to get logged into the NT 2000 Machine (advanced
> > server).
>
> Yes, it is an annoying "feature" of the Win2K Telnet service, isn't it?
> I was investigating this very problem a few weeks ago, and it seems that the
> author of Net::Telnet is correct when he states in the docs:
> "Connecting to a Remote Win32 Machine
> ...
> One particularly nasty problem is a server that sends ANSI terminal escape
> sequences despite being told not to. These escape sequences make your job of
> parsing the data much more difficult. You can sometimes avoid this with a server
> that prompts you for console mode. Choose no to console mode."
>
> I looked at the telnet sessions I started with a packet analyser, and saw that
> the server always demands a terminal-type to be used and declared.
> As I recall, it will always use some sort of terminal-emulation, which means
> that no carriage returns or line feeds will ever be returned from the server,
> only escape-codes moving the cursor to the beginning of the next line.
> That seemed to be the cause of the problem.
>
> I experimented a while with sending back different IAC codes to turn off the
> terminal stuff, but I ran out of time and ended up using Kermit as client
> instead.
>
> You could try your luck with different third-party telnet servers, but don't
> waste your time on SeattleLabs Telnet, it has the same behaviour.
>
> I suggest you try Kermit, it handles all types of terminals, even bad ones:
> http://www.columbia.edu/kermit/
>
> Petri Oksanen



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

Date: Sat, 13 Jan 2001 22:46:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl crashes on exit
Message-Id: <cjm16ts3bsclcrqbugjf0ctrvifl8ilo0e@4ax.com>

Alan Pettigrew wrote:

>The program uses ODBC, and does (much abbreviated):
>   use DBI;
>   $dbh = DBI->connect(...);
>   $sth = $dbh->prepare(qq{SELECT ...});
>   $sth->execute;
>   
>If I put "exit 0;" before the prepare, all is well.
>If I put it after, the program crashes.

Question. IS this not one of those situations, where the module would
like you to clean up its objects yourself? In this case, I think the
method it would want you to use, is "disconnect".

-- 
	Bart.


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

Date: 13 Jan 2001 16:06:51 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: perlscript: can't figure out what's wrong
Message-Id: <979401908.21444@itz.pp.sci.fi>

In article <93pqlk$ess$1@mykenos.hogent.be>, Franky Claeys wrote:
>syntax error at test28dec.pl line 28, near "@($row"

  Wrong:  @($row)

  Right:  @{$row}

  Also right:  @$row

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post
 something, we discuss its implications.  If the discussion happens to
 answer a question you've asked, that's incidental." -- nobull in clpm



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

Date: Sat, 13 Jan 2001 17:02:30 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: perlscript: can't figure out what's wrong
Message-Id: <GS%76.264$Uz4.11364@eagle.america.net>

On Sat, 13 Jan 2001 16:02:52 +0100, Franky Claeys
<franky.claeys@vt4.net> wrote:
>I'm receiving the following message on my commandline:
>
>Script started on Fri Jan 12 16:59:55 2001
>[root@franky cgi-bin]# perl test28dec.pl
  ^^^^

Others have pointed out the syntax error.  I noticed another problem,
not in your script.  

-- 
Garry Williams


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

Date: 13 Jan 2001 16:43:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Problem with while loop regexp?
Message-Id: <93q0ke$opt$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
<mgjv@tradingpost.com.au>],
who wrote in article <slrn95vqle.50v.mgjv@martien.heliotrope.home>:
> The perlop documentation talks a bit about what /g does, and how it
> should be used. I'm not certain whether it actually wanrs you not to use
> nested /g modifiers with different regular expressions against the same
> string.

Using /g modifiers with different regular expressions against the same
string is the standard trick when parsing. But one needs to throw in
some //c too (when needed, one should decide it on a REx-by-REx
basis).  I do not follow what your "nested" actually means.

Ilya


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

Date: Sat, 13 Jan 2001 18:55:30 GMT
From: shiloam@my-deja.com
Subject: Replacing the "\" character in Perl.
Message-Id: <93q8b0$sfg$1@nnrp1.deja.com>

I desperately need to replace the "\" character in a string variable.

Does anyone know how to do this???

Steve Tilden


Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 13 Jan 2001 18:53:20 GMT
From: shiloam@my-deja.com
Subject: Replacing the "\" character using s///.
Message-Id: <93q86u$sdc$1@nnrp1.deja.com>

I am using ActivePerl, or Perl for Win32. And I
am creating an error log parser/analyzer I need
to find file names with the "\" in them and
replace it with the "/" character for opening
purposes. I am trying to use the $variable=~s///
syntax to do this and have had no luck.

Does anyone know a way to search a string for
this character and replace it?

Steve Tilden
shiloam@pacbell.net


Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 13 Jan 2001 14:23:59 -0500
From: "Art" <artd@artd3.com>
Subject: Re: Replacing the "\" character using s///.
Message-Id: <t61aqljj7mlgbc@corp.supernews.com>

#!/usr/bin/perl -w

use strict; # seems to make everyone happy :)

my $variable = 'c:\tellmemore\one';
print "Before: $variable\n";
$variable =~ tr/\\/\//;
print "After: $variable\n";


Hope this helps


From newbie to newbie.. of course other gracious list members will find all
the faults in my answer :)j

-Art

<shiloam@my-deja.com> wrote in message news:93q86u$sdc$1@nnrp1.deja.com...
> I am using ActivePerl, or Perl for Win32. And I
> am creating an error log parser/analyzer I need
> to find file names with the "\" in them and
> replace it with the "/" character for opening
> purposes. I am trying to use the $variable=~s///
> syntax to do this and have had no luck.
>
> Does anyone know a way to search a string for
> this character and replace it?
>
> Steve Tilden
> shiloam@pacbell.net
>
>
> Sent via Deja.com
> http://www.deja.com/




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

Date: Sat, 13 Jan 2001 19:35:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Replacing the "\" character using s///.
Message-Id: <x7snmn1c0h.fsf@home.sysarch.com>

>>>>> "A" == Art  <artd@artd3.com> writes:

  A> $variable =~ tr/\\/\//;

  A> From newbie to newbie.. of course other gracious list members will
  A> find all the faults in my answer :)j

well, it does work and it is decent but for one nit. it has leaning
toothpick syndrome. in general, when you backwhack a /, you should
choose a different delimiter. tr like all perl stringish ops lets you
select anyone you want. using {} or [] will make that expression much
easier to read:

	$variable =~ tr[\\][/] ;

doesn't that look much better?

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 13 Jan 2001 14:42:17 -0500
From: "Art" <artd@artd3.com>
Subject: Re: Replacing the "\" character using s///.
Message-Id: <t61bsv2a13djf5@corp.supernews.com>

Much :)

"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7snmn1c0h.fsf@home.sysarch.com...
> >>>>> "A" == Art  <artd@artd3.com> writes:
>
>   A> $variable =~ tr/\\/\//;
>
>   A> From newbie to newbie.. of course other gracious list members will
>   A> find all the faults in my answer :)j
>
> well, it does work and it is decent but for one nit. it has leaning
> toothpick syndrome. in general, when you backwhack a /, you should
> choose a different delimiter. tr like all perl stringish ops lets you
> select anyone you want. using {} or [] will make that expression much
> easier to read:
>
> $variable =~ tr[\\][/] ;
>
> doesn't that look much better?
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page  -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net  ----------
http://www.northernlight.com




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

Date: Sat, 13 Jan 2001 16:49:56 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: socket send to client problem
Message-Id: <UG%76.263$Uz4.11211@eagle.america.net>

On Fri, 12 Jan 2001 17:06:04 -0000, Chris Stith
<mischief@velma.motion.net> wrote:
>Garry Williams <garry@zvolve.com> wrote:

[snip]

>I always use blocking sockets and select. I test for the socket being
>open, then write to it. 

Does this mean that you use select() to `test for the socket being
open'?  

My point was that this is not the way to `test for the socket being
open'.  Only a non-blocking read on a socket can answer that question.  

[snip]

>> But the original question is wrong.  Checking before writing creates a
>> race condition.
>
>A race condition and then an error recovery is still better than relying
>on error recovery more often, isn't it? 

I can't see why.  Since the error can occur with or without the check,
why do it in the first place?  

>I write error recovery into my
>software, but I try to cause as few error conditions as possible.

The OP wanted to know what to do, if the client closes a socket before
the server writes to it.  Handle the exception.  *You're* not causing
an error.  Writing code that won't solve the problem serves only to
obfuscate.  

-- 
Garry Williams


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

Date: Sat, 13 Jan 2001 22:56:45 GMT
From: Jim Britain <jbritain@home.com>
Subject: Trouble with range operator and unitialized variable.
Message-Id: <TtZgOhNhJyr1gJgfIrZoqpfnqwzr@4ax.com>

I've been messing with this for a long long time.
Just what am I doing wrong?

(the particular block I am searching for in the input text file is
somwhere around line 300 of a 350 - 450 line file.  The file may
contain blank lines, character set is limited to US-ASCII 7 bit)


Error: 
Use of uninitialized value in pattern match (m//) at ./proto_top.pl
line 25.
#!/usr/bin/perl -w
 #@#
 use strict;
 use Carp;
 sub readfile{
         my ( $file_name ) = @_ ;
         my( $text, @lines ) ;
         local( *FH ) ;
         open( FH, $file_name ) || carp "cant open '$file_name' $!" ;
         if ( wantarray ) {
                @lines = <FH> ;
                close( FH ) ;
                return @lines ;
         }
         local( $/ ) ;
         $text = <FH> ;
         close( FH ) ;
         return( $text ) ;
 }

 use vars qw(@text );
 @text=readfile ("/bulletins/general");

 my $line;
 foreach $line (@text){

        if ($line =~ /LAST ISSUE/ .. /TOP 20/){ # error here ( line 25)
                print $line;
        }
 }




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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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