[8017] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1642 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 21:05:29 1998

Date: Wed, 14 Jan 98 18:00:24 -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, 14 Jan 1998     Volume: 8 Number: 1642

Today's topics:
     [Help] Net::NNTP & inetd/sockets <root@lsi144.dtr.fr>
     [Q] Database Reccomendations for Perl on Unix <Brandon@byu.edu>
     Re: Anyone got a pretty printer for perl? (Ilya Zakharevich)
     Re: Can I create a Linked List in Perl <ruben@wynn.com>
     Re: deleting old files (James Amihara)
     Re: deleting old files (Charles DeRykus)
     Re: Displaying GIFs - oops <rootbeer@teleport.com>
     Re: Displaying GIFs - oops (brian d foy)
     Re: elegant way to compare two arrays <rootbeer@teleport.com>
     Re: getting charecters from a variable <rootbeer@teleport.com>
     Re: Help Removing Spaces <rootbeer@teleport.com>
     Re: Help with my code please <merlyn@stonehenge.com>
     Help!!!  DG/UX Compile Problem <alan@protix.com>
     Re: Help: sending HTML by email from Perl/CGI <rootbeer@teleport.com>
     Re: Help: sendmail can not send international character <rootbeer@teleport.com>
     Interactive Processes <gdwillia@socs.uts.EDU.AU>
     Looking for HTML template script <bob@unews.com>
     Re: Module Installation for Perl 5.004_04 under AIX (Martien Verbruggen)
     Re: Perl on Windows NT <rootbeer@teleport.com>
     Re: PERL programmer needed. <ruben@wynn.com>
     Re: Problem calling a cgi from cgi <rootbeer@teleport.com>
     Re: Query on Uncaught Exception <rootbeer@teleport.com>
     Re: Query on Uncaught Exception (Charles DeRykus)
     Re: source into binary code <rootbeer@teleport.com>
     Re: source into binary code (brian d foy)
     Re: source into binary code <tchrist@mox.perl.com>
     Re: Would this code be right <rootbeer@teleport.com>
     Re: Writing to a file in Win32 and Unix <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Jan 1998 01:29:35 +0100
From: Thierry Berger-Perrin <root@lsi144.dtr.fr>
Subject: [Help] Net::NNTP & inetd/sockets
Message-Id: <34BD586F.17019952@lsi144.dtr.fr>

Config: Linux, perl 5.004_04, Net::NNTP 2.17

 I've written a small&dirty news sucker in perl and while it ran quite
well when launched from the shell, it failed desperatly when spawned
from inetd:
 the symptoms were that the output was messed upon the connection with
the news server and/or the connection to the server failed (without any
incomming connection from the server viewpoint)
 So i've come to think it was the mix between STDIN/OUT output and
Net:NNTP objects that was causing the mess. I've rewrote the thing using
IO::Handle and sysread/write calls and finally i've done a standalone
version which listen on a socket(IO::Socket) and doesn't use inetd
anymore. But the result is the same:
whenever the nntp connection is done, my other IO are screwed!

I'm not a perl guru, i must admit i'm clueless, so any pointer/help is
welcome.
-- 
tbp@dtr.fr
"Use the source, Luke."


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

Date: Wed, 14 Jan 1998 17:00:36 -0700
From: Brandon Pulsipher <Brandon@byu.edu>
Subject: [Q] Database Reccomendations for Perl on Unix
Message-Id: <34BD51A4.AB7AAF94@byu.edu>

I have some Microsoft Access database's that I have been using thru Perl
Win32:ODBC on a Windows NT webserver.  The time has come to move to a
Unix box.  Obviously I there is not way for me continue using the
MS-Access databases (at least that I know of).  Therefore, does anyone
have suggestions for what to convert these database to, so that I can
work with them thru Perl 5 on Unix?  I will be using a virtual host and
do not have a huge amount of control to install other packages.
If there may be a better solution to my problem, please let me know.
Thank you.

-Brandon Pulsipher
-Brandon.Pulsipher@usa.net



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

