[17649] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5069 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 9 00:05:30 2000

Date: Fri, 8 Dec 2000 21:05:08 -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: <976338308-v9-i5069@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Dec 2000     Volume: 9 Number: 5069

Today's topics:
    Re: "open" and file cache <bwalton@rochester.rr.com>
    Re: about call excutable program with system() <bwalton@rochester.rr.com>
        Anything wrong with this code? (Fryar386)
        career advice needed (language? platform?) joemorris101@my-deja.com
    Re: Does it matter? (Fryar386)
    Re: dynamic require & new on variable package <bwalton@rochester.rr.com>
        File writing problem <edd@texscene.com>
    Re: formresults at another page than cgi-page (David Efflandt)
        HELP PLEASE! (Fryar386)
    Re: How do I find out my own IP Address? <bwalton@rochester.rr.com>
    Re: How to Exit from Inner Loop ??? cwang9@yahoo.com
    Re: How to Exit from Inner Loop ??? <mjcarman@home.com>
    Re: Modules in MS-DOS <mjcarman@home.com>
    Re: multi keyed hash or array (Eric Bohlman)
    Re: Newbie Perl CGI and Netscape Prob (David Efflandt)
    Re: parsing canned response (David Efflandt)
    Re: parsing canned response (David Efflandt)
    Re: Perl Help with LWP <hayes@sympatico.ca>
    Re: PLEASE CHECK MY CODING! (Fryar386)
    Re: sorting an array of hashes <hayes@sympatico.ca>
    Re: sorting an array of hashes <kip@skiltrip.com>
    Re: Uploading file via CGI (David Efflandt)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 09 Dec 2000 03:25:33 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: "open" and file cache
Message-Id: <3A31A6CF.32FFD020@rochester.rr.com>

rs232 wrote:
 ...
> I noticed the following symptom under Linux Redhat 7.0:
> 
> My perlscript reads every 5 seconds a file
> If I delete this file it reads it anyway.
> 
> Only if I restart the script it notices that the file doesn't extists.
> 
> I want to update the file through another program. But if the perl script
> doesn't check the existenz of the file how can it read the file actual
> contents ?
> 
> My config:
> Linux Redhat 7.0
> The File which should be read is on a Windows NT Server (mounted via
> mount -t smbfs....)
> 
> Probably this has nothing do with perl rather than with the linux file cache
> ?
 ...
> rs232
Well, if you are simultaneously accessing a file for write with more
than one process without first establishing a cooperative lock, you are
asking for all sorts of trouble unless you take special measures such as
assuring that each process only writes to its own piece of the file,
etc.  Unix/Linux permits you to do that (try it and see, it's great
fun), and is perfectly happy to have one process write right over what
another process is doing, or even remove the file out from underneath
the other one while it's in the middle of a write.  But the onus is on
you to make sure you know what you're doing, and that you really want
the resulting behavior.  Likewise if you have a file open for write in
one process and open for read in another.  And it doesn't really care if
the file is on a foreign file system.  All that is a feature, not a bug,
as it permits things like multiuser databases.  Further, it is what
really makes Unix a true multiuser operating system.  See:

    perldoc -q lock

and read all the docs your OS, the other OS, and the package that
permits the foreign file mount has about file locking.  It's a tricky
subject.
-- 
Bob Walton


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

Date: Sat, 09 Dec 2000 04:06:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: about call excutable program with system()
Message-Id: <3A31B084.137B82FE@rochester.rr.com>

jin zengxiang wrote:
 ...
> can you tell me that :
> 1. If I want to call MS Word from perl to open a file ,say ,"myfile.txt"
> ,how
> can I achieve this ,I use system(" ......../word.exe myfile.txt"). but
> what this
> piece of code can do is just to open the MS Word for me ,while not open

Really?  That's interesting, because the name of the Word executable is
winword.exe .  Also, at least in the place where it is stored by a
default installation, the pathname contains space characters, and thus
the path must be quoted.  You didn't show it, so I don't know if you
quoted it or not.  If you do follow all that with the name of a file,
Word will start with that file shown, providing the file exists etc. 
Example:

system '"c:\program files\microsoft office\office\winword.exe"
junk208.txt';

> the " myfile.txt".
> 2.if I want to call a dos executable program (say ,the name of the
> program is dos.exe) to run a file "input.txt ",
> so In dos command prompt ,I type in "dos.exe input.txt" .
> but when I try to do this through perl:
> ************************
> system("dos.exe input.txt") ;
> ************************
> there is an error message says that Internal error .
> what's wrong with it ?

Nothing I can see.  It works fine on my system, even with multiple
arguments. For example:

   print "argument is $ARGV[0]\n";
   system('perl junk237.pl '.$ARGV[0]);

when called with:

   perl junk237.pl hi

generate an infinite loop of:

   argument is hi
 ...
> Alan
-- 
Bob Walton


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

Date: 09 Dec 2000 04:25:30 GMT
From: fryar386@aol.com (Fryar386)
Subject: Anything wrong with this code?
Message-Id: <20001208232530.26360.00003739@ng-fu1.aol.com>

My server keeps giving me errors for this code, all it says is premature end. 
I don't see anything wrong with it, do you?

print &PrintHeader;
open FILE, ">> /serverfiles/test.txt"  
or die "Error, Please contact Fryar386@aol.com\n";
flock FILE, 2    
or die "Couldn't acquire an exclusive lock on test.txt: $!\n";
print FILE <<ENDOFTEXT;
<P>
Username: $input{username}
Password: $input{password}
E-mail: $input{e-mail}
Attacks: $input{basic1}
Main Goal: $input{main_goal}
Planet: $planet
AIM: $input{aim}
Race: $input{race}
Speed: $speed
Defence: $defence
Attack: $attack
KI: $KI
Health: $health
MaxHealth: $maxhealth
Intellegence: $intellegence
Peri(money): $peri
Power Level: $powerlevel
ENDOFTEXT
close FILE    
or warn "test.txt didn't close nicely: $!\n";


All I know is that the error is in those lines of programming



Thanks



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

Date: Sat, 09 Dec 2000 02:52:31 GMT
From: joemorris101@my-deja.com
Subject: career advice needed (language? platform?)
Message-Id: <90s6pe$lh0$1@nnrp1.deja.com>

I am about to graduate with my BS in computer science (next May). I
have no paid experience in the computer admin or programming field. I
am an older, parttime student.

Most of my programming  school-experience is in C, but I have a semi-
decent knowledge of Java and fair knowledge of C; have a high GPA,
etc...

The school I attend is a commuter-type "liberal arts" school in a large
Texas city; it is not highly rated or well-known in any way.

But I have noticed that of the recently graduated students here who to
my knowledge have found jobs, all of them are in scripting languages,
and so I have considered dropping my personal study of Java (which has
little to do with most of my classes). Upon reflection, I can see why
it might be easier for a recent grad to get a job using scripting
languages--usually that work is  not mission-critical, etc, and they
are "small" programs, and might well be something that we, with our
lack of experience, might actually be able to handle.

PLus, I have some doubts about Java and Sun; I like the idea of open
source.  It seems more sound.

So, my question is, should I endeavor, over the 5-week Christmas break,
to learn one of the scripting languages (which language?????), and
should I tell my advisor that for my senior project, instead of doing
an investigation of Java, and its potential, and possible uses, etc,
should I tell him that I want to write scripts? And if so, what
scripting languages should I use? I have some computers that I am
trying to set up on Linux, and of course I have Windows, so which
platform should I use? I know some Unix, but would I best use my next 6
months before graduation learning a scripting language AND Linux/Unix,
or would I be better served by just using some free Windows server and
concentrating on writing scripts for Win32--just concentrating on the
langauge, and the details of Web programming (which I actually know
very little about)?

I want to place myself as best possible, competitively speaking, and of
all the BS CS students graduating in May, how many will know any Perl,
relative to the demand for Perl? Not many! So I have been leaning
toward Perl...But what about Javascript and PHP, etc?

