[8312] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1929 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 19 01:07:28 1998

Date: Wed, 18 Feb 98 22:00:31 -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, 18 Feb 1998     Volume: 8 Number: 1929

Today's topics:
        A new user to the Sybase module <tuckwc@uclink2.berkeley.edu>
    Re: A new user to the Sybase module (Martien Verbruggen)
    Re: attach file to mailmessage using sendmail (Martien Verbruggen)
    Re: attach file to mailmessage using sendmail twod@not.valid
        Bug using pod2html with --podroot switch <apb.freddyb@mailexcite.com>
    Re: call URL from perl? (stevenchan)
    Re: Converting data to an array <c..bojswbo@98.usenet.us.com>
    Re: Displaying Integers (Gabor)
    Re: Displaying Integers (Gabor)
    Re: Eval subroutines left afterwards: BUG or FEATURE? <dformosa@st.nepean.uws.edu.au>
        faster way than splice? <hu@nli-research.co.jp>
    Re: Growing cucumbers - (prev Content-type Question) <matt.pryor@dial.pipex.com>
        Hardware remote control <russell@martin.com.au>
    Re: Help for Hashes !! <corky@ultranet.com>
    Re: Help for Hashes !! uri@sysarch.com
    Re: Help Need ASAP! jnorman2@usit.net
    Re: HELP!  My ISP claims that Perl access is a serious  (Troy Denkinger)
        How best to recognize undefined modules / member functi smi2704@banet.net
        How Can I get a telnetd program in a perl script <leon@www.ktnet.com>
    Re: HTTP_USER_AGENT List? (Abigail)
    Re: I want to buy a message board!!! (Martien Verbruggen)
        Internationalization schwern@starmedia.net
        newby perl string processing Q (Brian O'Connor)
    Re: newby perl string processing Q <corky@ultranet.com>
    Re: Prisoners of the evil empire (Abigail)
    Re: Prisoners of the evil empire (Clay Irving)
    Re: REMOTE_HOST (David Efflandt)
    Re: RTFM ??? (Andrew M. Langmead)
        sfio seek bug? (John D Groenveld)
    Re: sockets to webservers <agr30@uni-koeln.de>
    Re: split on ':', but not '\:' (Jeffrey Drumm)
    Re: SQL/Perl syntax question about Quotes <joe@ispsoft.de>
    Re: String Extraction and checkup (Robert F. Harrison)
    Re: ts: ts: Remove files in a PERL sript (Clay Irving)
    Re: Unlink and rmdir (Martien Verbruggen)
    Re: Variable Problem. (Martien Verbruggen)
        Writing a "println" function that works just like "prin <moe@alum.mit.edu>
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl (I R A Aggie)
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl (Stephen O. Lidie)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Feb 1998 17:33:47 -0800
From: Tucker Callaway <tuckwc@uclink2.berkeley.edu>
To: yks@ac.housing.berkeley.edu
Subject: A new user to the Sybase module
Message-Id: <34EB8BFA.CF6DBDF4@ac.housing.berkeley.edu>

Hi:

I am currently working on a project using a Web based interface to
access an inventory data base using the Sybase Module.    One problem I
am having is finding a command that will randomly access an entry from a
query.   I want the  user to able to enter a query, and page through the
results.  For example if the number of resulting entries were bigger
than say 20, then the CGI script should display those 20 entries, and
create links to the next 20 entries.

The only way I can think of doing this right now is display the first 20
entries.  Then when the user clicks for the next 20 entries.  I query
the database again but skip the first 20 entries and print the 21-40th
entries.    As you can imagine this process can get very inefficient for
large numbers of entries. (for the 101 -120 th entries I have to skip
100 entries)

What I like to do is to give a call to procedure that will take
arguments x, and y,  Where x is the first starting entry I want and y is
the number of entries after x I want.  (and do it in constant time).
But I can seem to find such a procedure in SybPerl. (or I may have
overlooked it)

Since I am a new comer to Perl programming and to using SybPerl.    Does
any one know of a possible solution to my problem?

Any suggestions is welcome.

Thanks!

Yuan



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

Date: 19 Feb 1998 02:34:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: A new user to the Sybase module
Message-Id: <6cg5mr$lpc$2@comdyn.comdyn.com.au>

In article <34EB8BFA.CF6DBDF4@ac.housing.berkeley.edu>,
	Tucker Callaway <tuckwc@uclink2.berkeley.edu> writes:

> Since I am a new comer to Perl programming and to using SybPerl.    Does
> any one know of a possible solution to my problem?

This really is quite a big question. The short answer is:

Sybperl really is a wrapper around the DB and CT libraries of Sybase.
The functionality of those libraries is made available to perl. You
will need to familiarise yourself with the documentation of these
libraries as well as with the documentation of the Sybperl modules.

That said: You might want to read up on cursor operations.

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


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

Date: 19 Feb 1998 00:50:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: attach file to mailmessage using sendmail
Message-Id: <6cfvjp$ldm$1@comdyn.comdyn.com.au>

In article <887842872.322825@news.knoware.nl>,
	penta@knoware.nl (Penta_internEtional) writes:
> I want to send an email message using PERL, using the function
> sendmail. This I can do. But, I want to attach a message within the

There is no function sendmail in perl. There is a sendmail program on
unix boxes, but you should probably not be using that. You should be
using one of the modules that you can find on CPAN to do that. I
believe one of them actually has a method called sendmail.

http://www.perl.com/CPAN/

> mail message. This I can't do. Can someone help me?

> Here's the script I have. This one does not attach a file. How to
> attach a file?

Attaching a file to an email is a different issue altogether. 
To see which headers you need to include to create 'attachments', Just
look at a message that has one, and copy its functionality. Don't
base it on one mailer though, because that will get you in trouble.

Also, read RFC 2110:

http://src.doc.ic.ac.uk/computing/internet/rfc/rfc2110.txt
MIME E-mail Encapsulation of Aggregate Documents, such as HTML (MHTML)

and RFC 2047:

http://src.doc.ic.ac.uk/computing/internet/rfc/rfc2047.txt
MIME (Multipurpose Internet Mail Extensions) Part Three:
Message Header Extensions for Non-ASCII Text

> #!/usr/bin/perl -w

-w flag, good

no use strict? bad.

[snipped re-invention of the wheel]

You really ought to check out CPAN. It has lots of modules to do what
you are doing, and probably in a better way. Especially have a look at
the modules

Mail::Internet
Mail::Header
MIME::Base64

Also read the perl FAQ, part 9

perldoc perlfaq9
/How do I decode a MIME/BASE64 string
/How do I send/read mail

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: 19 Feb 1998 02:12:45 GMT
From: twod@not.valid
Subject: Re: attach file to mailmessage using sendmail
Message-Id: <6cg4et$g28$1@vnetnews.value.net>

uuencoding the message text before piping to sendmail can make it appear as an
attachment in a number of mail front-ends in the PC world - groupwise and
exchange for certain.

It's (probably) not very portable and is low level butchery of the first 
order, but it just might work for you !

IAP


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

Date: Wed, 18 Feb 1998 21:51:07 -0500
From: "Alfred P. Bartholomai" <apb.freddyb@mailexcite.com>
Subject: Bug using pod2html with --podroot switch
Message-Id: <34EB9E1A.9643BC4E@mailexcite.com>

This is a multi-part message in MIME format.
--------------5D13D79790D157967D131634
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Please see attached file

--------------5D13D79790D157967D131634
Content-Type: text/plain; charset=us-ascii; name="BUG_2_18.98"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="BUG_2_18.98"

Subject: Bug using pod2html with --podroot switch

I am running : perl, version 5.004_04 built for sun4-solaris

I am using the pod2html utility to create html pages for all the available
perl man pages so that I can use them with my web browser to take
advantage of the cross-reference links that pod2html supposedly can give me.

However, I am running into a few problems. The following command line is
an example of how I have been using pod2html

pod2html --podroot=/home/fredb/bin/lib/perl5/pod \
	--infile=/home/fredb/bin/lib/perl5/pod/perl.pod \
	--outfile=/home/fredb/doc/html/perl.html --index --title=perl \
    --htmlroot=file:///c|internet/perl/

from which I get the following error output:

/home/fredb/bin/bin/pod2html: /home/fredb/bin/lib/perl5/pod/perl.pod: cannot res
olve L<perlmodlib> in paragraph 52: no such page 'perlmodlib'
/home/fredb/bin/bin/pod2html: /home/fredb/bin/lib/perl5/pod/perl.pod: cannot res
olve L<perlrun> in paragraph 58: no such page 'perlrun'
/home/fredb/bin/bin/pod2html: /home/fredb/bin/lib/perl5/pod/perl.pod: cannot res
olve L<perldiag> in paragraph 69: no such page 'perldiag'
/home/fredb/bin/bin/pod2html: /home/fredb/bin/lib/perl5/pod/perl.pod: cannot res
olve L<perlsec> in paragraph 71: no such page 'perlsec'

It sounds like it is saying that it can not resolve perlmodlib, for example,
because there is no such page. Well, I thought that the switch --podroot 
was supposed to indicate where such pages where located. But,
it doesn't seem to be looking in the directory I specified or it is
ignoring the switch altogether.

If anyone can help me with this or give me suggestions I would really
appreciate it.

Thank you,

Fred Bartholomai
apb.freddyb@mailexcite.com



--------------5D13D79790D157967D131634--



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

Date: Thu, 19 Feb 1998 03:15:24 GMT
From: stevenchan69@hotmail.com (stevenchan)
Subject: Re: call URL from perl?
Message-Id: <34eca394.1095132@208.149.121.250>

as i know, you should cancell the line
>print "Content-Type: text/plain\n\n";
to make the program to work as you want. try it.

On Tue, 17 Feb 1998 18:00:42 -0500, Mukund Rao <mrao@nospam.com>
wrote:

>Hello. I noticed an old posting and tried to repeat your advice.
>
>I did:
>
>#!/my/perl5/path
>
>$URL="http://www.yahoo.com";
>print "Content-Type: text/plain\n\n";
>print "Location: $URL\n";
>exit 0;
>
>...all this does is actually "print" Location: http://www.yahoo.com on my
>screen and doesn't actually "go" there. Please advise.   
>
>PLEASE REPLY TO MRAO@TRINCOLL.EDU -- Thanks.
>
>On Thu, 23 May 1996, Eike Grote wrote:
>
>: Hello !
>: 
>: Charles Wyatt wrote:
>: > 
>: > I'm aware of how to generate HTML code within a perl script using
>: > print "Content-type: text/html\n\n";  # etc, etc!
>: > 
>: > Is there a manner by which I can call a URL from a perl script that
>: > will in turn (of course) retrieve an HTML document?
>: 
>:  If you use
>: 
>:    print "Location: $URL\n\n";
>: 
>:  the browser will fetch and display the page specified by $URL.
>: 
>:  
>:  Hope this helps, Eike
>: 
>: =====================================================================
>:  Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
>:             email : eike.grote@theo.phy.uni-bayreuth.de
>:          URL : http://btrzxa.fddi.uni-bayreuth.de/~btpa25/
>: =====================================================================
>: 
>: 
>
> _    _ ____
>| \  / |    \   =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>|  \/  | () /           Mukund Rao         |      webmaster@trincoll.edu
>|      | |\ \    "visualize whirled peas"  |  Trinity College 860-297-4216
>|_|\/|_|_| \_)  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



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

