[7038] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 663 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 17:17:20 1997

Date: Wed, 25 Jun 97 14:00:25 -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, 25 Jun 1997     Volume: 8 Number: 663

Today's topics:
     associative array I/O to file <john@edm.net>
     Can't use an undefined value as a hash ref. - prob. usi x@apocalypse.org
     Re: char to hex conversion <sfairey@adc.metrica.co.uk>
     Client-Side Execution <ericzim@kodak.com>
     Detecting dead client sockets <g-fast@ux8.cso.uiuc.edu>
     Re: Editor for Perl on Unix box (M. muPe)
     Executing from command line to simulate the web transac (Chris Lott)
     Help me to find my loose change !!! <info@welnet.co.uk>
     Re: Magical Auto-increment operator <robp@electriciti.com>
     Re: Makefile.pl Without Perl Sources Installed <merlyn@stonehenge.com>
     NEWBIE Parsing question <ashfield.matthew@miti.nb.ca>
     Pattern-matching when strings have embedded "$" (Charles Packer)
     Re: Perl script retrieving URL's <sfairey@adc.metrica.co.uk>
     Perl Xstub PROBLEM, HELP!!! (Matthew Mac Gibbon)
     Re: regexp needed <esupu@warwick.ac.uk>
     Retreive html document by PERL <chiyung@b1.hkstar.com>
     Re: set-u-id perl script <garye@iname.com>
     Sorting names with accents (Georges Martineau)
     Re: Strings to Associative Arrays <ajohnson@gpu.srv.ualberta.ca>
     swish-web.cgi exhibiting strange problem (Chris Lott)
     tarring a subdir as user nobody from perl <r.li@srs.gov>
     uninitialized value warning for "truth condition" <dwrice@ampere.mbi.ucla.edu>
     Unwanted Output from script need help!! <alastair@redboxad.demon.co.uk>
     Re: Use and code in 2 files <garye@iname.com>
     use HTTP to get a dir? (Shawn Laemmrich)
     Re: Validating E-Mail addresses and URL's (Mark Thompson)
     Re: What does <<END do? <tony@peregrinco.com>
     Re: What does <<END do? (Tim  Smith)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 25 Jun 1997 13:27:17 -0700
From: John Grimm <john@edm.net>
Subject: associative array I/O to file
Message-Id: <33B17F25.3E28@edm.net>

Hello,

I am new to perl.  I have a cgi that collects from an HTML form about
144 fields.  cgi-lib parses them into an associative array named $in. 
How can I output the whole array at once, and read it in again for later
use?

Thanks


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

Date: Wed, 25 Jun 1997 10:13:45 -0600
From: x@apocalypse.org
Subject: Can't use an undefined value as a hash ref. - prob. using variable with OLE/Excel
Message-Id: <867250929.22824@dejanews.com>

I'm trying to use a variable to set an excel cell's coordinates,
but am getting the following error:

"Can't use an undefined value as a HASH reference"

What's wrong? Well, I know what's wrong... I'm not trying to
reference a key element... I just want to put a plain old scalar
in Range().

Here's the code fragment:

$cell = "A$counter";
$worksheet->Range("$cell")->{'Value'} = $rand;

Here's all the code:

use OLE;
$application = CreateObject OLE 'Excel.Application' || die $!;
$application->{'Visible'} = 1;

$workbook = $application->Workbooks->Open ("C:\\perldev\\dude.xls");
$worksheet = $workbook->Worksheets(1);

open(FILE, "C:\\perldev\\dude.count");
$counter = <FILE>;
close(FILE);
$counter++;

srand();
$rand = int(rand 100)+1;

$cell = "A$counter";
$worksheet->Range("$cell")->{'Value'} = $rand;

open(FILE, ">C:\\perldev\\dude.count");
print FILE "$counter\n";
close(FILE);

sleep 5;

$application->ActiveWorkbook->Save();
$application->ActiveWorkbook->Close(0);
$application->Quit();

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 25 Jun 1997 10:20:12 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: kowald <Dennis.Kowalski@DaytonOH.NCR.com>
Subject: Re: char to hex conversion
Message-Id: <33B0E2CC.794B@adc.metrica.co.uk>