Also, considering my age, would it be better to try for a job as a
junior Unix admin? I enjoy programming, and compared to my school
peers, am quite good at it. I have many more years of programming than
they, and was in fact the only student in my OS class to make all my
programs work, and my temperament is fairly well suited to it.
 But is Admin a better career choice for me? I am not much of a people
person--bookworm type...

What do I enjoy? Writing little Java programs that use the networking
libraries. Spiders, etc. I love the Internet. I love the idea of being
able to access all free info and manipulate it; I have always loved
libraries, and the Net is just one big library to me; I think a data
mining robot and text analyzer and placing the results in a
website/database is a likely senior project for me--Perl? Java? What
language for it? Will that prepare me for a job?

What should I concentrate on over the next 6 months or so that gives
the best chance at a job?

I appreciate your time.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 09 Dec 2000 03:49:11 GMT
From: fryar386@aol.com (Fryar386)
Subject: Re: Does it matter?
Message-Id: <20001208224911.26360.00003737@ng-fu1.aol.com>

Ok, I was just wondering cuz my program keeps saying it can't find that file


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

Date: Sat, 09 Dec 2000 02:24:31 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: dynamic require & new on variable package
Message-Id: <3A319882.616AB428@rochester.rr.com>

simonmcc wrote:
> 
> So I've tried deja, and camel etc, and I can get answers to parts of my
> problem, but not all.
> 
> I need to instantiate an object, but I don't know what it is (i.e. it is in
> a variable).
> 
> for example:
> 
> my $o_type="Driver::Type1"; #for example, could be one of many types
> eval "require $o_type;"; #works fine, dynamically requires a given package
> if ($@)
> {
>     die "ERROR : couldn't load $o_type : $@";
> }
> my $object;
> eval "$object = $o_type->new();";
> #etc etc
> 
> but object never gets initialised: what am I doing wrong? if it is something
> simple, call me stupid, but I cant find the answer anywhere (hope it is
> simple ;)
> 
> also is this bad practice? (I need to do it because I use a generic piece of
> code to instantiate many drivers)
 ...
> simon.
Well, Perl will interpolate the double-quoted string 

       "$object = $o_type->new();"

getting

        = Driver::Type1->new();

which then will fail to compile when eval'ed.  Try:

        eval "\$object = $o_type->new();";

and see how that works.  You should test for an error in the eval, which
would have helped point you in the right direction.
-- 
Bob Walton


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

Date: Sat, 9 Dec 2000 03:09:08 -0000
From: "Edd" <edd@texscene.com>
Subject: File writing problem
Message-Id: <3a31a06b@news-uk.onetel.net.uk>

I am a novice in perl programming. I am trying to learn how to write to a
file. To try it out, I wrote the code below. But it fails to do what I want
it to do. The file I want to write to is: ' web1.html' . But it doesn't. In
the code below, the first thing I do is to parse a form. This works OK. Then
I set the permissions for web1.html.

Then I check the attributes of the file web1.html. They confirm.

But, when I check if a file which I know doesn't exist
"nofile.html", I get positive response as well. This really confuses me
desperately!

When I run the programme, I see no change to the web1.html. I tried
different paths etc.

Could anybody help please. The code is as below:


#!/usr/bin/perl

&Parse_Form;


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

# Below I set the permissions
if (-e "web1.html") {
   chmod(0744, "web1.html");
   print "<P>the permissions changed";
}


# Below I write to web1.html
open (LOG, ">web1.html");
print LOG "Content-type: text/html\n\n";
print LOG "<HTML><HEAD><TITLE>Hello Visitor</TITLE></HEAD><BODY>";
print LOG "</BODY></HTML>";
close(LOG);