Date: 14 Jan 1998 23:55:41 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Anyone got a pretty printer for perl?
Message-Id: <69jj9t$496$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Randal Schwartz 
<merlyn@stonehenge.com>],
who wrote in article <8c3eixa9am.fsf@gadget.cscaper.com>:
>     Perl is incredibly difficult to parse.  For example,
>     what's the difference between these:
> 
> 	    time /3 ;#/; print "hello";
> 	    sin /3 ;#/; print "goodbye";

CPerl (with a capable Emacs) highlights /3 ;#/ as a string, #/; print "goodbye";
as a comment.

>     Right.  The first one is time divided by 3, and the print is in a
>     comment.  The second one is the sin of the result of a regular
>     expression match for "3 ;#", and the print gets executed!

So it does it the opposite way to the Perl :-).  I need to change tables...

Ilya


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

Date: Wed, 14 Jan 1998 20:02:53 +0000
From: Ruben <ruben@wynn.com>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <34BD19ED.DD6622FE@wynn.com>

You can create a linked list, but WHY would you want to if you have
associative arrays which dynamically contain data.

Ruben


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

Date: 15 Jan 1998 00:31:03 GMT
From: amihara@Hawaii.Edu (James Amihara)
Subject: Re: deleting old files
Message-Id: <69jlc7$ilb@news.Hawaii.Edu>

	thanks for the responses... but i wanted to write a
	perl program to do delete files that are older
	than 7 days old from a particular directory. those
	commands below are not perl commands are they? 
	i wanted to know how to write a perl program, not
	to do it from the unix prompt... thanks


Tad McClellan (tadmc@flash.net) wrote:
: James Amihara (amihara@Hawaii.Edu) wrote:
: : 	i want to write perl code to read a directory, and
:                                      ^^^^^^^^^^^^^^^^

: perldoc -f opendir

: perldoc -f readdir

: : 	delete any files that are older than 7 days from the
:         ^^^^^^     ^^^^^

: perldoc -f unlink


: : 	current system date. does anyone know how to do that?

: Yes.


: : 	how do you get the last modified date on a file
: : 	and read that into a perl program? thanks...


: perldoc -f stat

: and

: perldoc -f -X


: --
:     Tad McClellan                          SGML Consulting
:     tadmc@metronet.com                     Perl programming
:     Fort Worth, Texas

--


       ________
      /__   __/
        /  /___   ==========================================================
 ___   /  ___  \   James Amihara                      Phone: (808) 453-6565
/  /__/  /__/  /  University of Hawai'i - West O'ahu    Fax: (808) 453-6075
\____    __   /  96-043 Ala Ike                          amihara@hawaii.edu
    /  /  /  /  Pearl City, Hi 96782      http://www.uhwo.hawaii.edu/~james
   /__/  /__/  =============================================================



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

Date: Thu, 15 Jan 1998 00:09:18 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: deleting old files
Message-Id: <EMstrJ.Lo2@bcstec.ca.boeing.com>

In article <69jc18$cu6@news.Hawaii.Edu>,
James Amihara <amihara@Hawaii.Edu> wrote:
>	i want to write perl code to read a directory, and
>	delete any files that are older than 7 days from the
>	current system date. does anyone know how to do that?
>	how do you get the last modified date on a file
>	and read that into a perl program? thanks...
>

perldoc File::Find 
man perlfunc and look for -M file test operator

or check out "Learning Perl" by R.Schwartz, T.Christiansen
for some good examples.


HTH,
--
Charles DeRykus


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

Date: Wed, 14 Jan 1998 16:35:31 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Porter <jdporter@min.net>
Subject: Re: Displaying GIFs - oops
Message-Id: <Pine.GSO.3.96.980114163446.2093U-100000@user2.teleport.com>

On Wed, 14 Jan 1998, John Porter wrote:

> Don't forget, you can't send html content and image content
> in the same response! 

I can. But (of course) I don't have to use any particular protocol if I
don't wish to. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 20:34:33 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Displaying GIFs - oops
Message-Id: <comdog-ya02408000R1401982034330001@news.panix.com>
Keywords: from just another new york perl hacker

In article <Pine.GSO.3.96.980114163446.2093U-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> posted:

>On Wed, 14 Jan 1998, John Porter wrote:
>
>> Don't forget, you can't send html content and image content
>> in the same response! 
>
>I can. But (of course) I don't have to use any particular protocol if I
>don't wish to. :-)

