[11555] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5155 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 17 09:07:20 1999

Date: Wed, 17 Mar 99 06:00:21 -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, 17 Mar 1999     Volume: 8 Number: 5155

Today's topics:
        'Securing' a chunk of perl code <dsc@tiac.net>
    Re: 'Securing' a chunk of perl code <zenin@bawdycaste.org>
    Re: 2d-array sort <fabascal@gredos.cnb.uam.es>
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
    Re: Array lengths (Larry Rosler)
    Re: Can't Increment Counter in FILE Using http:// (Larry Rosler)
        Embedded-encyption perl interpreters for hiding perl so <ftidev@fhb.clickcharge.com>
        Expect modul <christian.koch@fuzzy-online.de>
    Re: flock() on Alpha/VMS <sugalskd@netserve.ous.edu>
        How do I split an list of text into separate lists of p (Jim Britain)
    Re: how to include a init table file without complainin <eedalf@eed.ericsson.se>
    Re: how to include a init table file without complainin <eedalf@eed.ericsson.se>
        How to sort a LoL? <fabascal@gredos.cnb.uam.es>
        image sizes <"rhrh@hotmail.com,or,rhardicr"@ford.com>
    Re: image sizes <eedalf@eed.ericsson.se>
    Re: Incrementing several values in a hash <Philip.Newton@datenrevision.de>
    Re: MSIE Does Not Undestand "IMGSIZE" <Philip.Newton@datenrevision.de>
    Re: MSIE Does Not Undestand "IMGSIZE" <"rhrh@hotmail.com,or,rhardicr"@ford.com>
        NNTPClient module [q] <esakov@news1.relcom.ru>
    Re: Problem passing block and array reference to subrou <Philip.Newton@datenrevision.de>
    Re: Read a file. <Philip.Newton@datenrevision.de>
    Re: Reading a file <Philip.Newton@datenrevision.de>
    Re: recode anyone? <eedalf@eed.ericsson.se>
    Re: recode anyone? (Matthew Bafford)
        ternary operator <23_skidoo@geocities.com>
    Re: Unicode/Base64 ? <eedalf@eed.ericsson.se>
    Re: Unicode/Base64 ? <illume@gmx.net>
        Which OS am I in <stephen@math.missouri.edu>
    Re: Which OS am I in <stephen@math.missouri.edu>
    Re: Which OS am I in <Allan@due.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 17 Mar 1999 08:16:20 -0500
From: Sandy Currier <dsc@tiac.net>
Subject: 'Securing' a chunk of perl code
Message-Id: <36EFAB23.5E49704E@tiac.net>

Hi all.  A question:

I would like to obfuscate a chunk of perl code.  That is,
a piece of perl code embedded in other perl code has
some copyright restrictions on it.  I would like to ship
all the code together.  The copyright restrictions are
due to the source code nature of the perl script, and not to
the 'run time' nature of the perl script.

It would be good if the code remains platform independent,
but it is not a strict requirement.  Also, it does not have to
be 'really' secure (in the sense that, for example, C compiled
code is), just somewhat secure.  Some possible thoughts (using
5.005):

 - employ dump and hope that undump is available on all the platforms
 - employ perl -MO=C ... and hope that it really works
 - employ perlcc and hope that it really works (not sure of the
difference
   of this one yet)
 - employ 'use Filter' and some how lightly encrypt the source, and
   decrypt it at run time

Anyone with experience solving 'source code level' copyright problems
with deploying perl scripts?

thanks much in advance,
-sandy




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

Date: 17 Mar 1999 13:50:22 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: 'Securing' a chunk of perl code
Message-Id: <921678903.801284@thrush.omix.com>

[posted & mailed]

Sandy Currier <dsc@tiac.net> wrote:
	>snip<
: Anyone with experience solving 'source code level' copyright problems with
: deploying perl scripts?

	Yes, quite a bit.

	Use something close to the AT&T licensing.  Here's the entire source
	code for the "true" command (yes, I'm violating copyright by posting
	this to USENET, oh well):

#!/usr/bin/sh
#   Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
#     All Rights Reserved

#   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
#   The copyright notice above does not evidence any
#   actual or intended publication of such source code.