Date: 19 Feb 1998 04:30:26 GMT
From: Anirvan Chatterjee <c..bojswbo@98.usenet.us.com>
Subject: Re: Converting data to an array
Message-Id: <6cgch2$s2d$1@samba.rahul.net>

georg@cyberjunkie.com wrote:
> open (MYFILE,"stuff.data");
> @numbers = <MYFILE>;

It may also be useful to chomp the resulting array so as to remove any
pesky trailing newlines (depending on whether they're wanted or not).

_____________________________________________________________________
Anirvan Chatterjee  . anirvan @ chatterjee.net .  PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/


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

Date: 19 Feb 1998 01:14:27 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Displaying Integers
Message-Id: <slrn6en24v.ecn.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Ovanes Manucharyan <olm@mail1.csun.edu> wrote :
# I have a quick question.  How can I force an integer to print with 2
# digits, instead of one.
# Lets say I have numbers 0, 1, 3, 14..    How can I make them print  00,
# 01, 03, 14
# 
# Any reference would be appreciated.

while(<DATA>) {
    chop;
    printf "%02d\n", $_;
}
__END__
1
2
4
14
109
4
56

gabor.
--
    The degree of civilization in a society can be judged by observing
    its prisoners.
        -- Dostoyevski


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

Date: 19 Feb 1998 02:05:02 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Displaying Integers
Message-Id: <slrn6en53r.eho.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Holly Sommer <SNIPhsommer@micro.ti.comSNIP> wrote :
# Ovanes Manucharyan wrote:
# 
# : I have a quick question.  How can I force an integer to print with 2
# : digits, instead of one.
# : Lets say I have numbers 0, 1, 3, 14..    How can I make them print  
# : 00, 01, 03, 14
# 
# if ($number < 10) {
#    print "0$number";
# } else {
#    print $number;
# }
# 
# This works if you KNOW the number isn't a string with a 0 in front
# of it... if it is a string with a zero, just change the if statement:
# 
# if ($number < 10 && $number !~ /^0/ )

Why give hacky solutions when you can use printf() ?
printf "%02d", $n;


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

Date: 19 Feb 1998 01:58:58 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Eval subroutines left afterwards: BUG or FEATURE?
Message-Id: <887853528.146076@cabal>
Keywords: eval sub memory leak

In <6cfabk$c4$1@news> tgautier@monazite.geoworks.com (Taylor Gautier) writes:

[...]

>Is this a BUG, or a FEATURE?

It a feature.

[...]

>It seems that when I eval a string that contains subroutines, I generate a
>memory leak, thus causing my program to grow to infinity and generally
>upsetting the machine I am running my program on.

If you wish these subs to be tidied up ect you can make use of anon subs
in your evals.  Something like this.

$x='sub {print "Platypus";}';
$monotrame=eval $x;
print &$monotrame,"\n";

And when monotrame passes out of scope the memmoury assosated with it will
be freeded.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: Thu, 19 Feb 1998 10:56:05 +0900
From: Hu Geng <hu@nli-research.co.jp>
Subject: faster way than splice?
Message-Id: <34EB9135.218EEBD0@nli-research.co.jp>

To insert columns into  a file, I use "split" to put columns into a
array then use "splice" to insert columns.
Is there any faster way?
 



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

Date: Thu, 19 Feb 1998 02:31:11 +0000
From: Matthew Pryor <matt.pryor@dial.pipex.com>
Subject: Re: Growing cucumbers - (prev Content-type Question)
Message-Id: <34EB996F.43BA8F76@dial.pipex.com>

Ah, now growing cucumbers, that
is an interesting discussion thread.

Mine seem to have withered and
gone brown during the winter - am
I using the correct compost?  Perhaps
I haven't got my vegetable patch
correctly configured.  Do I need to
have a word with my system
admin blokey?  He's in charge
of the gardens.

Any suggestions much appreciated.
Thanks.



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

Date: Thu, 19 Feb 1998 12:28:48 -0800
From: Russell Shaw <russell@martin.com.au>
Subject: Hardware remote control
Message-Id: <34EC9600.7A0A@martin.com.au>

Greetings all,

I am trying to determine if this setup would work for controlling a
piece of hardware (PC+instrumentation) connected to a phone line:

The user accesses a "web page menu" on the remote PC using a Netscape navigator browser.
The HTML web page has CGIs (common gateway interface thingies) that activate programs
written in PERL code. The PERL code does a measurement and displays a result as a graph
or numerical output on the web page.

Specifically,

	Can an HTML page interface to PERL so that not a single bit of Java
	is needed? Can the same be done for other code such as C?

I have looked through books in bookshops but the amount of time required and buying books
to find this small piece of information in the overwhelming stuff available is a 
challenge to say the least.

Assumptions:
	I know C, some C++, and assembler.
	I haven't done HTML, Perl, or Java.

--
Regards,
Russell.

MARTIN COMMUNICATIONS Pty. Ltd
Unit 140, 45 Gilby Road, Mt. Waverley, Victoria 3149 Australia
PO Box 875 Mt. Waverley 3149
Ph. +61 3 9558. 9866   Fx. +61 3 9558.9393
http://www.ozemail.com.au/‾mcomltd

    /¥  /¥  /¥  /   / MARTIN COMMUNICATIONS
   /  ¥/  ¥/  ¥/   /  Russell Shaw, B.Eng, M.Eng, MIREE
  /   /¥  /¥  /¥  /   VK3KRS
 /   /  ¥/  ¥/  ¥/    EMAIL: russell@martin.com.au


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

Date: Wed, 18 Feb 1998 20:47:13 -0500
From: Bob Trieger <corky@ultranet.com>
To: Tod Thomas <tthomas@chubb.com>
Subject: Re: Help for Hashes !!
Message-Id: <34EB8F20.6D2B@ultranet.com>

Tod Thomas wrote:

> Can I use the key valued with - foreach $userid (key %AssociativeArray)
> - to determine if an entry in another hash exists; like if
> (exists($AssociativeArray{$userid})) ??  If anybody has used a key from
> one hash to search another or can otherwise help I would really
> appreciate it.
> 
> Thanks - Tod Thomas


Don't use foreach with hashes. Use while.

while (($key,$value) = each %hash) {...}

to test for a key use

if ($hash{$key}) {...}


HTH
Bob Trieger
corky@ultranet.com


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

Date: 18 Feb 1998 23:31:02 -0500
From: uri@sysarch.com
Subject: Re: Help for Hashes !!
Message-Id: <x7oh04qkqh.fsf@sysarch.com>

Bob Trieger <corky@ultranet.com> writes:

> Tod Thomas wrote:
> 
> > Can I use the key valued with - foreach $userid (key %AssociativeArray)
> > - to determine if an entry in another hash exists; like if
> > (exists($AssociativeArray{$userid})) ??  If anybody has used a key from
> > one hash to search another or can otherwise help I would really
> > appreciate it.
> > 
> > Thanks - Tod Thomas
> 
> 
> Don't use foreach with hashes. Use while.
> 
> while (($key,$value) = each %hash) {...}
> 
> to test for a key use
> 
> if ($hash{$key}) {...}

he had it correct originally. use 'exists'. $hash{$key} will be false
if the value is actually false. exists tests for an enty (of any value)
in the hash.

also it would help to show some code that doesn't work. this is too
simple an example to write here. there are many ways of doing it as perl
is the swiss army chainsaw of languages.

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: Thu, 19 Feb 1998 04:32:48 GMT
From: jnorman2@usit.net
Subject: Re: Help Need ASAP!
Message-Id: <34ebb5d3.166606370@nntp.usit.net>

Savonnya rodrigues <srod@fedex.com> wrote:

>Need to be able to do a function call in a Perl script to a C program. I
>know someone told its not possible, but I am just asking. The program
>that I am using is doing a function call in C to a C compiler. Is there
>a way I could use a function call for Perl?




This would be really great! :)


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

