[6833] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 457 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 9 18:17:17 1997

Date: Fri, 9 May 97 15:00:46 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 May 1997     Volume: 8 Number: 457

Today's topics:
     --------------- Comprehensive Internet programmer's Res (Thomas Porter, Ph.D.)
     [Q] DynaLoader on irix (Joseph Ryan)
     Re: A Perl Question <stranw@gte.net>
     Re: article: writing a chat server <jpearson@ket.org>
     banner script wont write log file (David Nice)
     Break command? <jake@apparel.net>
     Re: Break command? (Paul D. Smith)
     Re: Can't locate sys/socket.ph in @INC (did you run h2p <jims@online-marketing.com>
     CGI.pm vs. Base.pm <upsetter@zip1.ziplink.net>
     Re: Comparing multi-line variables <a.aitken@unl.ac.uk>
     Re: Drawing a graph? <slone3@llnl.gov>
     Re: Drawing a graph? <mike@soft-tek.com>
     Re: Flushing pipes <brandon@physics.utexas.edu>
     Help: vars inside an eval (Henry Avatar Chan)
     Re: Hide my code? <usenet-tag@qz.little-neck.ny.us>
     How Does Someone Copy a File in perl? (Kevin M Simonson)
     How to Identify the Type of DBMS (Martin Cohen)
     if (condition) always testing true <jake@apparel.net>
     Re: if (condition) always testing true (Honza Pazdziora)
     Re: if (condition) always testing true (Paul D. Smith)
     Re: if (condition) always testing true (David B. White)
     Migration from perl 4 to perl 5 jgorman@acsu.buffalo.edu
     Re: Migration from perl 4 to perl 5 (Quentin Fennessy)
     Migration from ver 4 to 5 jgorman@acsu.buffalo.edu
     Re: Migration from ver 4 to 5 (Matthew Cravit)
     Migration to perl 5 jgorman@acsu.buffalo.edu
     Re: Minimum perl installation (Matthew Cravit)
     Re: Module to generate a parse tree <vladimir@cs.ualberta.ca>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 09 May 1997 16:02:36 GMT
From: tporter@dtool.com (Thomas Porter, Ph.D.)
Subject: --------------- Comprehensive Internet programmer's Resource ----------------
Message-Id: <337a4a7d.26810564@news.one.net>

An Internet Programmer's Paradise (if there is such a place). A most
comprehensive index containing 100's of links to the following
resources:
HTML, The CGI, UNIX, Perl, Java, Javascript, Computer Companies,
Technical Information,
Win95, and Newspapers & Magazines. Updated browser common atrributes.
Even contains a section for newbies [basic training], relaxing w/
Dilbert, 
and other entertainment. 

Updated every 2-3 days w/ the latest interesting [to me] technical
news.

URL: http://www.dtool.com

[Optional comments]

This site was coded using HomeSite v 6.4001, Frontpage 2002,
Javascript rev
8.012c, and is best suitable for viewing on a system using Nav v
127.03b138551,
or MSIE v 5.02b/clsid:12345678-1234-1234-1234-123456789012". 

Minimum System requirements: 8192x6144 video display: 128 megs SDRAM,
Intel Merced 
overclocked to 183, redundant OC3 dialup, and serial mouse.  O/S's
supported:
Win 2013 [ beta !!!].  What else is there???     

This site may destroy your monitor... & worse

It will format your hard drive. Not only that, but it will scramble
any disks that are even close to the computer. It will reset all of
your SCSI ID's & pull the jumpers out of every ISA card.  It will
install Claris & Frontpage 97 three times each, then put them in the
Start folder. It will moved your swap file to your Jaz drive, then
store the swap on an X-jack modem card that it wedged into the drive
slot.  

It will recalibrate your refrigerator's coolness setting so all your
ice cream melts. It will demagnetize the strips on all your credit
cards, reset the timer to 12:00 on all the VCR's in the house and use
subspace field harmonics to scratch all your Carpenters CD's. It will
mix Drano in your fishtank, drank all the milk, and leave its socks
out on the coffee table. It will switch the bands between all the
Macanudo & Don Diego's in your humidor.It will put a dead squirrel in
the back pocket of your good pants and hide your car keys when you are
late for work.

