[10254] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3847 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 03:07:14 1998

Date: Tue, 29 Sep 98 00:00:44 -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           Tue, 29 Sep 1998     Volume: 8 Number: 3847

Today's topics:
        $ and abs (Tianxiong)
    Re: $ and abs (Sam Holden)
        $VARIABLE replacement in Netscape/MSIE <webmaster@cbsa.ca>
    Re: $VARIABLE replacement in Netscape/MSIE <webmaster@cbsa.ca>
    Re: $VARIABLE replacement in Netscape/MSIE <webmaster@cbsa.ca>
        ACL controls (David Michael Kusters (none))
        Alternate colors in tables with perl command? (Daniel Pray)
    Re: cat reese > /dev/null (was Re: Perl & Java - differ (nobody)
        Email parser <phil-att@worldnet.att.net>
        Finding first field in the last line in a database (krOMe)
    Re: Finding first field in the last line in a database (Martien Verbruggen)
    Re: gethostbyaddr (Michael Budash)
    Re: How to obtain my server IP number ?? <ned@fiber.net>
    Re: How to obtain my server IP number ?? (Martien Verbruggen)
    Re: How to obtain my server IP number ?? (Ethan H. Poole)
    Re: How Too??  File Copy from 1 server to the scripts s (Stephen Judd)
    Re: insert to sorted list via sort? spav@indiana.edu
    Re: Non-blocking I/O <ff@creative.net>
    Re: Non-blocking I/O <ff@creative.net>
    Re: Perl and viruses (Ronald J Kimball)
    Re: Perl inconsistency? <ff@creative.net>
        Perl Script Running as Root <bench@surfshop.net.ph>
        perl win32 and microsoft sql (ananth)
        Perl-CGI & metasend <bench@surfshop.net.ph>
        Perl-CGI & metasend <bench@surfshop.net.ph>
        Perl-CGI & metasend <bench@surfshop.net.ph>
        print $fh verses $fh->print parrottrap@netscape.net
    Re: question concerning gethostbyaddr <garry@america.net>
    Re: Returning a "near" hash key. <Arved_37@chebucto.ns.ca>
    Re: STDIO redirection & child process (Martien Verbruggen)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 29 Sep 1998 04:53:21 GMT
From: tianxiong@aol.com (Tianxiong)
Subject: $ and abs
Message-Id: <19980929005321.05885.00003474@ng-fd1.aol.com>


I've tried to seek an answer, but failed ...

1) How to handle the '$' in a string?  For example, after reading a line from a
file like "abc 234 $-20.00 $30.02 kkk xxx", I want to extract "$-20.00" and
"$30.02" first, then get "-20.00" and "30.02".  What should I do?  I tried to
use 'split' with "$" as the delimiter, but didn't know how to handle '$'.  How
can I trim "$-20.00" into "-20.00"?

2) How to use function "abs"?  I tried "abs (-20);" but it didn't work for me. 
Do I miss something?

Thanks,

An obvious beginner
Tim


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

Date: 29 Sep 1998 05:50:36 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: $ and abs
Message-Id: <slrn710t9c.n2r.sholden@pgrad.cs.usyd.edu.au>

On 29 Sep 1998 04:53:21 GMT, Tianxiong <tianxiong@aol.com> wrote:
>
>I've tried to seek an answer, but failed ...
>
>1) How to handle the '$' in a string?  For example, after reading a line from a
>file like "abc 234 $-20.00 $30.02 kkk xxx", I want to extract "$-20.00" and
>"$30.02" first, then get "-20.00" and "30.02".  What should I do?  I tried to
>use 'split' with "$" as the delimiter, but didn't know how to handle '$'.  How
>can I trim "$-20.00" into "-20.00"?


$line = "abc 234 \$-20.00 \$30.02 kkk xxx";
@prices =  $line=~m/(\$[-+]?\d+(?:\.\d{2})?)/g;

for(@prices)
{
	print "With \$ : $_\n";
	print "Without \$ : ",substr($_,1,-1),"\n";
}

Works for me...

see perldoc perlre, of course you probably want something more picky about
what it matches, or less picky I guess...