Dennis Kowalski wrote:
> 
> Can anyone tell me how to convert a character to it's hex
> representation ??
> 
> For example
> 
>   a = 61
>   A = 41
> 
> I have tried the following ways
> 
> $x="a";
> $y = hex($x);
> 
> $y gets decimal 10;
> 
> I have also tried
> 
> printf "%x", $x;
> 
> and it prints 0
> 
> Thank You

Try

perl -e 'printf "a = %x\nA = %x\n", ord('a'), ord('A');'

Have fun.

Simon

BTW: If you want to assign it to a variable then just use sprintf()
instead.


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

Date: Wed, 25 Jun 1997 09:37:22 -0400
From: Eric Zimmerman <ericzim@kodak.com>
Subject: Client-Side Execution
Message-Id: <33B11F12.864@kodak.com>

I'm using the CGI.pm as a server-side library to interpret forms input.
>From my CGI server-side script, I am now interested in "calling" / 
"launching" an executable program that resides on the hard-drive of
the browser client that kicked-off my CGI script.

I've heard rumblings that Libwww-perl might be able to do this, but
I'm not sure if my request is do-able, without going to a client-side
language such as JAVA.  I'd love to stay with Perl 5 if possible.

By the way, I'm using:	IIS 2.0, WinNT 4.0 and Perl.exe for Win32

Much thanks for any help,

Eric Zimmerman
(ericzim@kodak.com)


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

Date: 25 Jun 1997 13:08:53 -0500
From: gregory douglas fast <g-fast@ux8.cso.uiuc.edu>
Subject: Detecting dead client sockets
Message-Id: <m7g90zyd07e.fsf@ux8.cso.uiuc.edu>

I'm writing a server which keeps an eye its status, and periodically
sends a message indicating that status to a indeterminite (but
smallish) number of clients.  It keeps track of the connected clients
with a list of IO::Handles.  In order to do this, I've set the socket 
the server sits on to non-blocking so that I can just try to accept()
every couple of seconds instead of waiting indefinitely for connections.

I'm trying to come up with a good way of testing whether or not a
client is still there.  The second form of select() doesn't seem to
return anything useful, and read() and sysread() both seem to block
until they have something to read regardless of whether or not the
socket and clients are set to non-blocking.

This is the method I'm currently using to detect dead clients:

   #--- send message to clients ---
   $SIG{PIPE} = sub { $pipefail = 1 };
   for($i=0;$i<@clients;$i++) {
     $pipefail = 0;
     print {$clients[$i]} "PROST!\n";
     undef($clients[$i]) if $pipefail;
   }
   $SIG{PIPE} = 'DEFAULT';
   #--- remove dead bodies ---
   $i = scalar(@clients);
   while($i--) {
     $x = shift(@clients);
     push(@clients, $x) if defined($x);
   }

This doesn't seem like the most efficient way to do this...  Does
anyone have any suggestions?  I'm more familiar with doing this kind
of thing in perl than in c, so I may be missing the obvious and
canonical way of Doing Things.

-- 
--  Greg Fast ---  g-fast@uiuc.edu -------------------------------------------
"...While I had often said that I wanted to die in bed what I really meant was
that in my old age I wanted to be stepped on by an elephant while making love."
             -- Roger Zelazney, _The Guns of Avalon_
------------------------------------------------------------------------------


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

Date: Wed, 25 Jun 1997 21:06:14 GMT
From: mupe@desk.nl (M. muPe)
Subject: Re: Editor for Perl on Unix box
Message-Id: <5ortt9$brr$2@news2.xs4all.nl>

In article <33A248F1.51B3@sj.bigger.net>, raymond@sj.bigger.net wrote:
>Does anyone know of a good programmer's editor for Perl on a Unix box? I
>am trying to find one with a graphical user interface or has at some
>color-syntaxing, such as for comments and keywords. Since Perl has some
>keywords that are similar to other languages, an editor in an ide for a
>different computer language might work also.
>

Besides the serious advice already found in this threat; As a ms Win refugee
I found Ted and Nedit for X-win quite easy to adept to for programming.
 x-coral is also worth while to take into consideration.

Mathilde muPe

 






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