since Elijah uses Lynx, i include uuencoded image data in the 
comments of some of my web things.  not many people seem to 
notice why a short paragraph needs to transfer 50k ;)

-- 
brian d foy                                  <comdog@computerdog.com>
Meta Meta FAQ <URL:http://computerdog.com/Meta_MetaFAQ.html>


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

Date: Wed, 14 Jan 1998 16:33:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tobias Bugala <TobiasBugala@swol.de>
Subject: Re: elegant way to compare two arrays
Message-Id: <Pine.GSO.3.96.980114162953.2093S-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Tobias Bugala wrote:

> what would be the most elegant way to compare two different arrays?
> 
> if (@arrayone == @arraytwo) {..}
> 
> doesn't work...

Sure it does. It simply doesn't do what you might have expected it to do. 
:-) 

> while (($arrayone[$i] == $arraytwo[$1]) && ($arrayone[$i] != "")) {
>       i++;
>       }

(I think you meant $i where you put $1.) Of course, this presupposes that
you want that type of half-mathematical comparison. You could also compare
as straight strings or numbers.

> do you know a better way?

It really depends upon just what you're trying to test. Do you wish to
know whether each element is mathematically equal, or do you wish to order
the arrays somehow? Do you care about elements which are undef? Or which
are non-numeric? Without a better idea of the goal, it's hard to pick a
route.

Cheers!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 16:36:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Robertson <mat.r@ukonline.co.uk>
Subject: Re: getting charecters from a variable
Message-Id: <Pine.GSO.3.96.980114163607.2093V-100000@user2.teleport.com>

On 14 Jan 1998, Matthew Robertson wrote:

> I am try to get the first six charecters from a variable and store them in
> seperate variables, or seperate array elements.

> I am trying to use substr at the moment, but I am getting some strange
> results.

How have you tried it, and what could the strange results be?

    $first = substr($string, 0, 1);

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 16:34:20 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Abdo Hashem <hashema@icd.teradyne.com>
Subject: Re: Help Removing Spaces
Message-Id: <Pine.GSO.3.96.980114163403.2093T-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Abdo Hashem wrote:

> How do I remove any leading AND trailing whitespace on the strings
> entered??  

Does the method in the FAQ work for you? Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Jan 1998 17:17:00 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Webmaster@builders-connection.com
Subject: Re: Help with my code please
Message-Id: <8cyb0ik2v7.fsf@gadget.cscaper.com>

>>>>> "Builders" == Builders Connection <Webmaster@builders-connection.com> writes:

Builders> #!/user/bin/perl
Builders> # Program to do the obvious
Builders> #checking for any comma's
Builders> #Can I combined the substitute statement and have it chek for both at
Builders> one time
Builders> $sitename =~ s/,//;
Builders> $type =~ s/,//;
Builders> $name =~ s/,//;
Builders> $address1 =~ s/,//;
Builders> $city =~ s/,//;
Builders> $state =~ s/,//;
Builders> $zip_code =~ s/,//;
Builders> $country =~ s/,//;
Builders> $phone =~ s/,//;
Builders> $phone2 =~ s/,//;
Builders> $e_mail =~ s/,//;

Builders> #checking for any \n
Builders> $sitename =~ s/\n//;
Builders> $type =~ s/\n//;
Builders> $name =~ s/\n//;
Builders> $address1 =~ s/\n//;
Builders> $city =~ s/\n//;
Builders> $state =~ s/\n//;
Builders> $zip_code =~ s/\n//;
Builders> $country =~ s/\n//;
Builders> $phone =~ s/\n//;
Builders> $phone2 =~ s/\n//;
Builders> $e_mail =~ s/\n//;

for (
	$sitename,$type,$name,$address1,$city,$state,$zip_code,
	$phone,$phone2,$e_mail
) {
	tr/\r,//d;
}

Builders> open(FILE, ">> builders.txt")|| die "I can't open: Database\n";
Builders> print FILE
Builders> "$sitename,$type,$name,$address1,$city,$state,$zip_code,$country,$phone,$phone2,$e_mail
Builders> \n";   #Print a message
Builders> close(FILE);

But beware -- removing "," from an email address may invalidate it.

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

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


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