>2) How to use function "abs"?  I tried "abs (-20);" but it didn't work for me. 
>Do I miss something?

;perl -e 'print abs(-20)'
20

This is the result I would expect what were you expecting?

-- 
Sam

Of course, in Perl culture, almost nothing is prohibited. My feeling is
that the rest of the world already has plenty of perfectly good
prohibitions, so why invent more?  --Larry Wall


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

Date: Tue, 29 Sep 1998 02:06:42 GMT
From: "Brian Moulton" <webmaster@cbsa.ca>
Subject: $VARIABLE replacement in Netscape/MSIE
Message-Id: <01bdeb4d$8b868520$2607140a@pcmax.wolf>

** I appologize if this is a commonly recurring question ... i could not
find the answer on dejanews.

I am printing HTML output from a perl script using

   print <<EOF;
   ...some html tags
   $some_variables included for output
   EOF
   ;

In MSIE there are no problems, but in Netscape the $some_variables are not
output to the browser. For example, if I have <H1>Title - $subtitle</H1>
where $subtitle = "green"
In MSIE i get 

   <H1>Title - green</H1>

but in Netscape I get

   <H1>Title - </H1>

Is this normal?!

Thanks,
Brian


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

Date: Tue, 29 Sep 1998 02:18:42 GMT
From: "Brian Moulton" <webmaster@cbsa.ca>
Subject: Re: $VARIABLE replacement in Netscape/MSIE
Message-Id: <01bdeb4f$37be3d00$2607140a@pcmax.wolf>

As it may be the root of the problem, I thought that I'd add that I call
the script from a JavaScript menu and ONCHANGE="SwitchMenu()" where

function SwitchMenu() {
	var url = "http://foo.com/cgi-bin/menu.cgi?" +
document.genderform.genderselect.value;
	top.frames[0].location = url;
}

the values are of the format x&xx

Thanks again,
Brian


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

Date: Tue, 29 Sep 1998 02:27:07 GMT
From: "Brian Moulton" <webmaster@cbsa.ca>
Subject: Re: $VARIABLE replacement in Netscape/MSIE
Message-Id: <01bdeb50$65c8a040$2607140a@pcmax.wolf>

My appologies ... should have directed this to JavaScript NG. Netscape
isn't reading the document.formname.selectname.value!

Been working on this too long!

duh!
Brian



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

Date: 29 Sep 1998 03:25:04 GMT
From: dkusters@monet.artisan.calpoly.edu (David Michael Kusters (none))
Subject: ACL controls
Message-Id: <6upjug$8bh$1@cscnews.csc.calpoly.edu>