Date: Wed, 18 Feb 1998 03:56:13 GMT
From: troy@whadda.com (Troy Denkinger)
Subject: Re: HELP!  My ISP claims that Perl access is a serious security risk!
Message-Id: <6cgan3$6ee$1@hirame.wwa.com>

In article <34EA7257.E57D37A8@coos.dartmouth.edu>, rjk@coos.dartmouth.edu wrote:
>Troy Denkinger wrote:
>> 
>> Do you guys really think the ISP in this case was
>> over-the-top in requesting that those with access to the
>> Perl interpreter (or other cool tools) pay attention to the
>> security of their accounts?  I'm of the opinion that
>> everyone should be required to exercise some basic security
>> procedures on their accounts, but that's probably out of the
>> question.
>
>In your first response, you quoted part of the ISP sysadmin's response out of
>context in order to defend him.  If you go back and read the original message,
>you will notice that the sysadmin does *not* offer to give Perl access if the
>user will be responsible for his account.  The sysadmin says that such a

I have to strongly disagree with your interpretation.  I was 
initially going to apologize for misinterpreting the 
original post and also agree that the guy should get a 
different ISP.  To satisfy my curiosity and figure out how 
I'd misinterpreted this, I went to Deja News.

If you look at the original post, you'll find my quoting was 
in context and that the ISP was offering Perl access "to a 
user" which seems to be different than a webserver account 
in this context.