Date: Wed, 25 Jun 1997 18:32:58 GMT
From: eclectic@polarnet.com (Chris Lott)
Subject: Executing from command line to simulate the web transaction
Message-Id: <33b363fd.222475713@news.polarnet.com>


I've tried figuring it out from MAN pages and other resources, but I
can't figure out how to execute a cgi script from the command line in
a way which simulates being run from the web, ie passing a
variable/keyword to the perl program that does a search. Is there some
simple way to do this?

I apologize if this is a dumb question...

c

--
Chris Lott
eclectic@polarnet.com
Editor, Eclectica Magazine 
http://www2.polarnet.com/~eclectica
              "Elite reading available to all..."




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

Date: 25 Jun 1997 18:08:27 GMT
From: "Martin Williams" <info@welnet.co.uk>
Subject: Help me to find my loose change !!!
Message-Id: <01bc8193$db5e57a0$83a426a4@notebook.dixons.co.uk>

I have written a few scripts that procee financial transactions but thus
far I have been unable to round my numbers up to 2 decimal places !!!

Please help me as I think I'm going crazy.


Martin Williams


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

Date: Wed, 25 Jun 1997 12:17:05 -0700
From: Rob Perelman <robp@electriciti.com>
Subject: Re: Magical Auto-increment operator
Message-Id: <Pine.SUN.3.91.970625115257.10021A-100000@circuit>

Sorry I took so long to respond...I wanted to ponder on your comments.

On Sat, 14 Jun 1997, Tom Phoenix wrote:

> > >   1. If the argument has already been used as a number,
> > >      or if the first character is in [\d\-\s+.] , or
> > >      if no character is in [A-Za-z0-9], then
> > >      increment it as a number.
> > 
> > My regex was a little different.  It was /^\s*[-+]?\s*\.?\d/ for it to be 
> > incremented as a number.  This way the digit is necessary in the string.  
> 
> Well, I wrote the rule that way both for simplicity and to speed things
> up. It's pretty fast for non-magical incrementing, because we can go
> directly to the speedy numeric increment after examining the first
> character of the string. If you want to add other numeric cases after
> checking the first character, that would have little impact, though.

Personally, I'd take the performance hit to make sure the argument is a 
number so that '.' would be able to incrementing to '..' and not 1 as 
well as '..e1' incrementing to '..e2' instead of 1.  I can definitely be 
flexible on this, but I think the overhead for checking more than the 
first digit is worth it to be able to have strange strings being 
magically incremented.

> > Also, I don't see a reason for the second half concerning the
> > auto-increment.  I don't want '#' to increment to 1, I want it to
> > increment to '0#', personally.  I can't think of a practical use for it,
> > but it seems more useful than 1. 
> 
> Well, if there's no practical use for it, it belongs in Java instead of
> Perl. :-)  Seriously, I don't see any reason to allow that. (And wouldn't
> that mean that "\n" would increment to "1\n"? I'm sure that would break
> something.)

Not really.  The code I have written allows '#' to be incremented to 
'##', but still allows "\n" to be incremented to 1 as Perl does 
currently.  I will attach the code below to show what we have discussed 
in our messages back and forth.

> > my implementation did not always prepend a '1' to the string; it would
> > take into consideration the leftmost digit and use that to extend the
> > string.  Therefore, if after changing the leftmost digit from a 'z' to
> > an 'a', it would prepend an 'a'.  The same would hold for each of the
> > ranges.  So 'zz' would become 'aaa', 'ZZ' would become 'AAA', and '9a'
> > would become '10a'. 
> 
> My implementation idea had a bug: We can't prepend a '1', since the next
> iteration would see that as a numeric value! So prepending either 'a' or
> 'A' at overflow sounds much more reasonable now. 

Further, that's what Perl does currently, so I figured we should keep it 
like that.

> So, could you write up the new rule as it would have to appear in the
> documentation? I'd like to see something concise and unambiguous which
> illuminates the exact behavior and the contrast with the current behavior.
> Also, can you show in what way the world will be better off with this
> implemented in the Perl core rather than (say) in a module? (The module
> would almost certainly require different calling syntax, of course, but it
> would be much less likely to break anything.) 