#ident  "@(#)true.sh    1.6 93/01/11 SMI"   /* SVr4.0 1.4   */

	In short, there isn't much more you can do but stick a bunch of
	"I'LL SUE YOUR ARSE OFF IF YOU COPY THIS!" messages in it.

	If that isn't good enough, the following link may or may not be
	more useful to you:

		ftp://thrush.omix.com/pub/misc/shc-3.0b3.tgz

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 17 Mar 1999 12:25:50 +0100
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: Re: 2d-array sort
Message-Id: <36EF913D.C8D68A9A@gredos.cnb.uam.es>

>
> @sorted = sort { $a->[0] <=> $b->[0] } @Data1;

I have tried this way of sorting an array of arrays but it seems it doesn't work

@arrayOfarrays = (["Hello", 23], ["Bye", 4]);
@ordenado = sort({ $a->[1] <=> $b->[1] } @arrayOfarrays);
 foreach $tt (@ordenado) {
  print "\n @$tts \n";
 }

Is any error in my code?

Fede



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

Date: Wed, 17 Mar 1999 11:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage921669842.24251@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://cpan.perl.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://cpan.perl.org/
    http://www.perl.com/CPAN/
    http://cpan.perl.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:

    setdir usenet-by-group/news.announce.newusers
    send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Sat, 13 Mar 1999 19:03:51 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Array lengths
Message-Id: <MPG.1154c6ee5956832a98973b@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <36EB08FB.DC1F54B@dowebpages.com> on Sat, 13 Mar 1999 
18:55:23 -0600, Bill Binkley <bwb@dowebpages.com >says...
> @ppw = ();
> @ppw[0]=();

This should be:

  $ppw[0] = [];

> $ppw[0][0]="adm\/";
                 ^   Why???

> $ppw[0][1]="adm.htm";
> $ppw[0][2]="detail.htm";
> $ppw[0][3]="help.htm";
> @ppw[1]=();
> $ppw[1][0]="all\/";

Similar problems for the above two lines.

> Length of @ppw can be obtained with $#ppw

Actually, length - 1 (highest index).

> Is there a corresponding way to get the length of $#ppw[0] and
> $#ppw[1]

  $#{$ppw[0]}   # == 3
  $#{$ppw[1]}   # == 0

I didn't know this off the top of my head, but I tried a few ways and 
found one that worked.  Computing is an 'experimental science'!  
Experiment!!!

In retrospect, it seems obvious, though:

  $#ARRAY-NAME  or $#{ARRAY-REF}

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 13 Mar 1999 19:12:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can't Increment Counter in FILE Using http://
Message-Id: <MPG.1154c8e58ada13fb98973c@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <36ec413a.28423812@news2.tmisnet.com> on Sun, 14 Mar 1999 
23:10:43 GMT, George Crissman <strads@tmisnet.com >says...
> That still leaves me wondering why the program works great when 
> called from the command line but not when called by the browser.

Have you read this (the first FAQ in perlfaq9):  "My CGI script runs 
from the command line but not the browser. (500 Server Error)"?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 17 Mar 1999 08:44:47 -0500
From: Patrick Sweeney <ftidev@fhb.clickcharge.com>
Subject: Embedded-encyption perl interpreters for hiding perl source
Message-Id: <36EFB1CF.A9654D88@fhb.clickcharge.com>

We have a need that I suppose is shared by other commercial
software developers: hiding our source code from competitors,
(or from curious customers that would create knock-offs from our
product source.)

After looking at the FAQ:

It's my understanding that the experimental byte code compiler shipped
with
perl 5.005 is broken and no developer resources are being applied
to get it to work.

It's  my understanding that using Filter:: modules would expose in
source code the methods used for the encryption itself, i.e. the
decryption "engine" itself must be in plaintext for perl to start.

So,  is there any experience out there with perl interpreters that have
embedded encryption or opinions as to why creating one would
be a good or bad idea?

Patrick Sweeney




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

Date: Wed, 17 Mar 1999 14:07:21 +0100
From: "Christian Koch" <christian.koch@fuzzy-online.de>
Subject: Expect modul
Message-Id: <7co9fk$btp$1@black.news.nacamar.net>

I have a problem with the expect module.