This site will make you fall in love with a penquin. It will give you
nightmares about circus midgets, 3 tubes of toothpaste, a litre of
lime jello, and one of those shiatsu massagers. It will pour sugar in
your gas tank and shave off both your eyebrows, while it dates your
significant other behind your back and then bill the dinner and hotel
room to your VISA card

It will kick your dog. It may eat all of your goldfish. It will leave
libidinous messages on your mother's voice mail in your voice! It will
leave the toilet seat up and forget to flush. It will make a batch of
amphetamines in your bathtub, and then leave bacon burning on the
stove while it goes out to chase gradeschoolers with your new mulching
mower.  

You have been warned...
=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=
                 tporter@dtool.com     			
		 Thomas Porter, Ph.D.
	         THE DIGITAL TOOL GROUP
		 http://www.dtool.com

	   "Never attribute to malloc
that which can be adequately explained by stupidity"
=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
	


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

Date: 9 May 1997 15:41:51 GMT
From: jfryan@orion.nhgri.nih.gov (Joseph Ryan)
Subject: [Q] DynaLoader on irix
Message-Id: <5kvgjv$3f2$1@light.nih.gov>
Keywords: irix dynamic loader install configure

###############################################################################
#                             Scenario                                        #
###############################################################################
I am having some problems getting Dynamic Loading to work on my SGI (irix 6.2). 
I performed a default install of the latest perl source(5.003)...

  Do you wish to use dynamic loading? [y] 
 
  What extensions do you wish to load dynamically?
  [Fcntl FileHandle NDBM_File ODBM_File POSIX SDBM_File Safe Socket]
  What extensions do you wish to load statically? [none]
           
All went well but during the make test and make install I get the following...

  Making DynaLoader (static)
  
and when I run...

  perl -e 'use MD5';
  
I get...

  Can't load '/usr/local/lib/perl5/site_perl/IP22-irix/auto/MD5/MD5.so' for module
  MD5:  5956:perl: rld: Fatal Error: unresolvable symbol in
  /usr/local/lib/perl5/site_perl/IP22-irix/auto/MD5/MD5.so: stack_base at
  /usr/local/lib/perl5/DynaLoader.pm line 140.
  
   at /usr/local/lib/perl5/site_perl/MD5.pm line 20
  BEGIN failed--compilation aborted at -e line 1.

The same happens when I try Data::Dumper.  

This is my third attempt at recompiling (Yes, I ran rm -f 'config.sh')
Before the last recompile I was getting...

  Can't load module MD5, dynamic loading not available in this perl. 

###############################################################################
#                             QUESTION                                        #
###############################################################################

Do I need to do anything out of the ordinary when runing 'sh Configure'
Here are some of the prompts that I suspect may be important...

  Any special flags to pass to cc -c to compile shared library modules?  
  [none]

  What command should be used to create dynamic libraries? [ld] 
  
   Any special flags to pass to ld to create a dynamically loaded library?
  [-shared -L/usr/local/lib] 
  
  Any special flags to pass to cc to use dynamic loading? [none]
  
  What is the extension of dynamically loaded modules [so] 
  
/-------------------------/
| I appreciate any help.  |
| I read the INSTALL      |
| I read the FAQ          |
| I searched Deja News    |
/-------------------------/  

--
Joseph F. Ryan
WWW Administrator
National Human Genome Research Institute


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

Date: 9 May 1997 18:57:32 GMT
From: "William Stranathan" <stranw@gte.net>
Subject: Re: A Perl Question
Message-Id: <5kvs2s$nm2$1@news5.gte.net>