I'm terrible at writing documentation, but I will.  However, I still
believe more discussion is necessary.  Below is the code for what we have
discussed.  The only items that are still in debate are the last 5.  I say
'a1z9' should be 'a2a0' while Perl says 1.  I don't think I've gotten your
comments on this case.  As for 'cats 12', I believe you agreed it should
be incremented automagically to 'cats 13' instead of 1, but I am not
positive.  And demonstrating the multi-character numeric check, I think
'..e1' and '.' should be incremented to '..e2' and '..' respectively, but
the one-character numeric check increments those to 1.  Lastly, I think
'#' should increment to '##', but I believe you want it to be 1.  Let me
know your thoughts on these. 

#!/usr/local/bin/perl

foreach (qw/0 99 z Z fh09 fh99 -7 3.14159 3.14160 1e1/, '',
         "123\n", '12 cats', '3/9', '9z', '1a9z', "\n",
         'cs2#09', 'cs2#99', 'a1z9', 'cats 12',
         '..e1', '.', '#') {
  $arg = $_;
  printf("Testing %-10s   I say %-10s   Perl says %-10s  Matches? %s\n",
    "'$arg'", $test = plusplus($arg), ++$arg, $test eq $arg ? 'Yes' : 'No');
}

sub plusplus {
  my($arg, $pos, $last) = (shift, length($arg));
  return $arg + 1  if ($arg =~ /^[\.\+\-\d\s]/); # Check for a number
  while ($pos--) { substr($arg, $pos, 1) = chr(ord($last) + 1), return $arg
    unless (($last = substr($arg, $pos, 1)) eq '9' or lc $last eq 'z' or
      $last !~ /^\w$/);
    substr($arg, $pos, 1) = $last = chr(ord($last) - ($last eq '9' ? 9 : 25))
      if ($last =~ /^\w$/);
  }
  return (($last =~ /\D/ ? $last : '1') . $arg);
}

--------------------------------------------------------------------------
 Rob Perelman          robp@eciti.com    http://www.eciti.com/robp/
 San Diego Rocks    sdrocks@eciti.com    http://www.eciti.com/sdrocks/
 Alphabet Records  alphabet@punketc.com  http://www.punketc.com/alphabet/
--------------------------------------------------------------------------




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

Date: 25 Jun 1997 08:25:36 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: shelle@interaccess.com (Shelle)
Subject: Re: Makefile.pl Without Perl Sources Installed
Message-Id: <8cn2oeaemn.fsf@gadget.cscaper.com>

>>>>> "Shelle" == Shelle  <shelle@interaccess.com> writes:

Shelle> I haven't seen anything here about this problem; Since I
Shelle> installed Perl from the pre-compiled sources, I have a problem
Shelle> running the "makefile.pl"s as they nees access to Perl.h.

If you installed Perl from pre-compiled sources that did not include
perl.h down in the lib area, then your pre-compiled sources are
incomplete.

Shelle> Other than completely reinstalling Perl is there a way to add
Shelle> those necessary files without screwing over my current config?

Not unless you can get them from whomever "pre-compiled" perl for you.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 433 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 25 Jun 1997 13:12:20 GMT
From: "mashfiel" <ashfield.matthew@miti.nb.ca>
Subject: NEWBIE Parsing question
Message-Id: <01bc809f$c4e61660$3e080a0a@mashfiel.miti.nb.ca>

Hi, sorry if this so very basic, but just thought I'd check here first. I
am new to the PERL environment and am learning it because I need a language
that handles parsing rather easily. Basically I have a text file with 5
varying-lenght columns of numerical data. Just wondering if anybody could
give me a hint as to how I would parse this file? Note: There are 600 rows
contained within it. Anyway, anybody who has any friendly help/advice, I'd
very much appreciate hearing from you preferably via email at
ashfield.matthew@miti.nb.ca

Thanks for your time,

Matt
ashfield.matthew@miti.nb.ca


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

Date: 25 Jun 1997 19:56:18 GMT
From: packer@fermi.gsfc.nasa.gov (Charles Packer)
Subject: Pattern-matching when strings have embedded "$"
Message-Id: <5ort52$e3e@post.gsfc.nasa.gov>


I have an array @whole in which each element is a line of text.
I do pattern matching on the lines of text with expressions such
as

	if (@whole[$K] =~ @whole[$J])
	