Finally, since Tom has followed up to say that the ISP has 
blown off his offer to do whatever it takes, I would agree 
that a new ISP is in order.

Regards,

Troy Denkinger
A sometimes sysadmin with users who ought to know better.


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

Date: Wed, 18 Feb 1998 20:59:21 -0500
From: smi2704@banet.net
Subject: How best to recognize undefined modules / member functions 
Message-Id: <34EB91F9.754F@banet.net>

I have been incrementaly implementing a series of modules.  In one base
module which calls a function say new in another I test first to see if
the other module is defined.  If defined I invoke $pkg->new(), if not I
invoke base::new().
My Implementation takes the form:
Separate package: ...
package A;
 ...
$here = 1;

Central (dispatching package)
 ...
package C;
 ...
$here = ${$pkg . '::' . "here"}		# Ok...almost strait from p538
					# Programming Perl
if (defined($here))
	{
	$pkg->new();
	}
else
	{
	... go generic
	}

I tried to check directly for the existence of "$pkg::new" but in all my
variations I either called the function (defined or not) or got other
eroneous results.  Any Ideas?
Thanks,
Ray Smith, work: smithr@lexma.meitech.com


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

Date: Thu, 19 Feb 1998 11:26:06 +0900
From: Kyong-yong Yu <leon@www.ktnet.com>
Subject: How Can I get a telnetd program in a perl script
Message-Id: <34EB983E.1177FB07@www.ktnet.com>