# Below I check to see if the atributes of web1.html is OK
if (-e, web1.html) {
  print "<p>it exists";
} else {
  print "it doesn't exist";
}
if (-r, web1.html) {
  print "<p>it can be read\n";
} else {
  print "it can't be read";
}
if (-x, "web1.html") {
  print "<p>it can be executed\n";
} else {
  print "it can't be executed";
}
if (-w, "web1.html") {
  print "<p>it can be written to\n";
} else {
  print "it can't be written to";
}
if (-d, "web1.html") {
  print "<p>it is a dir\n";
} else {
  print "it is not a dir";
}

#Below I check to see if nofile.html exists.
#It is a file which I know doesn't, but passes as exists when the programme
runs!!

if (-e, nofile.html) {
  print "<p>it exists";
} else {
  print "it doesn't exist";
}

#Below I write to the Browser to create a link to the page 'web1.html
print "<HTML><BODY>";
print "<p>you can see your personal page by clicking on the link below";
print "<p><a href=\"/web1.html\">LINK TO WEB1</a></p>";
print "</BODY></HTML>";


sub Parse_Form {
 if ($ENV{'REQUEST_METHOD'} eq 'GET') {
  @pairs = split(/&/, $ENV{'QUERY_STRING'});
 } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
  read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  @pairs = split(/&/, $buffer);

  if ($ENV{'QUERY_STRING'}) {
   @getpairs =split(/&/, $ENV{'QUERY_STRING'});
   push(@pairs,@getpairs);
   }
 } else {
  print "Content-type: text/html\n\n";
  print "<P>Use Post or Get";
 }

 foreach $pair (@pairs) {
  ($key, $value) = split (/=/, $pair);
  $key =~ tr/+/ /;
  $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

  $value =~s/<!--(.|\n)*-->//g;

  if ($formdata{$key}) {
   $formdata{$key} .= ", $value";
  } else {
   $formdata{$key} = $value;
  }
 }
}
1;











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

Date: Sat, 9 Dec 2000 02:22:59 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: formresults at another page than cgi-page
Message-Id: <slrn9335re.2vc.efflandt@efflandt.xnet.com>