Is there any easy way (module prefered) to show and change access
control lists (ACL's) for files?  

This question comes from the fact that the ActiveState distribution
does not handle standard test operators for files (-x, -w, -r, etc.).
This makes sense when you realize that all files (well, almost) in
NT are under the control of ACL's.  The standard test operators are
not complex enough to handle ACL's.  I went looking for a module that
can allow me to get and set ACL's under Win32, but I realized that 
ACL's exist under UNIX as well.  

So, is there an easy way to use ACL's from within PERL?

--
Dave Kusters                              dkusters@polymail.calpoly.edu 
Software Developer             CAD Research Center, San Luis Obispo, CA 

Practice kind acts of randomness and beautiful acts of senility.


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

Date: Tue, 29 Sep 1998 05:58:52 GMT
From: daniel@intecomp.com (Daniel Pray)
Subject: Alternate colors in tables with perl command?
Message-Id: <daniel-2809982259380001@usr10-dialup43.mix1.sacramento.cw.net>

I've seen some professional web site that have a perl script list a
database request.  The table is alternated rows of color. Does anyone know
how to do this?


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

Date: 29 Sep 1998 05:40:16 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <6uprs0$8ff@newsserver.trl.OZ.AU>

How about if reese were a FIFO?

AC.

Bart Lateur (bart.mediamind@ping.be) wrote:
: It might be just my Unix ignorance, but could somebody explain to me
: what could be the possible use of copying something into the bin?

: You're still stuck with the original.

: 	Bart.


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

Date: 29 Sep 1998 06:29:12 GMT
From: Phil C <phil-att@worldnet.att.net>
Subject: Email parser
Message-Id: <36107C13.A00D8566@worldnet.att.net>

Is there a way ot read Emails from a perl script and parse its
informations. I'm trying to filter automatically some of my incoming
Emails like a UNIX tool called "Filter" used to do.
Does anyone know where I can get access to such a script?

Thanks
Phil.



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

Date: Tue, 29 Sep 98 04:31:23 GMT
From: Here@nowhere.com (krOMe)
Subject: Finding first field in the last line in a database
Message-Id: <GWWP1.169$Pj1.299355@newsfeed.slurp.net>

Does anyone know the perl 5 routine that reads the last line in the database.

I need to grab the value in the first field in the last line of a database and 
add 1 to it. Then close the file, go back and input a new entry into the 
database using the new value as an inventory number.

Anyone ? Anyone ?

Thanks for any help....

krOMe


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

Date: Tue, 29 Sep 1998 02:50:48 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Finding first field in the last line in a database
Message-Id: <cWXP1.45$cs.231543@nsw.nnrp.telstra.net>

In article <GWWP1.169$Pj1.299355@newsfeed.slurp.net>,
	Here@nowhere.com (krOMe) writes:
> Does anyone know the perl 5 routine that reads the last line in the
> database.

Last line? Row? Which database? RDBMS? Some text file? You need to be
more precise.

> I need to grab the value in the first field in the last line of a
> database and add 1 to it. Then close the file, go back and input a
> new entry into the database using the new value as an inventory
> number.

Depends on the database. Depends on the schema. 

Show us the code that you have written until now, and we'll tell you
how to change it.

> krOMe

You seem to have problems with your caps key. Consider fixing it.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


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

Date: Mon, 28 Sep 1998 23:52:57 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: gethostbyaddr
Message-Id: <mbudash-2809982352570001@d67.nas1.napa.sonic.net>

In article <360FFB60.10D6AE1A@luna-park.de>, Ulrich Wisser
<u.wisser@luna-park.de> wrote:

>> Hello,
>> 
>> I have a lot of ip-numbers in a file and I want to translate
>> them to hostnames. This is my code:
>> 
>>   $x1 = 192;
>>   $x2 = 41;
>>   $x3 = 13;
>>   $x4 = 118;
>> 
>>   $addr = pack("C4", $x1,$x2,$x3,$x4);
>>   $name1 = gethostbyaddr($addr, AF_INET);
>> 
>>   $name2 = gethostbyaddr("$x1.$x2.$x3.$x4", AF_INET);
>> 
>>   print unpack("C4", $addr),"\n$addr\nName1: $name1\nName2: $name2\n";
>> 
>> But I don't get any hostname $name1 and $name2 are both undef.
>> 

i've used this:

($name) = gethostbyaddr (pack("C4", split(/\./, "111.222.333.444")), 2)

hth-

-- 
Michael Budash ~ Michael Budash Consulting
707-255-5371 ~ 707-258-7800 x7736
mbudash@sonic.net


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

Date: Mon, 28 Sep 1998 20:02:04 -0600
From: Ned Hanks <ned@fiber.net>
Subject: Re: How to obtain my server IP number ??
Message-Id: <36103F9C.FBEF06B9@fiber.net>

I have been looking for the same thing, but on Windows 95/NT, and gethostbyname
is not available in the version of Win32 Perl I am using.

droby@copyright.com wrote:

> In article <6uofc3$m2r$1@nnrp1.dejanews.com>,
>   dragnovich@my-dejanews.com wrote:
> > Hello folks heres a good question! (I think)
>
> So have many other people thought.  That's why we call it a FAQ.
>
> >
> > I want to my perl program, obtain the IP numer from the machine that it is
> > ruuning, but how can I do this ???? Ie
> >
>
> The answer you seek is in perlfaq9.
>
> --
> Don Roby
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum



--
Ned D. Hanks             http://www.fiber.net/users/hanks
1744 West 680 North
Pleasant Grove, UT 84062
Home Phone: (801) 785-2690     Work Phone: (801) 227-9182
Home Email: ned@fiber.net      Work Email: ned@geneva.com




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

Date: Tue, 29 Sep 1998 02:45:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to obtain my server IP number ??
Message-Id: <fRXP1.43$cs.231543@nsw.nnrp.telstra.net>

In article <36103F9C.FBEF06B9@fiber.net>,
	Ned Hanks <ned@fiber.net> writes:

> I have been looking for the same thing, but on Windows 95/NT, and
> gethostbyname is not available in the version of Win32 Perl I am using.

Then you can't. Upgrade your version of perl. http://www.perl.com/

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

Date: 29 Sep 1998 04:56:19 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: How to obtain my server IP number ??
Message-Id: <6upp9j$67t$1@news-1.news.gte.net>

[Posted and Emailed]  In article <36103F9C.FBEF06B9@fiber.net>, ned@fiber.net 
says...
>
>I have been looking for the same thing, but on Windows 95/NT, and 
gethostbyname
>is not available in the version of Win32 Perl I am using.

Which version of Win32 Perl are you using?  I haven't had any problems with 
the gethostbyname() function using the ActiveState Perl distributions 
(http://www.activestate.com).

-- 
Ethan H. Poole            | Website Design and Hosting,
                          | CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net *       | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/



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

Date: Tue, 29 Sep 1998 14:00:28 +1200
From: stephen@waikato.ac.nz (Stephen Judd)
Subject: Re: How Too??  File Copy from 1 server to the scripts server
Message-Id: <stephen-ya023580002909981400280001@news.waikato.ac.nz>

In article <360ddbc9.0@news.greatbasin.net>, "Henry Wolff"
<admin@hatsoft.com> wrote:

>I have been trying to figure this out with no success.
>
>From a submitted form input field is a url like http://server1.com/image.gif
>
>I need to take that file (either .gif or .jpg) and copy it from the
>specified server/directory into a temp directory under the current scripts
>directory.
>
>Any help?

Yes, use libwww (available from CPAN if you don't have it already).

In particular:

   use LWP::Simple;

   $urltoget = "http://server1.com/image.gif";
   $file = "image.gif";
   print "Got it" if getstore($image, $file);

Stephen

-- 
Stephen Judd, Interactive    |  I will not use adversarial language in news
Media Consultant, Campus     |  posts. I will not use adversarial language in
Media, University of         |  news posts. I will not use adversarial ...
Waikato, New Zealand.        |   http://stephen.its.waikato.ac.nz/


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

Date: Mon, 28 Sep 1998 20:34:19 -0500
From: spav@indiana.edu
Subject: Re: insert to sorted list via sort?
Message-Id: <3610391B.C2090D0E@indiana.edu>

my original question:

>   s> to write my own recursive binary insertion subroutine. i have my
>   s> doubts now, however.  so is it terribly inefficient to do:
>
>   s>     @sorted_list = sort { #comparison code } ($new_element,
>   s> @sorted_list);
>
>   s> versus a pure perl binary insert?

> Uri Guttman wrote:
>
> why must it be sorted all the time? do you do more insertions or
> accesses? how long a list is it typically? all of these and other
> factors can influence the best way to solve your problem.

typically accesses and insertions are on the same order of magnitude. the list
size can vary dramatically. new elements to the list are distributed uniformly
over the entire range of the sample space. efficiency is more of a worry, of
course, when the list is very large.

> what i am really asking is what is the real problem, not what is the
> best way to do what you directly asked for.

the real problem is that i do not know whether calling

sort($new_item, @already_sorted_list);

is terribly inefficient compared to rolling my own binary insertion. i suppose i
should just get the timer module and have a couple of races. it was my hope that
someone out there would be familiar enough with the guts of perl to answer this
question. thanks.

> a common issue i have with computer problems is making sure you are
> solving the right problem and asking the right questions.

i'll keep that in mind.

steven e. pav

spav@indiana.edu



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

Date: Mon, 28 Sep 1998 23:34:32 -0700
From: Farhad Farzaneh <ff@creative.net>
To: jim@123stitch.com
Subject: Re: Non-blocking I/O
Message-Id: <36107F79.7C196A6C@creative.net>

I'm not sure if this is supported on win95, but you could also use the select
call to perform non-blocking I/O.  Read the documentation for select (and also
C documentation if you have it).  I've used it and it works well but it was a
little while back and I'm rusty on its use right now.

Jim wrote:
> 
> Hello Everyone,
> 
> Does anyone know how to do a non-blocking READ operation with
> PERL on Windows 95?? I need to be able to read from 2 I/O streams
> at the same time without blocking. If I use the READ function,
> PERL blocks (waits for input on that stream) until there is input
> on that stream. Because READ is waiting for user input I can't
> check if there is any input on the other stream. What I'd like
> to be able to do is READ input from the stream and not get blocked
> there if there is currently no input in the buffer. Or, is there
> some way to check if there is input in the buffer before I do the
> read?
> 
> I realize that on UNIX I could fork a separate task to handle each
> input stream, but on Windows 95 fork cannot be used.
> 
> Any help would be appreciated!!
> 
> Jim
> --
>          1-2-3 Stitch! (TM)
> Sharing the Gift of Cross Stitch (TM)
>       http://www.123stitch.com
>            (925) 551-3111


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

Date: Mon, 28 Sep 1998 23:35:07 -0700
From: Farhad Farzaneh <ff@creative.net>
To: jim@123stitch.com
Subject: Re: Non-blocking I/O
Message-Id: <36107F9B.2139DA27@creative.net>

I'm not sure if this is supported on win95, but you could also use the select
call to perform non-blocking I/O.  Read the documentation for select (and also
C documentation if you have it).  I've used it and it works well but it was a
little while back and I'm rusty on its use right now.

Jim wrote:
> 
> Hello Everyone,
> 
> Does anyone know how to do a non-blocking READ operation with
> PERL on Windows 95?? I need to be able to read from 2 I/O streams
> at the same time without blocking. If I use the READ function,
> PERL blocks (waits for input on that stream) until there is input
> on that stream. Because READ is waiting for user input I can't
> check if there is any input on the other stream. What I'd like
> to be able to do is READ input from the stream and not get blocked
> there if there is currently no input in the buffer. Or, is there
> some way to check if there is input in the buffer before I do the
> read?
> 
> I realize that on UNIX I could fork a separate task to handle each
> input stream, but on Windows 95 fork cannot be used.
> 
> Any help would be appreciated!!
> 
> Jim
> --
>          1-2-3 Stitch! (TM)
> Sharing the Gift of Cross Stitch (TM)
>       http://www.123stitch.com
>            (925) 551-3111


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

Date: Tue, 29 Sep 1998 01:27:11 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl and viruses
Message-Id: <1dg3f9k.1u6kxwj1y56x5iN@bay2-561.quincy.ziplink.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:

>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, Jonathan Stowe <gellyfish@btinternet.com> writes:
> :identifying virii 
> 
> Pardon me, but just which declension would that be?

Pardon me, but just which newsgroup is this?

;-)

(I agree, 'virii' is ridiculous', but do we really want to debate it in
clpm?)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 28 Sep 1998 23:20:54 -0700
From: Farhad Farzaneh <ff@creative.net>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl inconsistency?
Message-Id: <36107C46.4CD46A4E@creative.net>

You're correct and it was my mistake - I did not have strict on for the test
script but did have it for my application.  Thanks again.

Russ Allbery wrote:
> 
> Farhad Farzaneh <ff@creative.net> writes:
> 
> > First, I admit that it's probably my misunderstanding, but here is my
> > problem:
> 
> > I have some code that includes (modified for testing):
> 
> > my $r = $rField->range;  # a method of object instance $rField
> > print "Undefined\n" if ( !defined($r));
> > my @range = @$r;
> 
> > and which does print the "Undefined".  It chokes on the last line with
> > the following error:
> 
> > # Can't use an undefined value as an ARRAY reference.
> 
> > However, when I try to build a short script to test this behaviour, I
> > never get this error.  I'm not sure why this error occurrs in one case
> > and not in another.
> 
> I tested this on my system, which is running Perl 5.005_02, and it only
> prints out the error about using an undefined value as an ARRAY reference
> if the code is run under use strict.  Otherwise, the script ran fine.
> Could that be the difference?  Are you running your application under use
> strict but not your testing scripts?
> 
> --
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 29 Sep 1998 14:31:15 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Perl Script Running as Root
Message-Id: <6upvh2$npu$1@tempo.news.iphil.net>

How could I sortof  'su' at run-time in a Perl script?  So that I can change
some sensitive files if the script authenticates the
session.





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

Date: Mon, 28 Sep 1998 22:10:33 -0800
From: ananth@lankacom.net (ananth)
Subject: perl win32 and microsoft sql
Message-Id: <907048477.14294@wren.supernews.com>

i would greatly appreciate if somebody could let me know how i could access my microsoft sql database using perl.
i have installed perl for win32 in my system.


   -**** Posted from Supernews, Discussions Start Here(tm) ****-
http://www.supernews.com/ - Host to the World's Discussions & Usenet


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

Date: Tue, 29 Sep 1998 00:31:31 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Perl-CGI & metasend
Message-Id: <6updc9$m2u$1@tempo.news.iphil.net>

Has anyone tried using metasend with Perl-CGI?
I wonder why it's not working with CGI, althought it works well
if it's used in a Perl script. Here isthe line where it is invoked in the
CGI:

system("$METASEND -b -s $subject -F $from -t $to -f $file1 -e $encoding -m
TEXT/PLAIN >/home/bench/debug.mime");

The content of debug.mime is:

Invalid content-type specified

What could be reason?





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

Date: Tue, 29 Sep 1998 00:31:31 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Perl-CGI & metasend
Message-Id: <6upfql$m71$1@tempo.news.iphil.net>

Has anyone tried using metasend with Perl-CGI?
I wonder why it's not working with CGI, althought it works well
if it's used in a Perl script. Here isthe line where it is invoked in the
CGI:

system("$METASEND -b -s $subject -F $from -t $to -f $file1 -e $encoding -m
TEXT/PLAIN >/home/bench/debug.mime");

The content of debug.mime is:

Invalid content-type specified

What could be reason?





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

Date: Tue, 29 Sep 1998 00:31:31 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Perl-CGI & metasend
Message-Id: <6upg77$m75$1@tempo.news.iphil.net>

Has anyone tried using metasend with Perl-CGI?
I wonder why it's not working with CGI, althought it works well
if it's used in a Perl script. Here isthe line where it is invoked in the
CGI:

system("$METASEND -b -s $subject -F $from -t $to -f $file1 -e $encoding -m
TEXT/PLAIN >/home/bench/debug.mime");

The content of debug.mime is:

Invalid content-type specified

What could be reason?





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

Date: Mon, 28 Sep 1998 21:13:19 -0700
From: parrottrap@netscape.net
Subject: print $fh verses $fh->print
Message-Id: <36105E5F.C2CB3F47@netscape.net>

Why is it that an objects own print doesn't get used when being 
called indirectly?  Is there some kind of "use subs" or something I can
do to work around this?

Thanks.

package My_Handle;
use IO::Handle;
@ISA = qw(IO::Handle);
sub print {
	my $self = shift;
        $self->SUPER::print("My_handle 'print' :",@_);
}
sub p {
	my $self = shift;
        $self->SUPER::print("My_handle 'p' :",@_);
}

package main;
$fh = new My_Handle;
if ($fh->fdopen(fileno(STDOUT),"w")) {
    print $fh "Hello\n" ;
    $fh->print("Hello\n");
    p $fh "Hello\n" ;
    $fh->p("Hello\n");
}

__END__

Hello
My_handle 'print' :Hello
My_handle 'p' :Hello
My_handle 'p' :Hello


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

Date: Tue, 29 Sep 1998 02:56:18 GMT
From: "Garry T. Williams" <garry@america.net>
Subject: Re: question concerning gethostbyaddr
Message-Id: <36104C9D.41BA4676@america.net>

jasonW wrote:
> 
> Is there a way I can have my script check an I.P address for the host
> name (like using nslookup). The gethostbyaddr functions seems like it
> should do the trick, 

It will.  

>                      but I don't understand the format it requires,
> especially ADRTYPE. 

That's `ADDRTYPE'.  See perldoc -f gethostbyaddr.  See also perldoc
Socket.  The ADDRTYPE refers to the address family for the address.  In
this case, it's the Internet address family.  A handy module that will
supply everything you need is Socket.pm (and it's built right into the
Perl distribution!): 

#!/opt/perl/bin/perl -w
use strict;
use Socket;

my @some_addrs = qw(

    207.25.71.25
    204.146.18.33
    204.252.117.2
    10.0.0.1

);

my ($iaddr, $addr, $host);

foreach $addr ( @some_addrs ) {

    ## I often just write...
    ##     $iaddr = pack('C4', split(/\./, $addr));
    ## but Socket.pm supplies (exports) a handier function:

    $iaddr = inet_aton($addr);

    ## The gethostbyaddr function wants to 
    ## know what address family the address is.  
    ## Socket.pm exports the standard constant 
    ## `AF_INET' for our purpose here: 

    if ( $host = gethostbyaddr($iaddr, AF_INET) ) {

        printf "%15s -> %s\n", $addr, $host;

    } else {

        printf "%15s -> host unknown\n", $addr;

    }
}

>                      If anyone could clarify things for me I would really
> appreciate it.

No problem.  I think you will find this in the FAQ, too.  

If you are interested, the gethostbyaddr function will resolve its
arguments according to the OS configuration.  This *may* mean it will
look up a host name in some local database or file (e.g., /etc/hosts or
NIS+), but for hosts on the Internet, the answer will usually come from
the Domain Name System.  The gethostbyaddr function will formulate a
query for a PTR resource record in the `IN-ADDR.ARPA.' domain.  For our
first example above, the actual query will be for the name
`25.71.25.207.IN-ADDR.ARPA.'  If the DNS has an entry, the PTR record
returned will be a string that is the fully qualified domain name
associated with the IP address 207.25.71.25 .  

-Garry Williams


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

Date: Mon, 28 Sep 1998 22:39:12 -0300
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: Returning a "near" hash key.
Message-Id: <Pine.GSO.3.95.iB1.0.980928222906.10527A-100000@halifax>

Agreed. Since *locating* a key in an array is involved, a large number of
keys is going to benefit from a faster search.

I slightly modified Matt Knecht's method, by just putting the random key
in with the others, sorting *that*, and then searching for the random key.
Then you grab both neighbours (both Matt's, and another method, only
picked out one of the neighbours) and decide which one is "nearest",
including the case where one of the neighbours is now indeed the random 
key itself (since it could already have been present before you added it).

But conceptually similar to Matt's example, which also benchmarked very
favourably.

One possibility for refining the concept of "nearest" is to peruse
String::Approx. It's not as fast, but is much more flexible. And it
arguably will produce results that are "nearer".

 On 26 Sep 1998, Mark-Jason Dominus wrote:

> Unless the hash is very small, it is probably better to do binary
> search than linear search.
> 
> At first I thought that it was bizarre that there is no CPAN module
> for that.  But I suppose that what that shows is that most binary
> searching problems can be solved better in Perl with a hash.  This one
> is an exception.
> 
> 
> 
> 
> 



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

Date: Tue, 29 Sep 1998 02:47:22 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: STDIO redirection & child process
Message-Id: <_SXP1.44$cs.231543@nsw.nnrp.telstra.net>

In article <3611f250.281537659@news.ml.com>,
	steven_elias@ml.com (Stephen Elias) writes:
> Hello,
> 
> Is there a way to communicate with a child process via STDIN-STDOUT
> using perl.

# perldoc perlipc

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.       | crops where there ain't no crops.
NSW, Australia                      | 


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

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


Administrivia:

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

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


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3847
**************************************

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