[8457] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2075 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 11 14:07:28 1998

Date: Wed, 11 Mar 98 11:02:07 -0800
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, 11 Mar 1998     Volume: 8 Number: 2075

Today's topics:
        How to use multipart with libwww? (Carl ]sman)
    Re: lowercase $lower = lc("aBcDe"); Blows UP!! (Chip Salzenberg)
        MSQL-PERL <agro@xures.ei.uvigo.es>
    Re: MSQL-PERL (Steve Linberg)
        PID of process launched in unix system? (Erik Johnson)
        printf / unlink / ?: (Hans-Georg Rist)
    Re: Prototype (like push) (Chip Salzenberg)
    Re: replacing/removing a escape secquence <Peter.Kruse@psychologie.uni-regensburg.de>
    Re: Skipping within a line to read URL? (Craig Berry)
        sorting <jmann@umich.edu>
    Re: Speed of sort routine vs. one-by-one compare (123) <uri@sysarch.com>
    Re: splice -- useful uses? scott@softbase.com
    Re: Traversing directory trees. <jdporter@min.net>
    Re: What is PERL? Learn JAVA instead? scott@softbase.com
    Re: Why doesn't ' s/\(/#LPAREN#/gi; ' work? !! <uri@sysarch.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 11 Mar 1998 18:01:26 +0100
From: md4calle@mdstud.chalmers.se (Carl ]sman)
Subject: How to use multipart with libwww?
Message-Id: <w7pogzdrwk9.fsf@fraggel48.mdstud.chalmers.se>

I shall upload some 1000 files via a webpage (not my idea at all,
they refuse to do it in any other way), and that webpage uses
multipart for the uploading procedure.

I wonder how I shall write a script that will do this for me,
it shall call the webpage and upload each file, in the same manner
is if I was doing it from a webbrowser.

Anyone tried something like this and got any tips?
Shall I make a request with the file attached to it somehow, I don't
get it really....

all best,

/Calle

**************************************************************************
*         *         My homepage about the author Tom Holt:               *
*        /_\        http://www.mdstud.chalmers.se/~md4calle/holt/        *
*     { ~._.~ }                                                          *
*      (  Y  )      other things like OnLine Guitar Archive linkpage     *
*     ( )~*~( )     and heaps of musiclinks can be found at              *
*     (__)-(__)     http://www.mdstud.chalmers.se/~md4calle/             *
**************************************************************************



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

Date: Wed, 11 Mar 1998 17:02:35 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: lowercase $lower = lc("aBcDe"); Blows UP!!
Message-Id: <6e6g6o$8us$1@cyprus.atlantic.net>

According to christian@sur-tech.com:
>"lc" may clash with future reserved word at ././item line 35syntax error in
>file ././item at line 35
>, next 2 tokens "lc(" 

You're using Perl 4, not Perl 5.  Time to upgrade.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 11 Mar 1998 17:46:24 +0100
From: Josi <agro@xures.ei.uvigo.es>
Subject: MSQL-PERL
Message-Id: <3506BFE0.1223@xures.ei.uvigo.es>

I would be pleased if anyone could answer this question:
HOW CAN I MAKE QUERIES TO A MSQL-DATABASE FROM A PERL SCRITP USING A
MSQL-PERL.MODULE(PM) THAT I4VE DOWNLOAD . I CAN4T INSTALL IT , AND I
DON4T KNOW HOX IT WORKS.
PLEASE E-MAIL ME --> agro@xures.ei.uvigo.es


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

Date: Wed, 11 Mar 1998 13:41:22 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: MSQL-PERL
Message-Id: <linberg-1103981341220001@projdirc.literacy.upenn.edu>

In article <3506BFE0.1223@xures.ei.uvigo.es>, agro@xures.ei.uvigo.es wrote:

> I would be pleased if anyone could answer this question:
> HOW CAN I MAKE QUERIES TO A MSQL-DATABASE FROM A PERL SCRITP USING A
> MSQL-PERL.MODULE(PM) THAT I4VE DOWNLOAD . I CAN4T INSTALL IT , AND I
> DON4T KNOW HOX IT WORKS.
> PLEASE E-MAIL ME --> agro@xures.ei.uvigo.es

Didn't you post this yesterday?

Did you read all of the enclosed documentation?
Did you read the FAQ for your version of Perl?
Did you search deja news?

Do you understand how impossible it is to answer a question where no
details are given besides "it doesn't work?"

If you have read all of the documentation, searched for exhuastively
answers and still can't find anything, and you are sure your question is
not a FAQ, then post information about your operating system, which
version of Perl you're using, which libraries you're using, some sample
code that demonstrates your problem, and a specific question.