I want to create users for Apache webserver with htpasswd. When I start the
script the user will be created, but the script never stops. My browser is
downloading data during the creation of the user. When I press the STOP
button it stops and the user is created. What can I do to optimize the
script, that it will be stop without my help.

Here is a part of my script:

  $username      = "$eingabe[1]";
  $passwd        = "$eingabe[2]";

  $passwdfile    = "/usr/local/httpd/conf/passwd.txt";
  $htpasswd_prog = "/usr/bin/htpasswd";

  my $timeout = 10;

  $robot = Expect->spawn($htpasswd_prog, $passwdfile, $username);

  $pattern = $robot->expect($timeout, "Changing", "New password:");

#  if(!defined $pattern) {
#      die "New password: not found";
#  } elsif($pattern == 1) {
#      die "User already there";
#  }

  $robot->send_slow(0, "$passwd\n");

  $robot->expect($timeout, "Re-type new password:") || die "Pattern Re-type
new password: not found";

  $robot->send_slow(0, "$passwd\n");

  $robot->expect(undef);

  print "<br><br>User <b>$eingabe[1] </b>wurde erfolgreich angelegt.";


Thank You
Christian




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

Date: 16 Mar 1999 23:42:47 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: flock() on Alpha/VMS
Message-Id: <7cmq9n$7q8$1@news.NERO.NET>

In comp.lang.perl.misc Techno <techno@umbriel.demon.co.uk> wrote:
: I've written a perl script that needs to be multi-platform (HP-UX, NT,
: Alpha/VMS).  It works fine on HP-UX & NT, but on Alpha/VMS, it crashes when
: I attempt to use flock(HANDLE, LOCK_EX).  Since multiple copies of the
: script can be running, I need to ensure exclusive access to the file in
: question.

: Any help/workarounds/alternative suggestions would be appreciated (I'm
: already doing some OS-specific stuff for NT, so I'm quite happy to code an
: alternative locking mechanism for VMS if that's what's needed, but I don't
: know what would be required off-hand).

The VMS port of perl doesn't support flock or fcntl at the moment.
However... VMS has mandatory file locking--if you open a file for write,
nobody else will be able to. (The open call will throw an error) You'll
need a bit more checking on open to detect a locked file error, but you
can skip flock entirely on VMS.

					Dan


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

Date: Wed, 17 Mar 1999 11:03:36 GMT
From: jbritain@home.com (Jim Britain)
Subject: How do I split an list of text into separate lists of paragraphs
Message-Id: <36ef8688.8786948@news>


There's got to be a better way to break text to paragraphs..


Code snippet:

               foreach (@abstract){
                    if (/^$/ or $set){
                        push(@para2, $_);
                    $set=1;
                    }else{
                        push(@para1, $_);
                    }
                }

                $text->columns(76);
                $text->firstIndent(2);
                $text->bodyIndent(0);
                print $text->format(@para1);
                if ($set){
                    print "\n";
                    print $text->format(@para2);
                }
                undef @para1;
                undef @para2;
                undef $set;
                print "\n\n";


This code, along with Text::Format, allows me to generate 2 paragraphs
of abstract info, describing file contents for inclusion in a Table of

Contents.

I can forsee the day, when I may need more than two paragraphs, and
for a week now, I have been trying to generate a list of paragraphs
for an arbitrary number of paragraphs without success.

Text::Format, requires (unless someone knows differently) that I feed
it one paragraph at a time, since it rewraps text, converting lf to
space in the process.

I realize, just now, looking at the message, that the formatting could
take place in the first portion of the if-else block to solve this
individual problem..

However, I would still like to know how to separate paragraphs to an
individual (indexed) list of paragraphs.. (without going more nuts).



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

Date: Wed, 17 Mar 1999 13:54:22 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: cherng@bbn.com
Subject: Re: how to include a init table file without complaining from "use strict"
Message-Id: <36EFA5FE.1817E3AD@eed.ericsson.se>

Tungning Cherng wrote:
> Could some one tell me how to solve the problem by using "use strict"?

Hi,

maybe 

no strict 'refs';     # enter "perldoc -f use" in shell to get more info

/Alex


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

Date: Wed, 17 Mar 1999 13:57:11 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: cherng@bbn.com
Subject: Re: how to include a init table file without complaining from "use strict"
Message-Id: <36EFA6A7.3E515811@eed.ericsson.se>