Date: Wed, 14 Jan 1998 19:38:19 -0500
From: "Alan Fahrner" <alan@protix.com>
Subject: Help!!!  DG/UX Compile Problem
Message-Id: <69jlqj$aig@bgtnsc02.worldnet.att.net>

Hi...

I can't, for the life of me, get perl 5.004_4 to compile properly under
DG/UX 4.11MU03 (using the distributed compiler)...

It always fails parts of it's testing when trying to dynmically load
libraries...

Has anyone compiled it successfully on my version of DG/UX?

I'll be glad to share more exact test failures, but figure first I'd check
to see if anyone has successfully done it...

Thanks!

Alan




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

Date: Wed, 14 Jan 1998 16:20:46 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: grover@northwood.edu
Subject: Re: Help: sending HTML by email from Perl/CGI
Message-Id: <Pine.GSO.3.96.980114161648.2093Q-100000@user2.teleport.com>

On 14 Jan 1998 grover@northwood.edu wrote:

> I have written a Perl CGI script which, among other things, sends an
> HTML-encoded document via Sendmail. 
> 
> However, when it is received by some users of Netscape mail, after they
> call up the email, they see all the HTML code rather than a formatted
> Web-type page (as I intended). 

This is like complaining that when you mailed a box of ice cream to your
friends, all that they got was a sticky mess. :-)  HTML is for web pages; 
if you want your friends to see a web page, mail them an URL and ask them
to take a look.

> Can someone tell me how to modify my Perl script (or how to have them
> reconfigure their Netscape mail program?) so that the HTML tags are
> interpretted, not shown? 

If there is a way to do this at all, the answer is to print some different
output. How the output is to be different is beyond the scope of this
newsgroup, though. (You may need to ask in a newsgroup about sendmail or
about your friends' mail clients.) Cheers! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 15:50:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: ChuoSenko <thada@chuosenko.th.com>
Subject: Re: Help: sendmail can not send international character
Message-Id: <Pine.GSO.3.96.980114154900.2093I-100000@user2.teleport.com>

On Wed, 14 Jan 1998, ChuoSenko wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: Help: sendmail can not send international character
> 
> I have problem about sendmail .

Then why are you asking in a newsgroup about Perl? People who like to
answer questions about sendmail tend to read comp.mail.sendmail. But, of
course, they appreciate it if you read the docs and FAQs before posting.
Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 15 Jan 1998 11:01:34 +1100
From: Glenn Williamson <gdwillia@socs.uts.EDU.AU>
Subject: Interactive Processes
Message-Id: <Pine.SOL.3.95.980115105529.29756A-100000@peppermint-patty>

Mornin' All,


In my little Perl manual, it says that I can't open a Unix process for
both input and output.

     open(PROGRAM, "| blah"); or open(PROG, "blah |");

Is there any way around this? Or any reason why it's impossible? ;)
Eventually, I would like to run a telnet session thru a perl script,
this is just the first wall I have come to ;)

			gleNN
                          



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

Date: Wed, 14 Jan 1998 18:54:49 -0600
From: "Bob" <bob@unews.com>
Subject: Looking for HTML template script
Message-Id: <69jmo2$ih9$1@ns3.umkc.edu>

Help!  My ISP is running Apache but has made it so that you can't include
files that are not in the same directory as the .shtml file calling them.
I'm looking for a script (I'm just getting started writing Perl scripts so I
can't write it mysef) that will allow me to do the following:

**insert header text from template file1**

**insert "story" text from simple HTML file**

**insert footer text from template file2**

Any suggestions or ideas would be greatly appreciated.

Thanks,

Bob




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

Date: 15 Jan 1998 01:35:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: ddreed@rs6000.cmp.ilstu.edu
Subject: Re: Module Installation for Perl 5.004_04 under AIX
Message-Id: <69jp4j$756$1@comdyn.comdyn.com.au>

[Posted and Mailed]

In article <34BD27F8.BECC1913@rs6000.cmp.ilstu.edu>,
	"Daniel D. Reed" <ddreed@rs6000.cmp.ilstu.edu> writes:
> Does anyone know how you can install multiple modules in one run under
> AIX?  We're trying to install a whole bunch of the modules from the
> resource kit, and it didn't come with an installer under AIX.  So, since
> it's sort of a pain to have to install over a hundred modules one at a
> time, does anyone know any other options?  Perhaps an installer for AIX
> is out there that we couldn't find?

Checkout the CPAN module, and read about Bundles

perldoc CPAN
/Bundles

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd.       | am.
NSW, Australia                      | 


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

Date: Wed, 14 Jan 1998 16:13:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: Re: Perl on Windows NT
Message-Id: <Pine.GSO.3.96.980114160931.2093N-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Philippe de Rochambeau wrote:

> Could someone please tell me how to install and setup Perl on Windows
> NT: 

It's in the docs. 

> - which version of Perl 5 should I use? 

Check the FAQ. 

> - where do I put the Perl directory? In the NT Server directory? 

Check the docs. 

> - where do I create a cgi-bin directory? 

Check your server's docs. 

> - how do I configure the NT Server so that it knows that ".pl" files are
> cgis? 

Check your server's docs. 

> - is Perl for Windows NT multi-threaded? 

It's in the docs. 

> - how robust is Perl 5 for Windows NT? 

More robust than an igloo in the outback, a little less than the rock of
Gibraltar. (We should put this question into the FAQ. :-) 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 20:06:14 +0000
From: Ruben <ruben@wynn.com>
Subject: Re: PERL programmer needed.
Message-Id: <34BD1AB6.270D142@wynn.com>

<<<Did anyone suggest that they take a full/half page ad in the perl
journal? This would be a very very good way to get the attention of
some of the best perl folks. People who take out large ads in TPJ are>>

Or maybe someone is trying to promote TPJ?!


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

Date: Wed, 14 Jan 1998 16:08:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Maxwell Smart <dereligion@dereligion.com>
Subject: Re: Problem calling a cgi from cgi
Message-Id: <Pine.GSO.3.96.980114160314.2093M-100000@user2.teleport.com>

On Mon, 12 Jan 1998, Maxwell Smart wrote:

>     I have a cgi generated from an user consult sent in the url, the the
> page in the screen have many word tha have to b linked with other cgi.