Repeatedly posting "it doesn't work" and using lots of upper-case letters
isn't going to help anybody help you.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Wed, 11 Mar 1998 18:20:04 GMT
From: erik@phidias.colorado.edu (Erik Johnson)
Subject: PID of process launched in unix system?
Message-Id: <3507d4d5.152213541@news.colorado.edu>

Pardon me if I don't use the proper lingo, unix is almost enitrely
foreign to me...

In a perl script, I am launching a background process using unix's
daemon command.  The script then continues on doing its thing,
while the background process does its thing.  Great.  Now I want
to, at a latter time, have the perl script kill that process.  How can
the script know the PID of the background process so that we
might kill it... or is there another way to accomplish this?  

Thanks
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Erik Johnson    erik@ phidias.colorado.edu
http://phidias.colorado.edu/ejvgallery
http://phidias.colorado.edu/phidias


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

Date: Wed, 11 Mar 1998 17:44:22 GMT
From: hans-georg.rist@zkrd.de (Hans-Georg Rist)
Subject: printf / unlink / ?:
Message-Id: <3506c9b5.3213241@news.uni-ulm.de>

Hi,

I wanted to use unlink in combination with printf and the conditional
operator ?: like this:

$file = "testfile.tmp";
print "$file: ";
if ( -e $file ) {
   printf "%ssuccessfully deleted.\n", unlink $file ? "" : "not ";
}

the output is:

testfile.tmp: 0successfully deleted.

meaning: not deleted, the file still exists. I can't understand where
this zero '0' comes from, because unlink expects a list and my list
should end with $file!? 

Ok, fixing the problem is easy, using parentheses:
   printf "%ssuccessfully deleted.\n", (unlink $file) ? "" : "not ";
or:
   printf "%ssuccessfully deleted.\n", unlink($file) ? "" : "not ";

Any explanation?

HG (using Perl5.004_02 on Win95, not tested under Unix)

-- 
| Hans-Georg Rist     ZKRD, Zentrales Knochenmarkspender-Register
| Helmholtzstr. 10    Deutschland, gGmbH
| P.O.B. 4244         German National Registry of Bone Marrow Donors
| D-89032 Ulm         http://www.zkrd.uni-ulm.de
| Phone: +49 731 95430-46, Fax: -50, email: hans-georg.rist@zkrd.de


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

Date: Wed, 11 Mar 1998 16:57:05 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Prototype (like push)
Message-Id: <6e6fse$8te$1@cyprus.atlantic.net>

According to net0018@edwardjones.com (Paul Bardo):
>I want to prototype the function like push "(\@@)".

There is a known bug in Perl 5.004_04 with that kind of prototype.

I fixed it, and the fix will be in 5.004_05 (along with a whole load
of excellent fixes and small features intended to improve source
compatibility with the forthcoming 5.005).
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 10 Mar 1998 17:20:14 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: replacing/removing a escape secquence
Message-Id: <m34t16jz5t.fsf@arnulf.de>

In article <35055E44.A6ABAF3F@charlestoncounty.org> Peter Shankey
<shankeyp@charlestoncounty.org> writes: 