On Fri, 8 Dec 2000 11:46:41 +0100, Harald ter Haar <harald@wanadoo.nl> wrote:
>Hello everyone,
>
>My form leads to a cgi-script wich is at an other web-domain. This is
>because my host doesn't support cgi-scripts. Now, I want the 'print'-result
>of the form , (for example "Thank you for using my form, klick here to go
>back") not on de cgi-page itself, but at a separated html-page of the domain
>where my form stays.
>So for example:
>"http://home.domainname1.com/form.html" leads to
>"http://home.domainname2.com/form.cgi"
>Then: formresults at
>"http://home.domainname1.com/formresult.html"
>
>Note: I want this to avoid the commercial-popups wich appear by giving
>commands in de cgi to show something in html. I hope I made myself
>clear enough that you can help me.

How many times are you going to post this in the wrong newsgroup?  Most
free hosts have policies prohibitting what you are trying to do, so don't
be surprised if your free site suddenly disappears.  But the answer to
your question is, don't print anything except:

print "Location: http://home.domainname1.com/formresult.html\n\n";

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 09 Dec 2000 04:44:30 GMT
From: fryar386@aol.com (Fryar386)
Subject: HELP PLEASE!
Message-Id: <20001208234430.26360.00003742@ng-fu1.aol.com>

Is there anyway to use perl to take out all the _'s @'s $'s and all the symbols
like that out of a string?


Thanks


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

Date: Sat, 09 Dec 2000 03:46:18 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How do I find out my own IP Address?
Message-Id: <3A31ABAF.6431FACF@rochester.rr.com>

Christoph wrote:
 ...
> could anybody tell me how to find out the IP-address that my
> internet-provider gives me at dial-up?
> I allready searched CPAN but I couldn't find anything that looks like a
> solution.
 ...
>   Christoph
On many systems, including some popular ones that usually don't work so
well, the command line command:

    arp -a

will get it (or perhaps them).
-- 
Bob Walton


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

Date: Sat, 09 Dec 2000 01:58:17 GMT
From: cwang9@yahoo.com
Subject: Re: How to Exit from Inner Loop ???
Message-Id: <90s3jn$j9n$1@nnrp1.deja.com>

FYI:

I found out the answer by myself: "last;"

thx,

====
Jack

In article <90o78e$djh$1@nnrp1.deja.com>,
  cwang9@yahoo.com wrote:
> I have 2 while loop and one is as an inner loop.
>
> Just could not find a way to exit the inner loop and
> start the next round of outer one. Some function like
> 'continue' in C/C++ I am looking for.
>
> I checked 2 Perl books I have so far,,,
>
> Thanks,
>
> Jack
> Tampa, FL
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 07 Dec 2000 10:50:57 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: How to Exit from Inner Loop ???
Message-Id: <3A2FBFF1.C00ACEF2@home.com>

Josef Moellers wrote:
> 
> cwang9@yahoo.com wrote:
> >
> > I have 2 while loop and one is as an inner loop.
> >
> > Just could not find a way to exit the inner loop and
> > start the next round of outer one. Some function like
> > 'continue' in C/C++ I am looking for.
> >
> > I checked 2 Perl books I have so far,,,
> 
> ... but haven't found "next"!

If he puts a label on the outer loop and calls next LABEL from the inner
one, then yes. Otherwise next() will just go the the next iteration of
the current loop by default. What he probably wants is last() to break
out of the inner loop. There is a difference, though. These two chunks
of (pseudo-)code are NOT equivilant:

OUTER: while (condition 1) {
    while (condition 2) {
        # ...
        next OUTER if ($foo);
    }
    print "Hi there!\n";
}

OUTER: while (condition 1) {
    while (condition 2) {
        # ...
        last if ($foo);
    }
    print "Hi there!\n";
}

The first example will only print "Hi there!" when it falls through the
inner loop; the second will print it on fall-through or when it breaks
via last(). The OP will have to determine which one he needs.

-mjc


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

Date: Thu, 07 Dec 2000 09:34:37 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Modules in MS-DOS
Message-Id: <3A2FAE0D.C240F95@home.com>

joonas wrote:
> 
> How can I install modules in MS-Dos.
> 

Assuming that you're running the Win* port from ActiveState, use PPM
(the Perl Package Manager) from a command prompt:

ppm install <module-name>

-mjc


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

Date: 9 Dec 2000 03:15:36 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: multi keyed hash or array
Message-Id: <90s84o$acb$1@bob.news.rcn.net>

John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
>>>>>> "Chris" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:


>     Chris>     $store{$year}

>     Chris> is the hash ref. And

>     Chris>     %{$store{$year}}

>     Chris> is the hash. So

> Yes, thank you.  So I could also write %$store{$year}, right?

Wrong.  Dereferencing has a higher precedence than subscripting, so that
would treat $store as a hash reference, try to dereference it, and fail
because it wasn't a hash reference, but rather a scalar that was never set
to anything.


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

Date: Sat, 9 Dec 2000 02:39:29 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Newbie Perl CGI and Netscape Prob
Message-Id: <slrn9336qc.2vc.efflandt@efflandt.xnet.com>

On Fri, 08 Dec 2000 03:55:17 GMT, Bill Jeanes <bill.jeanes@gte.net> wrote:
>
>I'm having problems with some Perl CGI scripts.  I can run them from the
>command prompt successfully, but cannot access them via my browser.  Here's
>the error from the log file:
>
>could not fork new process (exec() failure [No such file or directory])
>
>I suspect it is a configuration problem, but I'll be you-know-what if I can
>figure out what it is.  The cgi-bin re-direct is correct.  Perl is installed
>correctly.  Help!

This is very unlikely to be a Perl problem.

When you test scripts in the shell, if they run as 'perl scriptname', but
do NOT run as './scriptname' then the problem is that sh cannot find
'perl^M' because you forgot strip the DOS/Win carriage returns.  In that
case make sure you upload as ASCII text, not binary.

If that is not the problem, consult a www.server newsgroup.

>Here are the system particulars:
>
>Perl: Perl v5.6.0
>OS: Solaris 8
>Webserver: Netscape 4.0 SP3
>
>TIA,
>
>Bill
>
>


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Sat, 9 Dec 2000 02:58:39 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: parsing canned response
Message-Id: <slrn9337u9.2vc.efflandt@efflandt.xnet.com>

On Fri, 08 Dec 2000 22:47:20 GMT, Mike Gardner <mike@a2zcables.com> wrote:
>
>I have a form that posts data to a server.  It returns with a canned
>response. (I grab the page with LWP.)  Amongst the garbage spit back are
>multiple instances of Content-Type and Content-Length.  The idea is to
>separate that data from the rest and save those variables.
>
>I have successfully separated (split) the response by its content
>boundaries and saved them to an array in which I can call the individual
>"slices." (which contain the content and length values). But I cannot
>figure out how I can take the new slices and extract out only the
>Content-Type and Content-Length fields into name-value pairs!
>
>Can anyone give me any advice on how I can take these slices from the
>canned response and split them into the pairs?

Maybe I don't understand the question, but this simple example can split
HTTP headers fed to it into name value pairs.  Are you getting stuck on
how to split or how to pattern search the header lines from non-header
lines (the headers end at the first blank line)?

#!/usr/bin/perl -w
while(<STDIN>) {
    chomp;
    ($name,$value) = split /:\s+/, $_;
    print "$name = $value\n";
}


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Sat, 9 Dec 2000 03:13:15 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: parsing canned response
Message-Id: <slrn9338pm.2vc.efflandt@efflandt.xnet.com>

On Fri, 08 Dec 2000 22:47:20 GMT, Mike Gardner <mike@a2zcables.com> wrote:
>I have successfully separated (split) the response by its content
>boundaries and saved them to an array in which I can call the individual
>"slices." (which contain the content and length values). But I cannot
>figure out how I can take the new slices and extract out only the
>Content-Type and Content-Length fields into name-value pairs!
>
>Can anyone give me any advice on how I can take these slices from the
>canned response and split them into the pairs?

I forgot about possible carriage returns.  So my example should have been:

#!/usr/bin/perl -w
while(<STDIN>) {
    s/\015|\012//g;
    ($name,$value) = split /:\s+/, $_;
    print "$name = $value\n";
}


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Sat, 09 Dec 2000 02:46:36 GMT
From: "Wayne Hayes" <hayes@sympatico.ca>
Subject: Re: Perl Help with LWP
Message-Id: <g2hY5.62414$2A2.2809552@news20.bellglobal.com>

http://www.cpan.org/ , http://www.perl.com

also

Web Client Programming        # Good info on browsers, http, sockets, lwp::,
etc.
Clinton Wong
O'Reilly
ISBN 1-56592-214-x






Enrico Ng wrote in message <90s3ig$8e8$1@newsx.cc.uic.edu>...
>I wanted to try learning more about LWP and perl.
>I found a good site a while ago at webreview.com, but the articles arent
>there anymore
>does anyone else no of any good sites?
>
>--
>Enrico Ng <ng@fnmail.com>
>
>




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

Date: 09 Dec 2000 03:47:39 GMT
From: fryar386@aol.com (Fryar386)
Subject: Re: PLEASE CHECK MY CODING!
Message-Id: <20001208224739.26360.00003736@ng-fu1.aol.com>

Sorry, this may sound a little stupid, but what does trying it from the command
line (sorry, I'm just a beginner)


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

Date: Sat, 09 Dec 2000 02:24:54 GMT
From: "Wayne Hayes" <hayes@sympatico.ca>
Subject: Re: sorting an array of hashes
Message-Id: <WJgY5.62250$2A2.2801988@news20.bellglobal.com>

try:

/(\S+)\s\(S+)\s*(\S*)/

Where:

$first_name=$1;
$last_name=$2;
$opt_name=$3;

 ... and go here http://www.cpan.org/doc/manual/html/pod/perlre.html


kcount wrote in message <90jjmv$kra$1@news.warwick.net>...
>Thank you very much.  that worked perfectly.  Next question....
>
>When I sort on my regexed last name, a few times i have a name that's
>similar to Kelly Smith III, (like Kelly Smith the 3rd.).  The regex i am
>using now is /(\S+$)/.  what kind of regex can i use to extract the last
>name, but take the next one to the left if the case turns out like the
>example above?  i suppose i'd have to disregard any combination of Roman
>numerals.  Any input would be greatly appreciated.  Thanks Again!!!
>
>Kip
>
>




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

Date: Fri, 8 Dec 2000 21:52:08 -0500
From: "kip" <kip@skiltrip.com>
Subject: Re: sorting an array of hashes
Message-Id: <t337o5i3sdjsa2@corp.supernews.com>

>When I sort on my regexed last name, a few times i have a name that's
>similar to Kelly Smith III, (like Kelly Smith the 3rd.).  The regex i am
>using now is /(\S+$)/.  what kind of regex can i use to extract the last
>name, but take the next one to the left if the case turns out like the
>example above?  i suppose i'd have to disregard any combination of Roman
>numerals.  Any input would be greatly appreciated.  Thanks Again!!!

>>/(\S+)\s\(S+)\s*(\S*)/

>>Where:

>>$first_name=$1;
>>$last_name=$2;
>>$opt_name=$3;

This is also excellent, and works great.  But each little piece of help I
receive, I unfortunately realize another hurdle.  Some of my names have
middle names and middle initials.

with /(\S+)\s(\S+)\s*(\S*)/.....

John Smith Jr.  is going to match Smith for the last name, awesome, But....
John J. Smith Jr. is going to match J. as the last name.

of course it would seem easy enough to disregard anything in the  middle if
it happened to contain a period, but what about full middle names, or double
middle initials, like..

John Jerry Smith Jr.  or  John A. G. Smith IV

Also, I am dealing with people from nations all over the world, so they can
easily have four or five names.

I have too much faith in Perl though to believe that it can't be done.  So
anybody that has that same faith, lend me a hand.  I'm gonna go hack out
some regex right now and see what i can do.

(It would make sense to make the last name a field by itself, but
unfortunately, I am extracting data that has already been created.)

thanks everyone,

Kip




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

Date: Sat, 9 Dec 2000 03:24:12 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Uploading file via CGI
Message-Id: <slrn9339e7.2vc.efflandt@efflandt.xnet.com>

On Fri, 08 Dec 2000, Geoff Soper <g.soper@soundhouse.co.uk> wrote:
>In article <4a296bcb8dg.soper@soundhouse.co.uk>, Geoff Soper
><g.soper@soundhouse.co.uk> wrote:
>> i'm using the following piece of code in my first attempt to upload a
>> file using CGI. While the file is created it is of zero length. Could
>> somebody point out my error?

Problem #1 is that, unless CGI.pm changed, upload('upload_1') does not
exist, it should be param('upload_1').

Problem #2 is that you are handling a binary like a text file.  That might
or might not work.  See what 'perldoc CGI' says about saving binary files.


>To simple things further I have taken the example given in the Docs for
>this module and changed only the name and the method uised to call the
>upload function giving:
>
>Form:
>
><INPUT TYPE="file" NAME="upload_1"  SIZE=60> 
>
>Script:
>
>use CGI qw(:standard upload);
>
>     $fh = upload('upload_1');
>     while (<$fh>) {
>           print;
>     }
>
>
>Which was as below before modification:
>
>     $fh = $query->upload('uploaded_file');
>     while (<$fh>) {
>           print;
>     }
>
>I have tried searching for help or tutorials on the web but have found
>nothing useful. If somebody could point out my error I'd me most grateful.
>
>Cheers
>
>-- 
>Geoff Soper
>g.soper@soundhouse.co.uk
>Take a look at the Soundhouse page http://www.soundhouse.co.uk/


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

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 V9 Issue 5069
**************************************


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