Tungning Cherng wrote:
> For example, Two files: a.pl ad b.pl.
> 
> % cat a.pl
> my %largeTable=(
>    'a' , '1',
>    'b' , '2',
> );
> 
> % cat b.pl
> use strict;
> require "a.pl";
> print "$largeTable{'a'}\n";

Or maybe use Exporter (type "perldoc Exporter").

/Alex


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

Date: Wed, 17 Mar 1999 12:07:43 +0100
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: How to sort a LoL?
Message-Id: <36EF8CFE.2EEF5522@gredos.cnb.uam.es>

I have an array of two element arrays, and I want to sort it by the
number contained in the second element of each of the arrays of the
array. (In C/C++: sort by array[i][1]). Do you know how to do it?
Thanks in advance,
Fede



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

Date: Wed, 17 Mar 1999 11:13:13 +0000
From: Richard H <"rhrh@hotmail.com,or,rhardicr"@ford.com>
Subject: image sizes
Message-Id: <7co2nb$a010@eccws1.dearborn.ford.com>

Hi,
Id like to determine the size of a jpg once ive retrieved it from a
remote server.
i noticed in a posting the other day:(i cant find it again)

>> $var = imgsize($img);
does anyone know if this comes from a common module???
Thanks
Richard H


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

Date: Wed, 17 Mar 1999 12:47:08 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: rhardicr@ford.com
Subject: Re: image sizes
Message-Id: <36EF963C.B5346F16@eed.ericsson.se>

Richard H wrote:
> Id like to determine the size of a jpg once ive retrieved it from a
> remote server.
> i noticed in a posting the other day:(i cant find it again)
> 
> >> $var = imgsize($img);
> does anyone know if this comes from a common module???

Hi Richard,

you probably want the Image::Size 

         use Image::Size;
        ($x, $y) = imgsize("something.gif");

You can get it from http://language.perl.com/info/cpan_modules.html
Installing is easy (but read the attached documentation):

        perl Makefile.PL PREFIX=/your/home/dir
        make
        make test
        make install


/Alex

--
http://www.simplex.ru/news.html


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

Date: Wed, 17 Mar 1999 12:37:18 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Incrementing several values in a hash
Message-Id: <36EF93EE.B4A988E7@datenrevision.de>

Sean McAfee wrote:
> 
> >     foreach my $key (@keys) { $hash{$key}++; }
> 
> In versions of Perl before 5.005 you'd have to do that (or something
> similar), but now you can say:
> 
> $hash{$_}++ foreach @keys;

Ah, thanks.

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 12:20:12 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: MSIE Does Not Undestand "IMGSIZE"
Message-Id: <36EF8FEC.9F2ED420@datenrevision.de>

tatabu@my-dejanews.com wrote:
> 
> What I meant by this is that the CGI script file executes
> perfectly when called from Opera or Netscape. I always get
> an error when I execute it from MSIE 4.0. 

This is strange. A CGI script should not care how it is invoked --
Netscape, MSIE, 'telnet example.com 80', or any other way.

What does your CGI script output when you run it from the command line?

> I still have this
> problem: The CGI script program creates an HTML file.

I assume you mean it generates HTML and writes it to standard output, so
that the browser will end up seeing it -- not that it writes its output
to a file somewhere on the server's system.

> I want
> to WRITE the size of the picture inside the HTML file.

This is also good. If the browser knows the size of an image, it can
render that bit of the page without waiting for the image to download.

> How
> do I insert this line of code in th CGI script file so that
> all three browsers execute the CGI file properly?

Browsers do not execute CGI scripts -- web servers do. The browser just
sends a "GET" or "POST" request to the web server, which then invokes
the CGI script, captures the output, and sends it back to the browser. 

> The line
> is
> 
> ($width,$heights) = imgsize("friend.jpg");

This line produces no output. Therefore, the problem with wrong display
cannot be just this line. Presumably, somewhere in the script there is a
command like

   print <<EOF;
<IMG SRC="pretty.gif" ALT="a picture"
WIDTH="$width" HEIGHT="$heights" ALT="a picture">
EOF