> 
> I have a file which has been moved to a unix system from a dos system.
> The file contains a ^M  or I should say a "ESC M".  I know it a escape
> sequence because I see it in vi but not with a cat command.
> 
> to get rid of it I have tried the follow with no success:
> 
> stuff
> while (<CU>) {
> s/^[M//;
> print CUtemp $_;
> }
> stuff
> 
> I have tried a few variations of the regular expression with no success.
> 
> any idea would be helpful
> 

try this:
#!/usr/bin/perl -w
# get rid of carriage return and leave newline
# write back to the same file
# can have multiple files as arguments
# or stdin
while(<>) {
    s/\r\n$/\n/gs;
    push(@this_file,$_);
    if (eof) {
	close(ARGV);
	open(TF,">$ARGV");
	print TF @this_file;
	close(TF);
	undef(@this_file);
    }
}

	Peter

> thanks
> pete
> 
> 
-- 
__END__


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

Date: 11 Mar 1998 18:27:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Skipping within a line to read URL?
Message-Id: <6e6l29$pbt$2@marina.cinenet.net>

John Moreno (phenix@interpath.com) wrote:
: That it doesn't have a space would depend upon how the url is being
: stored - file names can and do have spaces in them, so that MIGHT not be
: able to be guaranteed.

I don't think urls can have spaces in them, however.  (I'm ready to have 
this disproved, if someone knows something I don't.)

: But since it seems to be on just one line. my ($url) = $line =~ /access
: to (.+)$/;

That won't work; see the original post, there's error-message text 
following the url.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 11 Mar 1998 18:40:53 GMT
From: john mann <jmann@umich.edu>
Subject: sorting
Message-Id: <3506DAB3.B9413F5E@umich.edu>

I have an 2 dimensional array (I believe it's called), namely about
100 pairs composed of a string of letters paired with a number.
Something like
  
$pins[0][0] = 23  and  $pins[0][1] = CAT
$pins[1][0] = 4   and  $pins[1][1] = DOG
$pins[2][0] = 57  and  $pins[2][1] = BIRD


I would like to sort this array, based on the letters entries (CAT, DOG,
BIRD). So I would get;

$pins[0][0] = 57  and  $pins[0][1] = BIRD
$pins[1][0] = 23  and  $pins[1][1] = CAT
$pins[2][0] = 4   and  $pins[2][1] = DOG

Any help would be greatly appreciated!
       
-- 
-----------------------------------------------------------------------------
John C. Mann
Engineer in Research III
University of Michigan Physics Dept.
Randall Laboratory
Ann Arbor, MI   48109

phone; (734) 936-1029
FAX  ; (734) 936-6753
e-mail; jmann@umich.edu

current cat count; 3 (1 renegade, 1 in the basement, 1 psychopussy)


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

Date: 11 Mar 1998 12:04:12 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <x7pvjttb03.fsf@sysarch.com>

? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:

> In <x73egpvqf2.fsf@sysarch.com> Uri Guttman <uri@sysarch.com> writes:
> 
> [...]
> 
> >but as i said ALL algorithms will have the same overhead reading in the
> >file and writing it out again. so it it a constant and you ignore it for
> >analysis.
> 
> Not true,  some alogrthums that are memory hungery will force a meachean
> into swapping, this is very detramental to speed.

in true algorithm analysis, you don't look at real world issues like
that. you assume enough memory for the algorithm/problem at hand. if you don't
have enough ram, you work in a different algorithm space where I/O is a
factor. tape based sort/merges are a classic case of that. you only sort
in ram as many records as you can fit (depending on your sort algorithm
of course) and write the results to tape. then the number of tapes and
drives you use becomes a real analysis factor.

they are different problems (ram resident vs. swapping of some kind) and
shouldn't be compared.

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 11 Mar 1998 19:19:01 GMT
From: scott@softbase.com
Subject: Re: splice -- useful uses?
Message-Id: <6e6o35$l8b$1@scully.new-era.net>

John Klassa (klassa@aursgh.aur.alcatel.com) wrote:

> Either way, what do people use splice for?

I used it in a file parser. I was reading a file and 
adding lines. I read the entire file into an array.
When I got to the point I needed to add lines, I 
used splice. Then I wrote the array as the new file.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Wed, 11 Mar 1998 12:50:43 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Traversing directory trees.
Message-Id: <3506CEF3.E0D@min.net>

Casper Kvan Clausen wrote:
> 
> Given a directory tree and a starting directory, I have to return all
> sub-directory paths from the given directory.

Considering you're the first person who has ever wanted to do this,
you might be surprised to learn about the File::Find module,
obtainable from the CPAN.

John Porter


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

Date: 11 Mar 1998 19:20:26 GMT
From: scott@softbase.com
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <6e6o5q$l8b$2@scully.new-era.net>

Markku Uttula (webmaster@disconova.com) wrote:
> Robert F. Harrison wrote:

> >> Perl 4.036, way back in the early 70's[1].  Unfortunately, "Ja
> >> Va" means "Yes Go" in Swedish/Spanish (per word) so the name

> I'm propably out of line with this comment, but as swedish being my 2nd
> native language, I'd like to inform everybody that :

> 1) "Ja" really means "Yes" in swedish, but
> 2) "Va" means nothing... if it instead was "Vad" then it'd be "What"

I think he'd confusing "Java" with the unfortunately
named "Nova" car. In Spanish, no va = it won't go.
The car didn't sell well in Spanish-speaking countries.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 11 Mar 1998 12:10:18 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why doesn't ' s/\(/#LPAREN#/gi; ' work? !!
Message-Id: <x7ogzdtapx.fsf@sysarch.com>

Casper Kvan Clausen <ckc@dmi.dk> writes:

> Tim Darling <#tdarling@glue.umd.edu#> writes:
> 
> I tried this:
> 
>     #!/usr/local/bin/perl -w
> 
>     $text = "fun()";
>     print "Before:\t$text\n";
>     $text=~s/\(/#LPAREN#/gi;
why this                    ^

parens have no case! (they lose in court all the time :-)

>     print "After:\t$text\n";


uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

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

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