I've discovered that if these text lines have embedded dollar
signs, such as "it cost $3.5 million", I don't get a match
when the two strings are, in fact, identical. I didn't find
anything in the various Perl FAQs that addressed this question.
I hope I don't have to create two temporary variables stripped
of "$" to do the match, 'cause it would slow down my program, no?


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

Date: Wed, 25 Jun 1997 10:25:11 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: obp@onlinebp.com
Subject: Re: Perl script retrieving URL's
Message-Id: <33B0E3F7.15FB@adc.metrica.co.uk>

Ivo Bieleveldt wrote:
> 
> Hi All,
> 
> Does anyone of a perl script that allows you to retrieve WWW pages. I
> want to make a list of URLS, store these URL's in a seperate file.
> Then I want to let the Perl script retrieve the first URL and store
> the output in a seperate file and so on until the last URL.
> 
> I haven't found an application like this.
> 
> Thanks for your help !
> 
> Ivo Bieleveldt
> 
> ---------------------------------
> Online Business Productions
> ** abonneer nu op Nettips !! **
> http://www.onlinebp.com/

You could try using the very useful 'GET' script which, if I am not
mistaken, comes with the libwww module.

Simon


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

Date: 25 Jun 1997 16:37:10 -0400
From: mirtos@panix.com (Matthew Mac Gibbon)
Subject: Perl Xstub PROBLEM, HELP!!!
Message-Id: <5orvhm$e9e@panix2.panix.com>

HELP!!!!! I've tried every which way but i cannot get perl XStubs to work.
Every time, i create the make file, but it bombs on the compile, giving me
an error of 