*This* line produces HTML output which will be interpreted by the
browser -- correctly or incorrectly. The line *you* posted is not
interpreted by the browser. What does the offending output line look
like when you call the CGI script from the command line? If you do not
show us the problem, we cannot help you.

> When I insert it outside a JavaScript module I get an error
> from all three browsers!

I don't understand what you mean by this.

> How should I change it?

The error is probably at line 17.

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 11:25:14 +0000
From: Richard H <"rhrh@hotmail.com,or,rhardicr"@ford.com>
Subject: Re: MSIE Does Not Undestand "IMGSIZE"
Message-Id: <7co3ds$a15@eccws1.dearborn.ford.com>

quick q,
where does the imgsize method come from,
is it in any distributed module??
Thanks,
Richard H


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

Date: Wed, 17 Mar 1999 16:28:29 +0300
From: Dima Esakov <esakov@news1.relcom.ru>
Subject: NNTPClient module [q]
Message-Id: <36EFADFD.446B@news1.relcom.ru>

Hi!
My boss askes me to write an nntp monitor in perl.
I am actually new to INN and perl, thats why I need
your suggestions.
I think it should look like this:
 
1. establishing connection
2. start timer
3. enter command 
4. wait for the answer
5. stop timer
6. check if reply time is normal
 
I've installed the NNTPClient perl module, but I can't get,
how to check, if connection is established, and how to
start/stop and check timer.
 
Any help is appreciated.


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

Date: Wed, 17 Mar 1999 12:49:15 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Problem passing block and array reference to subroutine
Message-Id: <36EF96BB.328162FB@datenrevision.de>

Andrew Johnson wrote:
> 
> thus, if not passed as the first arg, requires the sub keyword:

This has bitten me before, as well -- Perl thought I was trying to
create an anonymous hash before I added 'sub'.

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 12:52:53 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Read a file.
Message-Id: <36EF9795.7F1F3FDC@datenrevision.de>

Steven Filipowicz wrote:
> 
> Never mind! I solved the problem!
> I should have used this line :
> 
>          print $line , "<BR>";
> 
> Now it works fine!

Putting <PRE> ... </PRE> around the text would have worked, too (print
"<body><pre>\n"; ... lots of stuff in between ... print
"</pre></body>\n";).

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 12:40:10 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Reading a file
Message-Id: <36EF949A.FF533912@datenrevision.de>

JAG wrote:
> 
> If you are outputing text to a web browser, you have to tell it what
> you are sending it, e.g.
> 
> print "Content-type: text/http\n\n";

ITYM text/html

HTH, HAND

Cheers,
Philip


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

Date: Wed, 17 Mar 1999 12:38:32 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: mostyn <mostynm@gromit.ecr.mu.oz.au>
Subject: Re: recode anyone?
Message-Id: <36EF9438.9CFDE58F@eed.ericsson.se>

mostyn wrote:
> 
> anyone care to write fortune in perl for me?  heh.

not really

/Alex


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

Date: Wed, 17 Mar 1999 12:34:51 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: recode anyone?
Message-Id: <slrn7ev6b4.qdd.dragons@localhost.localdomain>

Wed, 17 Mar 1999 15:27:21 +1100 -- mostyn <mostynm@gromit.ecr.mu.oz.au>:
-> anyone care to write fortune in perl for me?  heh.

Here's a start:

$/ = "%%\n";
$data = '/usr/share/games/fortunes';
srand;
rand($.) < 1 && ($adage = $_) while <>;
print $adage;

(this is from the cookbook)

Why don't you come on over to http://language.perl.com/ppt/ and subscribe to
the list.  That way no one else will be working on it at the same time. :-)

-> mostyn.

HTH!

--Matthew


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

Date: Wed, 17 Mar 1999 11:48:16 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: ternary operator
Message-Id: <36EF967B.6F1A@geocities.com>

while learning php, i fell across the ternary operator, something i've
not seen before and as there was little discussion of it in the php
manual, i looked into perl and found this example from 'Perl 5 by
Example' at http://www.codebits.com/p5be/ch04.cfm

Pseudocode
If $firstVar is zero, then assign $secondVar a value of zero. Otherwise,
assign $secondVar the value in the first element in the array @array.

$secondVar = ($firstVar == 0) ? 0 : $array[0];