Hi.

I am searching for a telnetd program in a perl script.

Where can I get it?

Any help would be much appreciated.

Thanks.

-------------------------------------------
Kyong-yong Yu
(leon@www.ktnet.co.kr)



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

Date: 19 Feb 1998 01:16:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HTTP_USER_AGENT List?
Message-Id: <6cg14j$ab6$1@client3.news.psi.net>

Bill Jones (webmaster@fccj.cc.fl.us) wrote on 1632 September 1993 in
<URL: news:34EB7232.2B0D3548@fccj.cc.fl.us>:
++ Using CGI.pm you could write your own and log the results...

YM: Use LWP::UserAgent and create a few of your own....



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 19 Feb 1998 00:55:30 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: I want to buy a message board!!!
Message-Id: <6cfvu2$ldm$2@comdyn.comdyn.com.au>

In article <6cfddk$45g@camel15.mindspring.com>,
	"Rick Ryan" <rickryan@datrixnet.com> writes:
> Does anyone have a message board (with source) for sale? I'd prefer
> something stores messages in a database instead of text files.

I suppose you're talking about some sort of CGI discussion forum thingy?

> Any ideas? How much?

Go to http://www.cgi-resources.com/ and find one there.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.       | make a better idiot.
NSW, Australia                      | 


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

Date: Wed, 18 Feb 1998 22:11:49 -0600
From: schwern@starmedia.net
Subject: Internationalization
Message-Id: <6cgbe5$vm8$1@nnrp1.dejanews.com>

I'm looking for a scheme to internationalize my perl programs and reports.
Everything.  Error reports, output data... the works.

The company I work for (Starmedia Networks) deals exclusively with Latin &
South America and all content is translated into Spanish and Porteguese by a
team of translators located in Columbia.  This is great for static text and
HTML pages, but the all the output of my programs must be translated as well.

I need something to ease this translation process for all strings and output
in my programs.  Something similar to GNU's gettext (which appears to be
exclusively for C, alas) and preferably something that works with emacs.

And as long as I'm wishing, I'd like a pony. :)

Many thanks.


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