You have a CGI script, right? And it's generated from what? And you want
to make words that blink? (That doesn't sound like a Perl problem.)=20

> I tried to do using the next
>=20
>     <a href=3D"04.cgi">$A,</a>
>=20
>     where $A is the word that have to be linked with the next cgi that
> will present mor info about the word.

Okay. You tried something. I'm not sure what you tried. I'm not sure
whether it did what you wanted or not.=20

>     Well my dear friends, this is my problem, I really need your help so
> I=B4ll be waiting for you...        Thanks

What was the problem? Is it somehow related to Perl? That is, is there
some Perl source code which you've written which doesn't do what you need
for it to do? If you can show us the code and what you need for it to do,
we might be able to help. Good luck!

--=20
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 16:41:10 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Simon Peate <simon@century.demon.co.uk>
Subject: Re: Query on Uncaught Exception
Message-Id: <Pine.GSO.3.96.980114163843.2093W-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Simon Peate wrote:

> I am receiving the following when no parameters are supplied to my perl
> script:
> 
> Uncaught exception from user code:
>      No parameter supplied!

> die "No parameter supplied!\n" unless $ARGV[0];

That message is just 'use diagnostics' telling you that you threw that
exception (that is, you used die() ) but you never caught it (that is, you
didn't use eval{} to trap it). Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 23:40:54 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Query on Uncaught Exception
Message-Id: <EMssG7.Joq@bcstec.ca.boeing.com>

In article <MUTaiXA6hNv0EAQj@century.demon.co.uk>,
Simon Peate  <simon@century.demon.co.uk> wrote:
 > I am receiving the following when no parameters are supplied to my perl
 > script:
 > 
 > Uncaught exception from user code:
 >      No parameter supplied!
 > 
 > The start of my script is as follows:
 > 
 > #!/opt/perl/bin/perl -w                        
 >                                                
 > use strict;                                    
 > use diagnostics;                               
 >                                                
 > die "No parameter supplied!\n" unless $ARGV[0];
 > 
 > 
 > Why is it uncaught when I thought I'd caught it?



I suspect the problem is that your die is trapped by the 
default exception handler and becomes "uncaught".    

You could eliminate this by setting up your own
handler, e.g, 

  { 
    local $SIG{__DIE__} = sub {print @_; exit};
    die "No parameter supplied!\n" unless $ARGV[0];
  }

Or this works too:

  { 
    local $SIG{__DIE__}; 
    die "No parameter supplied!\n" unless $ARGV[0];
  }


HTH,
--
Charles DeRykus


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

Date: Wed, 14 Jan 1998 15:57:04 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: source into binary code
Message-Id: <Pine.GSO.3.96.980114155429.2093K-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Dan Boorstein wrote:

> Tom Christiansen wrote:

> > In comp.lang.perl.misc,

> > :Hi, I would like to know how to turn the perl source code
> > :into binary/executable code due to security.
> > 
> > Compiling produces no security.  Read the FAQ.

> i have to disagree with this statement. i can't read compiled
> code just by opening a file. 

You can't read ROT-13 just by opening a file, either, can you? :-)

> that sounds like added security to me. furthermore,
> i'd bet that there are a lot of others like me.

Yes, there are a lot of people to whom obscurity seems like security.  :-)
But really, it's no better than hiding your front door key under the
welcome mat, is it? 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 19:13:30 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: source into binary code
Message-Id: <comdog-ya02408000R1401981913300001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BCD4B1.833924F3@ixl.com>, Dan Boorstein <dboorstein@ixl.com> posted:

>Tom Christiansen wrote:

>> Compiling produces no security.  Read the FAQ.

>i have to disagree with this statement. i can't read compiled
>code just by opening a file. in order to understand just
>what's going on internally i would have to disassemble the code.
>as it just so happens, i don't know how to do that. 

security is not defined in terms of your personal limitations.

i hope you aren't neglecting all the other things that you
don't know how to do (but that crackers do).

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 15 Jan 1998 00:47:28 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: source into binary code
Message-Id: <69jmb0$lj7$1@csnews.cs.colorado.edu>


In comp.lang.perl.misc, Johnson.Chow@Comp.HKBU.Edu.HK writes:
:If one has the method how to hide my perl source
:code in any sense, please tell me. I need: run my perl but hide
:my perl source for all users.  My goal is simple. 

I can't imagine many noble reasons for hiding source code, so until you
prove that your motives are pure, you're out of luck.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    OK, enough hype.
            --Larry Wall in the perl man page 


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

Date: Wed, 14 Jan 1998 16:45:50 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Builders Connection <Webmaster@builders-connection.com>
Subject: Re: Would this code be right
Message-Id: <Pine.GSO.3.96.980114164138.2093X-100000@user2.teleport.com>

On Mon, 12 Jan 1998, Builders Connection wrote:

> Subject: Would this code be right

Depends upon what you want it to do. But if you only want to know what
Perl will do with it, there's one quick way to find out. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 14 Jan 1998 16:26:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Wedwick <dave@wedwick.com>
Subject: Re: Writing to a file in Win32 and Unix
Message-Id: <Pine.GSO.3.96.980114162200.2093R-100000@user2.teleport.com>

On Wed, 14 Jan 1998, Dave Wedwick wrote:

> The following works in Win32 but not in Unix:
> 
>   open(TESTHANDLE, "+>out.dat");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

>   $Str = "This is test number 1 of 9";
>   syswrite(TESTHANDLE, $Str, length($Str));
> 
>   for ( $Counter = 1;  $Counter < 10;  $Counter++ )
>   {

Ah, another unreformed C programmer. :-)  The more Perlian way looks more
like this.

    for $counter (1..10) { ... }

 ...or even this

    for (1..10) { ... }

>     seek(TESTHANDLE, 20, 0);
>     syswrite(TESTHANDLE, $Counter, length($Counter));
>   }
>   close(TESTHANDLE);
> 
> In Win32, the contents of out.dat is "This is test number 9 of 9", but at the 
> Unix (web server) box, out.dat contains "This is test number 1 of 9123456789". 
>  So, it appears the seek() is not working.

Maybe you should check the return value from seek() as well. 

    seek( ... ) or die "Can't seek: $!";

On the other hand, the seek seems to be working on my machine. Hope this
helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!




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

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

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