Mytest.xs:13: `Mytest' undeclared here (not in a function)
Mytest.xs:13: parse error before `PACKAGE'
*** Error code 1
make: Fatal error: Command failed for target `Mytest.o'

Its basically confused on what to do with the MODULE

anyway here are my Makefile.PL, My Mytest.pm, Mytest.xs -- could ANYONE
give me a hand?  (if at all possible email would be preferred, often this
newgroup scrolls before i can read all the messages... )

(either here, or at matt@corp.airmedia.com)

I seriously appreciate ANY help...

these files are basic...so if someone can tell em what im doing wrong,
that would be great...

---------------------------------------------------------------
Makefile.PL:
#!/usr/bin/perl   
use ExtUtils::MakeMaker;
        # See lib/ExtUtils/MakeMaker.pm for details of how to influence
        # the contents of the Makefile that is written.
        WriteMakefile(
            'NAME'      => 'Mytest',
            'VERSION_FROM' => 'Mytest.pm', # finds $VERSION
            'LIBS'      => [''],   # e.g., '-lm'
            'DEFINE'    => '',     # e.g., '-DHAVE_SOMETHING'
            'INC'       => '',     # e.g., '-I/usr/include/other'
        );

Mytest.xs:
        #ifdef __cplusplus
        extern "C" {
        #include <EXTERN.h>
        #include <perl.h>
        #include <XSUB.h>
        #include <rpc/rpc.h> 
       } 
        #endif
     

     MODULE = Mytest  PACKAGE = Mytest

      void
        hello() 
        CODE:
                printf("Hello, world!\n");

Mytest.pm:
package Mytest;         
require Exporter;
        require DynaLoader;
        @ISA = qw(Exporter DynaLoader);
        # Items to export into callers namespace by default. Note: do not
export
        # names by default without a very good reason. Use EXPORT_OK
instead.
        # Do not simply export all your public
functions/methods/constants.
        @EXPORT = qw(
        );
        $VERSION = '0.01';
        bootstrap Mytest $VERSION;
        # Preloaded methods go here.
        # Autoload methods go after __END__, and are processed by the
autosplit 
program.
        1;
        __END__
        # Below is the stub of documentation for your module. You better
edit it
!

------------------
Basically this is right off of the website....but it doesnt work for me.
compiler is gcc v. 2.7.2.1, Solaris 2.5
Perl Version 5.004

TIA

Matt Mac Gibbon





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

Date: Wed, 25 Jun 1997 16:51:40 +0100
From: mike mah <esupu@warwick.ac.uk>
To: webadmin <webadmin@prestel.net>
Subject: Re: regexp needed
Message-Id: <Pine.SOL.3.95.970625164626.27669A-100000@holly>

On Thu, 12 Jun 1997, webadmin wrote:

|
|I have the following line
|
|www.domain.co.uk,   19.87  6.03       253526      153 | /
|
|I need to split it. the thing is that I have several lines, but the no.
|of spaces in between the elements variies, so I can't have a fixed
|split. The number I am interested in getting is the one before the pipe
|symbol.
|
|How can i get this. 
	you can initialise an array (each line as a element). 
for each element, split it into an array( say @a=split(/\s/, $_(or
other))).then take $a[4];

	Hope this answer your question.	

--
Yours sincerely,
Mike Mah
First year computer systems engineering student.
University of Warwick
http://www.warwick.ac.uk/~esupu
 



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

Date: Wed, 25 Jun 1997 16:02:19 +0800
From: Aldoliu Chan <chiyung@b1.hkstar.com>
Subject: Retreive html document by PERL
Message-Id: <Pine.SOL.3.95.970625155600.12238A-100000@b1.hkstar.com>

Hi,
   Is there a http module for PERL? I think it help me simply the work
b'cos now i get the html document by telnetting to the port 80 of the host
and send "GET" method to it. Thanks for any help!    

Cheers,
Aldoliu Chan 
==========================================================================
Senior Programmer                           e-mail: aldoliu@mailhost.net 
Citybus Limited                                     chiyung@hkstar.com
(HONG KONG)                                         isbyron@citybus.com.hk



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

Date: Wed, 25 Jun 1997 16:37:33 -0400
From: Gary Ebert <garye@iname.com>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: set-u-id perl script
Message-Id: <33B1818D.2725@iname.com>

Russ Allbery wrote:
> 
> [ Posted and mailed. ]
> 
> Yuan-fang Wang <yfwang@cs.ucsb.edu> writes:
> 
> > However, the same script which runs fine as WWW developed problems when
> > runs as me through the above set-u-id mechanism. I traced the problem to
> > a line which says:
> 
> > $date = `date`;
> 
> > In fact, any line which use `` (backquote) does work. I suspect this
> > might be some protection problem. Any one has any experience with this
> > problem?

You are not using
use strict;
use diagnostics;
are you??

Seriously though this will help you answer your own question.

BTW since I started using "use strict" and "use diagnostics"
(b/c someone here recommended that I do so (or was it the FAQ))
I think I have only posted one question to this group.

[snip]

	hope this helps,
			Gary
-- 
Gary Ebert                                 Operations Administrator
Voice:     (301) 428-2115                  Mobile Datacom Corporation
Fax:       (301) 428-1004                  19540 Amaranth Drive
Pager:     (800) 490-7478                  Germantown, MD  20875-2126


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

Date: 25 Jun 1997 17:46:17 GMT
From: martig@cam.org (Georges Martineau)
Subject: Sorting names with accents
Message-Id: <5orlh9$rg8@tandem.CAM.ORG>

Is it possible to sort the following names:
  Manon, Milissa, Micheline, John, Milanie

Many thanks



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

Date: Tue, 24 Jun 1997 02:06:23 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Strings to Associative Arrays
Message-Id: <33AF71EF.AE3B036@gpu.srv.ualberta.ca>

! Hello,
! 
! I am receiving a string which I would like to assign to an
! associative array as quickly as possible (IE. without
! assigning individually)
! 
! I have read that you can define an associative array as the
! value of a scalar eg;
! 
! $test = "One,1,Two,2,Three,3";
! %testa = $test;
! 
! $value = "One";
! print $testa{$value);
! 
! But this responds with no value.
! 
! Am I suffering from Monday Madness or can't this be done in
! this way? Any help would be gratefully appreciated!

your $test string is a scalar, you'll need to split it
into a list of elements:

$test = "One,1,Two,2,Three,3";
%testa = split /,/,$test;
$value = "Two";
print $testa{$value};

should work fine, so long as you are sure your string will always
contain paired elements.

regards
andrew


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

Date: Wed, 25 Jun 1997 18:30:59 GMT
From: eclectic@polarnet.com (Chris Lott)
Subject: swish-web.cgi exhibiting strange problem
Message-Id: <33b26398.222374574@news.polarnet.com>


I am looking for anyone who is using/has used swish-web.cgi with
swish-- I am having a seemingly irresolvable problem that results in
an empty result list...

c

--
Chris Lott
eclectic@polarnet.com
Editor, Eclectica Magazine 
http://www2.polarnet.com/~eclectica
              "Elite reading available to all..."




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

Date: 25 Jun 97 15:38:32 -0500
From: Richard Li <r.li@srs.gov>
Subject: tarring a subdir as user nobody from perl
Message-Id: <1997Jun25.153832.9159@srs.gov>

hi,

i am trying to tar a particular subdir as part of a cgi. using an
anonymous pipe:

open ($fh, "| tar cf /work/foo_tar ./foo")
	or die "sorry. this didn't work. $!";

works only if i run the script after logging in. i suspect that the
reason why the exact same code doesn't work in the cgi is because i am
user nobody. does anyone know how to get this working? i've tried to
brute-force and source a .login file and tried exec and system, but
can't figure it out...

thanks,

richard


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

Date: 25 Jun 1997 03:23:43 +0200
From: Danny Rice <dwrice@ampere.mbi.ucla.edu>
Subject: uninitialized value warning for "truth condition"
Message-Id: <6phgen8ogw.fsf@ampere.mbi.ucla.edu>


I keep getting the "Use of uninitialized value at program.pl line
XXX." warning, while using the -w switch.  The complaint is coming
from an IF (truth condition).  If the (truth condition) evaluates to 0
I get the warning.  I have replaced "truth condition" with simply 0
and still get the warning.  With 1 I get no warning.  I know that you
can uninitialize a scalar by assinging it "" or "0", but this is just
the "truth condition".  What's going on?

-- 
Danny W. Rice
http://www.doe-mbi.ucla.edu/people/dwrice/dwrice.html


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

Date: Wed, 25 Jun 1997 15:10:50 +0100
From: alastair brown <alastair@redboxad.demon.co.uk>
Subject: Unwanted Output from script need help!!
Message-Id: <33B126EA.5F05@redboxad.demon.co.uk>

Hi There,

I need a bit of help with a perl script that I am writing in PERL5 on an
NT server running MS IIS. 

The script that I'm having trouble with writes data to a file when
called from a HTML page. The problem I have is that because it returns
no output ie this process goes on behind the scenes. The PERL
interpreter returns the message

'D:\wwwroot\b82\cgi-bin\add_to_basket.perl' script produced no output 

Does anyone know if there is a way to get rid of this message.

If someone could advise me I would be greatful 

Thanks in advance

Alastair Brown


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

Date: Wed, 25 Jun 1997 16:26:52 -0400
From: Gary Ebert <garye@iname.com>
To: beryte <beryte@leb.net>
Subject: Re: Use and code in 2 files
Message-Id: <33B17F0C.7AC9@iname.com>

beryte wrote:
[snip]

> >> All I reall want to do is be able to call a
> >>function in a different file.
[snip]

Because there is always more than one way to do it you could try the
following.

package test;

> >   Script1: test.conf

      Script1: test.pm

> >
> >       sub HTMLHeader{
> >           return "Content-type: text/html\n\n";
> >        }
> 1;



> 
> >
> >   Script2: test.pl
> >
> >       #!/path/to/perl
> >       require '/full/path/to/test.conf';

          replace above line with:
          use test;	# if test.pm's directory is in the @INC
          use path::to::file:named::test;	# if it isn't
> >       print &HTMLHeader;

          replace above with
          print &test::HTMLHeader

> >       print "Hello there!";
> >       exit;
> >
> >
> >again, only if you are just thinking in spliting your code...
> >
> >beryte
> >

I am not trying to say that the first 2 suggestions are wrong.  This is
just the way I usually do it.

	Hope this helps,
			Gary
-- 
Gary Ebert                                 Operations Administrator
Voice:     (301) 428-2115                  Mobile Datacom Corporation
Fax:       (301) 428-1004                  19540 Amaranth Drive
Pager:     (800) 490-7478                  Germantown, MD  20875-2126


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

Date: 25 Jun 1997 15:16:34 -0400
From: swlaemmr@mtu.edu (Shawn Laemmrich)
Subject: use HTTP to get a dir?
Message-Id: <5orqqi$66@dilbert.tdg.mtu.edu>


I'm wondering if anyone has some perl (or anything else for that matter)
code to go to a web site and get the contents of a directory, like so:

http_get www.blah.com/pub/files

and have it get everything in the dir.


Anyone have any ideas?

Thanks

Shawn


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

Date: Wed, 25 Jun 1997 18:03:18 GMT
From: mwt@cyberg8t.com (Mark Thompson)
Subject: Re: Validating E-Mail addresses and URL's
Message-Id: <33b25c10.12324778@news.alt.net>

On 24 Jun 1997 23:59:54 GMT, nvp@shore.net (Nathan V. Patwardhan)
wrote:

>Mark Thompson (mwt@cyberg8t.com) wrote:
>
>: I'm writing a program and need to validate e-mail addresses and URLs
>: to make sure they're correct.
>
>*sigh*
>
>This thread just raged on for the last two weeks after a week's break
>and a month's raging on before that.  I'm not trying to yell at you,
>but it would be *extremely* courteous of you to check
>http://www.dejanews.com or the Perl FAQ (http://www.perl.com/FAQ/) 
>before posting.  In other words, email address verification questions
>come up *so* frequently it's apparent that the people who keep asking 
>these questions aren't doing their research before posting.
>
>In terms of the URL verification, I believe that you'll want to use
>the LWP package, available at a CPAN near you:
>
>http://www.perl.com/CPAN/modules/by-module/LWP/

Actually, I had looked at the FAQ's that I could find (there seems to
be several Perl FAQ's.  Eventually someone pointed me to an article
that helped a bit.  The suggestion of Dejanews that someone e-mailed
me helped the most (I use Dejanews for other stuff, never really made
the connection, DUH) and I found a code snippit by Clay Irving that
helped in the checking of the syntax of e-mail addresses which I
converted to Perl 4 (there's other code that we have that won't run in
Perl 5.)

I'll probably end up modifying the code to check the syntax of URL's,
but if someone else has some already, could you please e-mail it to me
or post it?

I saw the thread when I looked in Dejanews, some people take their
Perl debates *way too seriously* :) :) :)

Thanks,

Mark




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

Date: Wed, 25 Jun 1997 11:57:38 -0700
From: Tony McCormick <tony@peregrinco.com>
Subject: Re: What does <<END do?
Message-Id: <33B16A22.A42E7C00@peregrinco.com>

Wade Williams wrote:
> 
>        sub print_tail {
>           print <<END;
>         <HR>
>         <ADDRESS>Lincoln D. Stein</ADDRESS><BR>
>         <A HREF="/">Home Page</A>
>         END
>         }
> 
> In the above code, I can surmise that the "print <<END" line says
> "Print
> until you reach an END."  Is that correct?
> 
> If so, why do I get:
> 
> Can't find string terminator "END" anywhere before EOF at ./test.cgi
> line 77.
> 
> Sorry for the newbieness of the question, but I wasn't able to find
> any
> documentation on the use of END.
> 
> Wade
> 
> --
> 
> 

The 'END' is a label and in my experience it needs to be
at left margin and have no trailing white space or the parser
won't see it.
 
-- 
Tony McCormick, Systems Analyst      (503) 690-1111
mailto://tony@peregrinco.com  or http://www.rdrop.com/~tonymcc
-- "Blink your eyelids periodically to lubricate your eyes."
from the HP "Environmental, Health & Safety Handbook for Employees." --


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

Date: 25 Jun 1997 13:23:59 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: What does <<END do?
Message-Id: <5oruov$rf0@web.azstarnet.com>

In article <33B13A29.6956@adc.metrica.co.uk>,
Simon Fairey  <sfairey@adc.metrica.co.uk> wrote:
>
>Afterthought: Try looking into file and i/o redirection as that is what
>it is essentially doing.

It's actually a (string) quoting mechanism.  See pg. 43 of the Blue Camel.

$qualifier = 'essentially';
@subjects = ('file redirection', 'i/o redirection');

$str = <<"EOS";
This string has $qualifier nothing to do with
@{[join(' or ', @subjects)]}.
EOS

die $str, "\n";

Enjoy,

Tim



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 663
*************************************

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