Stupid

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 19 Feb 1998 03:25:09 GMT
From: boc@thistle.bendigo.latrobe.edu.au (Brian O'Connor)
Subject: newby perl string processing Q
Message-Id: <6cg8ml$2lt$1@news.latrobe.edu.au>

OK, I've looked and looked but I can't find this;

How do I extract a particular field from a line of char delimited
fields without assigning the whole lot to unused variables. eg

A password file, I want the 4th field(grp id)

I can

($a,$b,$c,$d,$e,$f,$g) = split(/:/);

then use $d, but there must be a better way

boc
--

                   Brian O'Connor, Unix Systems Consultant
  La Trobe University,Bendigo,Australia; b.oconnor@latrobe.edu.au


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

Date: Wed, 18 Feb 1998 23:10:39 -0500
From: Bob Trieger <corky@ultranet.com>
To: b.oconnor@bendigo.latrobe.edu.au
Subject: Re: newby perl string processing Q
Message-Id: <34EBB0BE.4A12@ultranet.com>

Brian O'Connor wrote:
> 
> OK, I've looked and looked but I can't find this;
> 
> How do I extract a particular field from a line of char delimited
> fields without assigning the whole lot to unused variables. eg
> 
> A password file, I want the 4th field(grp id)
> 
> I can
> 
> ($a,$b,$c,$d,$e,$f,$g) = split(/:/);
> 
> then use $d, but there must be a better way


@array = split(/:/); #this reads your string into an array

then you just reference the 4th element in the array.
arrays count from 0 so $array[3] is your choice.


HTH
Bob Trieger
corky@ultranet.com


PS. I was in a good mood so I removed the munge from your return
address.


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

Date: 19 Feb 1998 01:18:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Prisoners of the evil empire
Message-Id: <6cg19f$ab6$2@client3.news.psi.net>

Matthew Pryor (matt.pryor@dial.pipex.com) wrote on 1632 September 1993 in
<URL: news:34EB6EDB.BEB32D11@dial.pipex.com>:
++ Can someone tell me what a Prisoner of the Evil Empire actually is?


$ grep "Evil Empire" ‾/.Xdefaults
Netscape*menuBar*netscape.labelString:  The Evil Empire
$

But I think that for most people the Evil Empire is rules by King Bill.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 18 Feb 1998 21:22:44 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Prisoners of the evil empire
Message-Id: <6cg51k$prb@panix.com>

In <6cfvra$j1i@panix.com> hood@panix.com (Philip Hood) writes:

>Or those who don't have a PANIX account w/ perl as there shell.

Eh? When did Perl become a shell anywhere?

>more later ...
>PH

We can't wait to hear the exciting conclusion!

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/‾clay/


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

Date: Thu, 19 Feb 1998 01:24:39 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: REMOTE_HOST
Message-Id: <34ef8823.4398149@flood.xnet.com>

trollboy@usa.net (Steve) wrote:

>How do i have a script log your ip address so it looks like for
>example this:   p9.ts3.lowel.MA.tiac.com   instead of    207.60.164.74

$ip_address = $ENV{'REMOTE_ADDR'};
@numbers = split(/¥./, $ip_address);
$ip_number = pack("C4", @numbers);
($host) = (gethostbyaddr($ip_number, 2))[0];
$host = $ip_address unless $host;	# optional

The last line is if you want the IP if there is no hostname, otherwise
$host would be null if not resolved.  Some IP's have no hostname or it
may be blocked by a firewall, proxy, etc.


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/‾efflandt/


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

Date: Thu, 19 Feb 1998 02:27:36 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: RTFM ???
Message-Id: <EoLtI0.Hz6@world.std.com>

patrickq@autobahn.mb.ca (Patrick) writes:

>Seems to be a lot of RTFMing in clpm recently.  

>I would be unemployed if people did if fact RTM as I do help-desk for
>some windoze software that has a .hlp file four times the size of the
>.exe.  As it is, I have a job for life <sigh>

The difference is, that you are being paid to read the manual to the
users that won't.

Have you every noticed that every once and a while you get a
fascinating question from someone who is trying to use your product in
a way you (or maybe anybody) ever has before? And once you're done,
you think to yourself "that is so neat." and you're filled with a
sense of awe and wonderment.

Programmers are probably people who are addicted to that feeling. They
are people who take an infinitely configurable machine, and modify it
to do as they want. (Picture each computer as being something better
than worlds biggest Lego set.) Anything from an alarm clock, to a word
processor, its just a matter writing the correct instructions to make
the machine configure itself to do it.

But now, in comp.lang.perl.misc, you have a bunch of people who aren't
even asking how to make the pieces fit together, but what the
individual pieces are. ("How do I get my lego project to roll accross
the table?" "You use one of those pieces that have the wheels
attached.") Or questions that aren't about building at all. ("The
motor stopped moving. How do I get it to start again?" "The batteries
are probably dead. You can buy new batteries at any department or
convienience store.")

There are so many interesting things that can be done in perl. I'd
like to hear about a few of them.
-- 
Andrew Langmead


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

Date: 18 Feb 1998 21:58:44 -0500
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: sfio seek bug?
Message-Id: <6cg754$9vl$1@tholian.cse.psu.edu>

Perhaps this is RTFM or bad coding style or both, but can some explain why
this doesnt work with sfio enabled perl5.004_04.
Many thanks,
John
groenveld@acm.org

#!/usr/bin/perl -w
use strict;
use FileHandle;
use Net::FTP;
 
my $ftp = new Net::FTP('sunsolve.sun.com');
my $file = "/tmp/foobar.$$";
my $fh = new FileHandle($file, "w+") or die $!;
$fh->autoflush(1);
$ftp->login();
$ftp->cwd("/pub/patches");
$ftp->get('2.6_x86_Recommended.README', $fh);
$fh->seek(0, 0); # does not work with sfio, have to close and reopen
#$fh->close;
#$fh = new FileHandle($file, "r") or die $!;
while (<$fh>) {
    print;
}
$fh->close;
unlink $file;


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

Date: 19 Feb 1998 00:16:15 +0100
From: Martin Bialasinski <agr30@uni-koeln.de>
Subject: Re: sockets to webservers
Message-Id: <87en10tsg0.fsf@haitech.internet-treff.de>

"Devin P. Anderson" <dev@sgi.net> writes:

> What socket options should one use to connect to a webserver? I've done
> socket programming before, but when I try to read from the socket to
> this webserver, it just hangs. Heres the code.
> 
> socket(SOCK,PF_INET,SOCK_STREAM,$proto);
> connect(SOCK,$paddr);
> 
> And I know that the paddr is fine. I'm stumped!

Did you set autoflush for the handle? If you don't set it, then perl will
buffer the request you send to the server, so your read will block.

Maybe you should use IO::Socket instead. Or one of the spezialised modules
from the LWP.

Ciao,
	Martin


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

Date: Thu, 19 Feb 1998 01:00:53 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: split on ':', but not '¥:'
Message-Id: <34eb7d45.94601449@news.mmc.org>

[Apologies - corrected courtesy copy cc:'ed to original poster]

On Wed, 18 Feb 1998 19:17:04 GMT, drummj@mail.mmc.org (Jeffrey R. Drumm)
wrote , somehow screwing up his example:

(Original post and double-quotish stuff deleted)

>$line = 'one:two:three¥:here:four';
>@stuff = split /¥b[^¥¥]?¥b:¥b/, $line;

Oops. There's an extraneous ¥b between  the '?' and ':' above - example
should've read:

@stuff = split /¥b[^¥¥]?:¥b/, $line;

>The regex matches on a word boundary followed optionally by anything NOT a
>backslash, then a colon,then another word boundary.  If I:

(output deleted)

>PS. critiques welcome (but I know I'll get them even if I say they're not ;-))

Well, I'll critique myself then.  This works for the example posted, but
fails for situations where non-word characters other than the backslash
fall before the colon. It'll fail on:

>$line = 'one.:two#:three¥:here+:four';

The "words" get split out OK, but the non-word characters get lopped off
the ass ends of the array elements. Soooo . . . guess it's time to upgrade
to 5.00455 (yikes!).


-- 
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org


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

Date: Thu, 19 Feb 1998 01:06:13 +0100
From: Jochen Wiedmann <joe@ispsoft.de>
To: Mike Heins <nospam@minivend.com>
Subject: Re: SQL/Perl syntax question about Quotes
Message-Id: <34EB7775.DC9C602@ispsoft.de>

Hello, Mike,


>         $query = qq!SELECT * FROM employee WHERE lastname = '$name'!;

Sorry, but your example is wrong: $dbh->quote is already adding
quotes ... :-)



-- 
Jochen Wiedmann					joe@ispsoft.de
						07123 14887



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

Date: 18 Feb 98 18:52:03 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: String Extraction and checkup
Message-Id: <slrn6embeb.enu.harrison@localhost.localdomain>

On Wed, 18 Feb 1998 09:57:59 +0100, Evert Smit <evert.smit@eds.ch> wrote:
> i am looking for a piece of perl script, that will look at a string, rip
> it appart, check if it is 8 digits long and make sure that there are 2
> numbers in it. I am sure someone has this one already and would be
> eternally thankful, if i could use it.

No one has done this before.  I asked everybody.  Here's why:

Good news, you don't need any script at all. The answer is all strings
of 8 digits contain at least 2 numbers.

     12345678

That's one example.  It is 8 digits long and contains a lot of numbers
depending on how you parse it.  If you break out a pencil and some
paper and start writing down strings of 8 digits you will soon see
it's hard to make one that doesn't have 2 numbers in it.

So I'm going to assume you mean 8 characters long. And, since it
seemed you meant characters instead of digits, I'm thinking you
probably really wanted a sort of combination like this:

					twothree

This is eight characters long and contains two numbers.  It gets a
little trickier with:

					fortyone

Now, is that 1 or 2 numbers?

Now you don't have to test against nineteen because it's 8 characters
long and is only one number. So, if the smallest numbers you have are
one, two, six, and ten, the largest can only be five characters long.

Let's see:

zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven - nope
twelve - nope
*teen - nope
twenty* - nope
thirty* -nope
forty - yep, but you have to decide the logic of fortyone, fortytwo,
        and fortysix.
fifty - yep, same problem
sixty - yep, same problem
seventy* - nope
eighty* - nope
ninety* - nope

So we are going to have to test against at least 10 strings and
possibly 13 if you decide that fortyone (or any of those types of
strings) are two numbers and not one number. And we'll have to make
sure to we use a case insensitive match.

Having defined the problem, I'm going step aside at this point and let
someone who can optimized regexing take over. I've read the FAQ on
regular expressions and operations and could write an inefficient
script, but I've spent too much time on this already.

It's really too bad you don't want something really simple like
checking for at least 2 digits in string exactly 8 characters in
length cause that'd use simple tests that even a cursory glance at
the documentation would have shown you how to do.

Thanks for your thought provoking question. 

--
-rfh harrison@pixi.com


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

Date: 18 Feb 1998 21:12:27 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: ts: ts: Remove files in a PERL sript
Message-Id: <6cg4eb$otp@panix.com>

In <6cfisb$tok$1@orthanc.reference.com> tsatan@hotmail.com writes:

>From the keyboard of Tom Christiansen <tchrist@mox.perl.com>:
>| In comp.lang.perl.misc, tsatan@hotmail.com writes:
>| :Wrong. Use the unlink function like this:
>|
>| Don't tell people answers that are in the manpages or faqs.

>Wrong. You so easily dismiss people who are new to perl.
>I don't feel it's proper for you to cut and dry it as you
>do. 

Therein lies the problem with your arguement -- You don't count.
No one cares one wazoo what you think is improper behavior for Tom. :)