Bill <bill@sover.net.no.junkmail> wrote in article
<slrn5n4o95.6p3.bill@granite.sover.net>...
> In article <5ktk9t$d8m$1@news7.gte.net>, William Stranathan wrote:
> >try:
> >
> >$summary =~ s/(.*)\((.*)/\1\2/;
> >I know that's weird looking, but...
> >
> >Will Stranathan
> >stranw@gte.net
> 
>   $summary =~ s/\(//g;
>    						Bill
Would that replace only the match, or all of summary?  I thought that that
would replace the whole thing, not just the match.
 ...Sorry, I'm still learning.  Besides -- there's more than
one.............

Will Stranathan
stranw@gte.net


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

Date: Fri, 09 May 1997 13:04:59 -0400
From: Joe Pearson <jpearson@ket.org>
To: Brian Slesinsky <bslesins-usenet@hotwired.com>
Subject: Re: article: writing a chat server
Message-Id: <3373593B.3D0F@ket.org>

Brian Slesinsky wrote:
> 
> Hi, I wrote an article about writing a chat server that illustrates
> using IO::Socket and IO::Select.
> 

Greetings,

We tried it on one of our Win32 boxes with Perl 5.003 build 306.  It
worked like a charm after I took out the -wT on the first line (due to a
complaint about our Socket.pm), and after I updated our IO files.

We'll probably be using something like this to enhance student to studio
teacher interaction, while archiving the conversation to a text file. 
Your sample program gave us a great way to prototype our concept so we
could demonstrate visually what we had in mind to the teachers.

Thanks

-- 
Joe Pearson
jpearson@ket.org
Distance Learning Web Developer
http://www.dl.ket.org/


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

Date: Fri, 09 May 1997 14:53:47 GMT
From: dnice@bridge.net (David Nice)
Subject: banner script wont write log file
Message-Id: <33733a6e.9914082@nntp.bridge.net>

Hi,

I have set up the banner script from the Perl Script Archive at:

http://www.exton.com/psa/

It is up and running and working fine. I have set no exclusions while
testing yet it won't write to the logfile I have specified.

Permissions and paths appear correct yet the log file stays empty
even when I creat many impressions and click throughs.

Anyone familiar with this script? Any thoughts?




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

Date: Fri, 9 May 1997 16:51:47 GMT
From: Jacob Salomon <jake@apparel.net>
Subject: Break command?
Message-Id: <E9xAx1.M4n@nonexistent.com>

In my previous (first) post I wrote:
--- SNIP --- 

> while (($input_line = <stdin>) ne "\n") # Get a line; quit if null
> {
>     chop($input_line);                  # Get rid of new-line at end
>     $s_array[++$count] = $input_line;   # Bump counter, Insert string
>     if ($input_line == "end")           # Just a debugging check
>     {
>         print ("$input_line: Entered END\n");
>         break;
>     }
> }
--- SNIP ---
> What have I missed?

OK, Jake here again.

Several folks answered me quickly and pointed out that I had used the ==
operator on two strings.  I needed to use the eq operator to compare two
strings.  When I replaced that == with eq the 'if' program block was
entered only when I typed 'end'.  Thanks for pointing out my oversight.

  But that's not the end of the story.

I did this all to experiment with the 'break' command, which is
available in awk.  I could not find 'break' in the index of the perl
book I'm using to learn.  The break command above did not incur a
compile error but neither did it break me out of the loop; it continued
to accept input until I entered an empty line.

Am I misusing the break command?  How would I leave a loop if not with
break? (Please don't suggest goto.)

Thanks.
-- 
    -- Jake (In pursuit of undomesticated aquatic avians)
 
+-----------------------------------------------------------+
|    Impeccable Logic: A thought process which successfully |
|                      resists chicken bites                |
+-----------------------------------------------------------+


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

Date: 09 May 1997 14:21:11 -0400
From: psmith@baynetworks.com (Paul D. Smith)
To: jake@apparel.net
Subject: Re: Break command?
Message-Id: <p5207go6aw.fsf@baynetworks.com>

%% Jacob Salomon <jake@apparel.net> writes:

  js> I did this all to experiment with the 'break' command, which is
  js> available in awk.  I could not find 'break' in the index of the perl
  js> book I'm using to learn.

So what does that tell you?  Right!  Perl doesn't have one.

  js> The break command above did not incur a compile error but neither
  js> did it break me out of the loop; it continued to accept input
  js> until I entered an empty line.

Read the FAQ: what's should you always do?  Run perl with -w!

  $ perl -e 'break;'

  $ perl -w -e 'break;'
  Unquoted string "break" may clash with future reserved word at -e line 1.
  Useless use of a constant in void context at -e line 1.

  js> Am I misusing the break command?  How would I leave a loop if not with
  js> break? (Please don't suggest goto.)

Try "last".

The first problem was somewhat legitimate, but now we're getting to the
point where you're just asking the 'net rather than reading your book.
I can't believe that "next" and "last" aren't discussed in your perl
book somewhere in the section(s) on looping.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.


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

Date: Fri, 09 May 1997 12:11:21 -0400
From: Online Marketing Company <jims@online-marketing.com>
Subject: Re: Can't locate sys/socket.ph in @INC (did you run h2ph?)
Message-Id: <33734CA9.60FB@online-marketing.com>

WSchuel@stud.uni-goettingen.de wrote:
> 
> Hi all, I need your help!
> I'm still new to programming cgi. I expect this to be a silly question
> but I can't find an answer.
> I use a script named "nntp.pl" which requires "sockets.pl", this one
> again requires "sys/socket.ph". When running this PERL script, I get
> the message "Can't locate sys/socket.ph in @INC (did you run h2ph?)"
> in my errorlog. It seems to me, that "socket.ph" should be on my system,
> but can't be found.
> 
> TIA Walter

Hi.

I can give you a partial answer.

I'm running BSDI UNIX.  The following file was shipped with my OS from
BSDI:
	/usr/include/sys/socket.h

Although I've never tried to do what you're doing, I assume that you
need to h2ph against that file.  

Manually performing this conversion is probably easier than
automatically using the build procedures with the PERL distribution.

Not all vendors include these libraries with their various distributions
(I'm pretty sure that Microsoft does not), so the sys/socket.h file may
not be found on your system.  The solution to this  problem usually
involves some expense.

Jim Schueler
Online Marketing Company

P.S.  I stumbled on your message while doing a search on my own name...


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

Date: 9 May 1997 17:16:36 GMT
From: Scratchie <upsetter@zip1.ziplink.net>
Subject: CGI.pm vs. Base.pm
Message-Id: <5kvm5k$tne$1@kayrad.ziplink.net>

Greetings all;

A quick question:

Looking at Lincoln Stein's website, I've found the following URLs:

If I go to 
	http://www.genome.wi.mit.edu/WWW/tools/scripting/
I get a menu that eventually leads me to CGI.pm

However, if I go to 
	http://www.genome.wi.mit.edu/WWW/tools/scripting/CGIperl/

(I got this URL out of a book), I'm told that "they [Base.pm, et al]
contain all the functionality of the original CGI.pm modules."

Which is preferable? Although I've done a lot of hacking with Perl 4
functionality (see my calendar page) I don't have a lot of experience
using pre-written modules, so it's hard for me to evaluate each of these.
Is either set of modules considered "better" by the perl community?

Thanks in advance,

--Art
(e-mail cc:s appreciated)

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

Date: Fri, 09 May 1997 15:59:27 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Comparing multi-line variables
Message-Id: <33733BCF.76D6@unl.ac.uk>

Zachary Brown wrote:
> 
> In article <336F0798.1633@unl.ac.uk>,
> Alastair Aitken  <a.aitken@unl.ac.uk> wrote:

I did, didn't I.

> |> Given two variables $a and $b containing multiple lines of ascii text, how
> |> could perl locate all the start and end indices of the words or groups of
> |> words that are different in one from the other and vice versa?

Hokley Dokley :-)

1) It strikes me that this isn't the greatest perl.
2) It isn't portable - UNIX only (change the file read method for
portability)
3) It might work, but it isn't tested and it doesn't do a great deal of
error checking.
4) It's only written to read and compare two files.  Needs expanding.
5) It's version 5.003.
6) It's free.