i just want to check that i understand this correctly, would it not have
been easier to write the above example like this:

$secondVar = $firstVar ? $array[0] : 0;

is there any reason to do it the long winded way? i realise this is
probably just a case of tmtowtdi but examples in tutorial books tend to
use the simplest possible illustration so i was a bit wary. also i've
been unable to find a reference for ternary in the perlfaq. does it go
by any other names or can someone point me to a reference?

cheers

-23


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

Date: Wed, 17 Mar 1999 12:35:44 +0100
From: Alex Farber <eedalf@eed.ericsson.se>
To: mkagalen@lynx.dac.neu.edu
Subject: Re: Unicode/Base64 ?
Message-Id: <36EF9390.26E59948@eed.ericsson.se>

Michael Kagalenko wrote:
>  use MIME::QuotedPrint;
> 
>  $enc='=92';
>  $dec = MIME::QuotedPrint::decode($enc);
>  print $dec;
> 
> Doesn't print anything. Any tips ?

use MIME::QuotedPrint;  # enter "perldoc MIME::QuotedPrint" in your shell

$enc = '=6A=92=6B';
$dec = decode_qp ($enc);
print $dec;


/Alex

--
http://www.simplex.ru/news.html


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

Date: 17 Mar 1999 13:20:48 +0100
From: Paul Kunysch <illume@gmx.net>
Subject: Re: Unicode/Base64 ?
Message-Id: <87k8wgnw7z.fsf@illusion.tui-net>

mkagalen@lynx02.dac.neu.edu (Michael Kagalenko) writes:

>  pasting from various sources, incl. WWW. They have strings like
>  =92 (which stands for quotation mark). I tried to use MIME::Base64

> Doesn't print anything. Any tips ?

You could start wirh something like this:

#!/usr/bin/perl -nw
s/=(\d+)/chr($1)/ge;
print;

But use it with care. There were some special cases (for blank lines
oder spaces at the end of a line?) that I'm ignoring. :-/


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

Date: Wed, 17 Mar 1999 07:37:19 -0600
From: Stephen Montgomery-Smith <stephen@math.missouri.edu>
Subject: Which OS am I in
Message-Id: <36EFB00F.84057F26@math.missouri.edu>

How can a perl program tell whether it is running under DOS
or UNIX?

I looked for a uname like function for perl, but I didn't find it.

Thanks, Stephen

-- 

Stephen Montgomery-Smith              stephen@math.missouri.edu
307 Math Science Building             stephen@showme.missouri.edu
Department of Mathematics             stephen@missouri.edu
University of Missouri-Columbia
Columbia, MO 65211
USA

Phone (573) 882 4540
Fax   (573) 882 1869

http://math.missouri.edu/~stephen


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

Date: Wed, 17 Mar 1999 07:53:21 -0600
From: Stephen Montgomery-Smith <stephen@math.missouri.edu>
Subject: Re: Which OS am I in
Message-Id: <36EFB3D1.A7C7037F@math.missouri.edu>

Stephen Montgomery-Smith wrote:
> 
> How can a perl program tell whether it is running under DOS
> or UNIX?
> 
> I looked for a uname like function for perl, but I didn't find it.
> 
> Thanks, Stephen

Ignore my question I just found $^O in the documentation.

-- 

Stephen Montgomery-Smith              stephen@math.missouri.edu
307 Math Science Building             stephen@showme.missouri.edu
Department of Mathematics             stephen@missouri.edu
University of Missouri-Columbia
Columbia, MO 65211
USA

Phone (573) 882 4540
Fax   (573) 882 1869

http://math.missouri.edu/~stephen


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

Date: Wed, 17 Mar 1999 09:07:53 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Which OS am I in
Message-Id: <7cocio$cp3$1@camel19.mindspring.com>

Stephen Montgomery-Smith wrote in message
<36EFB00F.84057F26@math.missouri.edu>...
:How can a perl program tell whether it is running under DOS
:or UNIX?
:I looked for a uname like function for perl, but I didn't find it.


perldoc perlvar,  look for $^O.  If I recall correctly CGI.pm does this kind
of check, you might look there for an example.

HTH

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Although the Perl Slogan is There's More Than One Way to Do It, I hesitate
to make 10 ways to do something.  :-)
 - Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>




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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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