> It doesn't help the discussion for you to be so impenetrable.

It doesn't "help the discussion" to constant get a bazillion questions
asked over and over and over and over and over and over and over again
when the question and answer is available in the manpages or faqs included
with the Perl distribution or online at www.perl.com.

Now, go bother another newsgroup...

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/‾clay/


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

Date: 19 Feb 1998 02:44:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Unlink and rmdir
Message-Id: <6cg6af$ltj$1@comdyn.comdyn.com.au>

In article <34EB3DF3.F7E@tietogroup.com>,
	Kari Marttila <Kari.Marttila.@tietogroup.com> writes:

> I am quite sure, that the reason is
> somewhere in perl script, because I know that the directories are not
> locked by some other process. I use Perl 5.004_02 in NT 4.0.

So where is your script? How are we supposed to figure out what might
be wrong without seeing the code? You are checking the return codes of
all the system calls, aren't you?

Did you ever consider doing something like:

use File::Path;
rmtree('/kill/this/tree');

perldoc File::Path

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd.       | thing but mean your mother.
NSW, Australia                      | 


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

Date: 19 Feb 1998 02:24:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Variable Problem.
Message-Id: <6cg542$lpc$1@comdyn.comdyn.com.au>

In article <34EB9EB8.177C@arrowweb.com>,
	Mike <mhanson@arrowweb.com> writes:
> My problem is i made a program that is used to send mail to members on a
> database. But what i want to do is when i enter $name in the form page i
> want it to insert the variable $name into it but the program doesn't it
> just prints $name. Please help.

Maybe what you should do is go and read some perl documentation:

perldoc perldata

Pay special attention to any paragraphs talking about single and
double quotes. If, after that, you are still unclear about what is
going wrong in your program, please feel free to post again, but this
time, include some of the actual code that you are using, so we can
really point out what you might be doing wrong.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Wed, 18 Feb 1998 21:19:02 -0500
From: "Mohamed Hendawi" <moe@alum.mit.edu>
Subject: Writing a "println" function that works just like "print"
Message-Id: <6cg51m$9rs$1@ha2.rdc1.ct.home.com>

I would like to implement a simple function "println" that works
exactly like the built-in perl print function, except that it appends
a newline to the printed output.  I could use a simple subroutine to
do this, but then I would not be able to specify filehandles the same
way you can with print.   I want the exact same "indirect object" method
of invocation for the "println" method:

  println "foo";
  println STDERR "foo";

Obviously sub { print @_, "¥n" } does not work because of the filehandle
issue.

I couldn't find anything in the way of function prototypes that would do
what I want.  I also couldn't find anything in the FAQ.

Any suggestions?

Thanks

-Moe (moe@alum.mit.edu)





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

Date: Wed, 18 Feb 1998 21:14:14 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <fl_aggie-1802982114150001@aggie.coaps.fsu.edu>

In article <34EB6CD7.495A1998@strata-group.Xcom>, Steve Dover
<swd@strata-group.Xcom> wrote:

+ Time marches on, but by design, a given date or timestamp datam
+ will only be allocated so many bits.  At some point in time,
+ more bits will need to be allocated.  There's no way around it.

Not necessarily. Our concept of 1998 is based on an arbritrary
decision of when year 0 starts. We could just as easily redefine that
to something convenient.

Its arbritrary, after all.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 19 Feb 1998 02:13:23 GMT
From: lusol@turkey.cc.Lehigh.EDU (Stephen O. Lidie)
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6cg4g3$1k62@fidoii.cc.Lehigh.EDU>

Abigail (abigail@fnx.com) wrote:
: Steve Dover (swd@strata-group.Xcom) wrote on 1632 September 1993 in
                                                              ????
: <URL: news:34EB6CD7.495A1998@strata-group.Xcom>:
: ++ 
: ++ Time marches on, but by design, a given date or timestamp datam
                                                                  u 
: ++ will only be allocated so many bits.  At some point in time,
: ++ more bits will need to be allocated.  There's no way around it.

Yoda:  "But there will be [a way around it]."

: Who says there has to be a limit on the number of bits?

Yup, although the solution may not be "more bits".  One of the most important
things "growing old" has shown me is how often the human animal
underestimates (read cannot realize) what can be done simply because it does
not understand (read cannot realize) the complexities of the physical
universe.


bug
--
Stephen.O.Lidie@Lehigh.EDU
Lehigh University Computing Center, USA


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

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

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