#! /usr/local/bin/perl -w

require 5.003;
use strict;

my ($f1, $f2, @fa1, @fa2, $i1, $i2, @la1, @la2, $diff1, $diff2,
$indices);

# first load the two files into two arrays:

$f1 = `cat /path/to/file1` || die "Can't open file1: $!\n";
@fa1 = split(/\n/,$f1);
$f2 = `cat /path/to/file2` || die "Can't open file2: $!\n";
@fa1 = split(/\n/,$f2);

# now compare the two files as arrays using an integer count to sync
them:

$i1 = 0;

foreach (@fa1) {
    if ($_ ne $fa2[$i]) {			# these two lines are not the same
        $diff1 = $_;
        $diff2 = $fa2[$i];
        &calculate_indexes($diff1,$diff2);
    }
    $i++;
}

# now compare the two lines as arrays using an integer count to sync
them:

sub calculate_indices {
    $indices = "";
    @lal1 = split(//,$diff1);
    @lal2 = split(//,$diff2);
    $i2 = 0;
    foreach (@lal1) {
        if ($_ ne $lal2[$i2]) {
            if ($indices) { 			# its already got at least one in it
                $indices .= ",$i2";
            } else {				# $indexes is empty
	        $indices = "$i2";
            }
        }
    $i2++;
    }

# at this point $indices should be a comma separated
# list of the index of every character that is different.
# note - no patterns therefore not very subtle - this
# will find lots of differences if the first character has
# been dropped from a line in the second file ... only!

&do_summat_wiv_indices

}

sub do_summat_wiv_indices {
    # do ... this!
}

exit 0;

REPEAT:

Not tested, not portable, v. 5.003, free.  So: probably not working. 
Enjoy :-)

Well .. it strikes me that patterning this is rather difficult (for me
anyway) but one way would seem to be a function that would convert the
first string into a pattern and test the second string for diffs.

I wonder ...

Alastair.


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

Date: Fri, 09 May 1997 09:10:40 -0700
From: Dale Slone <slone3@llnl.gov>
Subject: Re: Drawing a graph?
Message-Id: <33734C80.167E@llnl.gov>

Michael Schuerig wrote:
> That's not what I had meant. I want to draw graphs, not charts. And I
> don't even want to draw myself, I want the module to do the hard layout
> work.
> 

You might want to look at Allan Brighton's tree widget:
http://arch-http.hq.eso.org/~abrighto/tree/tree.html

Unfortunately it's Tcl/Tk, not Perl/Tk, but it should be 
straightforward to translate. I'm not sure how easy it
would be to go from trees to general graphs, but then
trees are just dags...

hope this helps
dale


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

Date: Fri, 09 May 1997 11:33:14 -0500
From: Mike Christensen <mike@soft-tek.com>
To: Michael Schuerig <uzs90z@uni-bonn.de>
Subject: Re: Drawing a graph?
Message-Id: <337351CA.508@soft-tek.com>

Michael Schuerig wrote:
> 
> I'm looking for a module that draws a graph for me. I only want to input
> nodes (with labels) and edges (with labels) and have the module do
> everything else. Is there such a thing?
> 
> Michael
> 

Please take a look at GRAFSMAN from Soft-tek International, Inc.  We
have a live demonstration on our website, 

http://www.soft-tek.com

It is available for both UNIX and NT.

Please let me know if I can be of further assistance,

Mike Christensen
Soft-tek International, Inc.
1999 N. Amidon, Wichita, KS  67203
316 838 7200 (v)  --  316 838 3789 (f)
mailto:mike@soft-tek.com


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

Date: Fri, 09 May 1997 12:44:46 -0500
From: "Brandon W. Metcalf" <brandon@physics.utexas.edu>
To: Jim Schueler <jims@online-marketing.com>
Subject: Re: Flushing pipes
Message-Id: <3373628E.41C6@physics.utexas.edu>

Jim Schueler wrote:
> 
> Here's some sample code that I can't seem to get to work.  I can't force
> filehandle 'IN' to flush until the handle is closed.  Help, this is my
> last resort.
> 

Try something like

use FileHandle;

IN->autoflush(1);
-- 

Brandon Metcalf
UNIX Systems Administrator
Department of Physics - UT Austin
brandon@physics.utexas.edu


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

Date: 9 May 1997 19:18:41 GMT
From: q8e192@ugrad.cs.ubc.ca (Henry Avatar Chan)
Subject: Help: vars inside an eval
Message-Id: <5kvtah$5cc$1@nnrp.cs.ubc.ca>

Hi,

I need help undefining some vars that I set in an eval statement
i.e.
$CMD = "$a=5";
eval($CMD);

after the eval line, $a would have the value of 5, however,
I ONLY want the duration of $a=5 inside my eval line.
I would fork this and then kill the child, however my Perl5 for
NT doesn't have fork =(
Is there any Perl5 OO trick that could help me here?

thx,
Henry
q8e192@ugrad.cs.ubc.ca


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

Date: 9 May 1997 16:31:09 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Hide my code?
Message-Id: <5kvjgd$lja$1@news.netusa.net>

Nathan V. Patwardhan <nvp@shore.net> wrote:
>ATLANTIDE ("atlantide@wanadoo.fr"@wanadoo.fr) wrote:
>: How can I hide my code for a Perl program. I'd like to write Perl
>: programs but i don't someone to change them. Like in C, an Exe program
>: is not "uptatable" directly. Has Perl this utility ?
>Yes and no.  There's a compiler in Alpha, available from CPAN - you'll
>have to read the documentation to see if it does what you want.

There is a generic shell script obfuscator which can be used with perl.
It compiles the script into a C program and then pipes it to the
interpeter at run time.

Written by Francisco Rosales Garcia <frosal@fi.upm.es>. I forget the
offical FTP site, I have a copy of version 2.4 and the first 3.0
beta in my FTP space.

<URL:ftp://ftp.netusa.net/users/eli/shc-2.4.tgz> and
<URL:ftp://ftp.netusa.net/users/eli/shc-3.0b1.tgz>

The primary difference is 2.4 compresses the script, 3.0 encrypts it.

Elijah
------
this is often misleadingly called a shell script compiler


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

Date: 9 May 1997 19:04:10 GMT
From: simonson@skopen.dseg.ti.com (Kevin M Simonson)
Subject: How Does Someone Copy a File in perl?
Message-Id: <5kvsfa$o95@sf18.dseg.ti.com>
Keywords: copy file perl

     I'm somewhat of a novice at "perl".  I've been fixing "perl" scripts
(written by other people) for a few months now, but am now for the first
time attempting to write my own "perl" script.  All this script is trying
to do is "cp" (Unix copy) a file from the parent directory to the current
directory.
 
     Anybody have any idea what the diagnostic means by "search pattern",
and/or why it's making that complaint about my code?  I guess the real
thing I need to know is how to put a line in a "perl" script that copies a
file from the parent directory to the current directory.  Any input on this   
would be greatly appreciated.
 
                                     ---Kevin Simonson
 
,-------------------------------------------------------------------.
| i32^Perl/Cp} Hmm                                                  |
| Search pattern not terminated in file Hmm at line 2, next char ^? |
| Execution of Hmm aborted due to compilation errors.               |
| i32^Perl/Cp} ls ../Hmm.Hmm                                        |
| ../Hmm.Hmm*                                                       |
| i32^Perl/Cp} cat Hmm                                              |
| #!/usr/local/bin/perl                                             |
| cp ../Hmm.Hmm .;                                                  |
| i32^Perl/Cp}                                                      |
`-------------------------------------------------------------------'


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

Date: 9 May 97 09:59:16 GMT
From: mcohen@arl.mil (Martin Cohen)
Subject: How to Identify the Type of DBMS
Message-Id: <3372F574.127A@arl.mil>

I have a mailer that keeps correspondence in some king of data base.
Perl can give me access to several different DBMS, but i don't know
which to use to access my old mail.  There was a disk problem, and
even though I had good backups, there doesn't seem to be any way
within the mail software to combine the backups with new mail saved
in the interim.

Are there entries for /etc/magic that will identify various DBMS files?
There are at least 3 different file extensions ( Ok, you caught me, it's
MS Windows :).  Alternately, is there a WWW site that gives the formats?
Even better, has anyone written a perl script to identify DBMS from the
files?
-- 
Martin Cohen - AMSAA-North - Custom House Rm 800 Phila PA 19106-2976


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

Date: Fri, 9 May 1997 15:26:58 GMT
From: Jacob Salomon <jake@apparel.net>
Subject: if (condition) always testing true
Message-Id: <E9x6zq.FvK@nonexistent.com>

Hi y'all.

I am new to this newsgroup. This is  my first post here.

I am learning perl now, using the book "Teach Yourself Perl in 21 Days".
I am not simply copying examples but experimenting with them. Hence, I
wanted to test the "break" statement (since I did not see it in the
book's index). But something weird is happening so I added some print
statements.

Here is my take on a program from p. 149 of the book. (I am omiting the
sort part.)

#!/usr/local/bin/perl
# Read array from stdin, print it
#
print ("Enter one item per line; empty line to quit\n");
while (($input_line = <stdin>) ne "\n") # Get a line; quit if null
{
    chop($input_line);                  # Get rid of new-line at end
    $s_array[++$count] = $input_line;   # Bump counter, Insert string
    if ($input_line == "end")           # Just a debugging check
    {
        print ("$input_line: Entered END\n");
        break;
    }
}

That IF condition always tests true, although the print shows that it is
clearly NOT true: $input_line is NOT the string "end".  Furthermore,
even when I do enter "end" as an input_line, it fails to break out of
the while loop.

What have I missed?

Here is a session of running the program.  My comments are on the lines
with a *  :

$ sort.pl
Enter one item per line; empty line to quit
sdfds
sdfds: Entered END       * Huh? This is the "if" block! How can this be?
sdfdsfsd
sdfdsfsd: Entered END
wefrwefio
wefrwefio: Entered END
fvmorev
fvmorev: Entered END
end
end: Entered END
msodfm[ds
msodfm[ds: Entered END
                         * (Empty line)
 sdfds sdfdsfsd wefrwefio fvmorev end msodfm[ds  ** See the "end" there?

-- 
    -- Jake (In pursuit of undomesticated aquatic avians)
 
+-----------------------------------------------------------+
|    Impeccable Logic: A thought process which successfully |
|                      resists chicken bites                |
+-----------------------------------------------------------+


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

Date: Fri, 9 May 1997 16:16:59 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: if (condition) always testing true
Message-Id: <adelton.863194619@aisa.fi.muni.cz>

Jacob Salomon <jake@apparel.net> writes:

> Hi y'all.
> 
> I am new to this newsgroup. This is  my first post here.
> 
> I am learning perl now, using the book "Teach Yourself Perl in 21 Days".
> I am not simply copying examples but experimenting with them. Hence, I
> wanted to test the "break" statement (since I did not see it in the
> book's index). But something weird is happening so I added some print
> statements.
> 
> Here is my take on a program from p. 149 of the book. (I am omiting the
> sort part.)
> 
> #!/usr/local/bin/perl
> # Read array from stdin, print it
> #
> print ("Enter one item per line; empty line to quit\n");
> while (($input_line = <stdin>) ne "\n") # Get a line; quit if null
> {
>     chop($input_line);                  # Get rid of new-line at end
>     $s_array[++$count] = $input_line;   # Bump counter, Insert string
>     if ($input_line == "end")           # Just a debugging check

You probably want to do string comparison here, use eq.

>     {
>         print ("$input_line: Entered END\n");
>         break;

Use last here.

>     }
> }


Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 09 May 1997 12:16:49 -0400
From: psmith@baynetworks.com (Paul D. Smith)
To: jake@apparel.net
Subject: Re: if (condition) always testing true
Message-Id: <p567wsoc26.fsf@baynetworks.com>

Try using the string equality operator "eq" instead of the numeric
equality operator "==":

  if ($input_line eq "end")

If you use numeric equality both strings are converted to numbers, and
since there're no digits at the beginning of them both convert to the
number 0, and are numerically equal.

Of course, pedants such as myself would use:

  if ($input_line eq 'end')

:)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.


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

Date: 9 May 1997 16:35:28 GMT
From: dbwhite@btv.vnet.ibm.com (David B. White)
Subject: Re: if (condition) always testing true
Message-Id: <5kvjog$11om$1@mdnews.btv.ibm.com>

In article <E9x6zq.FvK@nonexistent.com>,
        Jacob Salomon <jake@apparel.net> writes:

>     if ($input_line == "end")           # Just a debugging check

> That IF condition always tests true, although the print shows that it is
> clearly NOT true: $input_line is NOT the string "end".  Furthermore,
> even when I do enter "end" as an input_line, it fails to break out of
> the while loop.
>
> What have I missed?

You are testing for *numerical* equality on two strings.  Perl obliges
and converts both to numbers - specifically, the number 0.

What you really want is:
        if ($input_line eq "end")       # test for *string* equality

--
David B. White
IBM Microelectronics, Circuit Verification & Design Tools
Internal: dbwhite@btv             Internet: dbwhite@vnet.ibm.com
Phone: 802-769-5671     (TieLine: 446)     Fax: 802-769-5722


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

Date: 9 May 1997 16:01:53 GMT
From: jgorman@acsu.buffalo.edu
Subject: Migration from perl 4 to perl 5
Message-Id: <01bc5c91$2c79e2d0$2285cd80@gorman>

Any specific constructs or problematic issues with migrating from perl 4 to
perl 5?



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

Date: 9 May 1997 17:12:04 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: Migration from perl 4 to perl 5
Message-Id: <5kvlt4$9kn$1@amdint2.amd.com>

In article <01bc5c91$2c79e2d0$2285cd80@gorman>,
 <jgorman@acsu.buffalo.edu> wrote:
>Any specific constructs or problematic issues with migrating from perl 4 to
>perl 5?

See perltrap(1) for some 4->5 migration issues.
The most common one I know of is that lists are interpolated
inside double quoted strings in 5, and were not in 4.

So you used to be able to say:

	print "Email: fred@usa.net\n";

And now you should escape the @ to prevent it from trying to
reference a list named @usa:

	print "Email: fred\@usa.net\n";

I suggest you always run perl with a -w switch on the #! line
to prevent other problems:

	#!/usr/local/bin/perl -w

-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: 9 May 1997 16:09:04 GMT
From: jgorman@acsu.buffalo.edu
Subject: Migration from ver 4 to 5
Message-Id: <01bc5c93$ca203eb0$2285cd80@gorman>

Any specific problems that may arise when migrating scripts from version 4
to 5?
Specific constructs that may be problematic would help (if there are any!)

Thanks.


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

Date: 9 May 1997 09:37:58 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Migration from ver 4 to 5
Message-Id: <5kvjt6$g0g$1@shell3.ba.best.com>

In article <01bc5c93$ca203eb0$2285cd80@gorman>,
 <jgorman@acsu.buffalo.edu> wrote:

(Out of curiosity, was there any particular reason why you posted this 3 
times?)

>Any specific problems that may arise when migrating scripts from version 4
>to 5?

The perltrap man page from perl5 has some relevant information. You can
also have a look at:

	<URL:http://www.perl.com/perl/everything_to_know/perl425.html>

for more help.

/MC
-- 
--
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: 9 May 1997 16:01:56 GMT
From: jgorman@acsu.buffalo.edu
Subject: Migration to perl 5
Message-Id: <01bc5c91$884c5b10$2285cd80@gorman>

Any known issues related to migrating from Perl 4 to version 5?  Specific
constructs etc would be helpful.

Thanks.


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

Date: 9 May 1997 09:33:42 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Minimum perl installation
Message-Id: <5kvjl6$f09$1@shell3.ba.best.com>

In article <5kurvo$e7b$1@nuacht.iol.ie>,
John Sheehy <jsheehy@trintech.com> wrote:
>
>Are there any issues I should be aware of here?

Assuming that you've linked all the perl extensions statically when you
compiled it, the only issue I can think of offhand is that the sites in
question may believe they have perl and try to run other perl scripts down
the road and have them blow up. I would suggest that unless you have a 
compelling reason not to, that you include a full perl distribution. (If
the sites are all running the same platform, you could just build perl
for that platform and then tar it up and include the tarfile with your
program.)

Just my $0.02.

/MC

-- 
--
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: 09 May 1997 11:28:48 -0600
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: cam@cs.ualberta.ca (Camerson Schaus)
Subject: Re: Module to generate a parse tree
Message-Id: <omafm4pnao.fsf@tees.cs.ualberta.ca>

In article <5kqnjo$i8h$1@scapa.cs.ualberta.ca> cam@cs.ualberta.ca (Camerson Schaus) writes:

> I am looking for a perl module/source that will generate a parse tree
> when given a grammar.

You need byacc (Berkeley YACC) that can generate perl as output. Better yet,
use the patches by JAKE that produce a perl5 OO parser. Luckily for you, I've
installed them locally in /usr/local/gradpub/perl. Add
/usr/local/gradpub/sun4/bin to your PATH and /usr/local/gradpub/perl/man to
your MANPATH, then check 'man byacc' and 'man byacc5' and use 'byacc5 -P' to
generate the parser from a grammar.

If you want to be really cool and hip, try using an OO lexer as well which is
in /usr/local/gradpub/perl/src/Parse-Lex-1.12. Parse-Lex had some installation
problems, but it's not hard to complete the installation manually.
Unfortunately, the doc is in French; I've started a translation but my French
is poor, so I lost interest. Maybe we can translate it together and start
using it?

To use the Perl modules in gradpub, put this in the beginning of your .pl file:
  use lib '/usr/local/gradpub/perl/lib/site_perl/';


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

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

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