[6627] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 252 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 8 07:07:10 1997

Date: Tue, 8 Apr 97 04:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 8 Apr 1997     Volume: 8 Number: 252

Today's topics:
     Re: Battling the regular expression -- how do I fix thi (Tim Gim Yee)
     Re: Can It Be Done (Geoffrey Hebert)
     CGI output HTML <paull@saa-cons.co.uk>
     EXPORT question <langlois@csn.net>
     Re: EXPORT question <tchrist@mox.perl.com>
     Re: Getting system function output into variable? (Anthony Boyd)
     Re: HELP: perl5.003 dynamic extensions don't build on S (Casper H.S. Dik - Network Security Engineer)
     Re: How to use COOKIES from perl ??? (Geoffrey Hebert)
     LWP - again... <schajer@dircon.co.uk>
     Newbie Question about Llama Book (Stephen J. Cole)
     Re: Newbie Question about Llama Book (Joshua Lerner)
     Newbie Uncertainties, Chess Translator (Jonathan Berry)
     Re: Newbie Uncertainties, Chess Translator (David Alan Black)
     Re: perl Alpha compiler on OS/2? (Mark Mills)
     Perl and MSDOS <imbe@primenet.com>
     Perl and multicasting <chris@ixlabs.com>
     Re: Problems with OO Perl5 features <lpa@sysdeco.no>
     Re: Renegade script setting own values? (David Alan Black)
     Re: Renegade script setting own values? (Mark Mills)
     Re: Split and Print? <flg@vhojd.skovde.se>
     Re: Split and Print? (A. Deckers)
     Re: Split and Print? (Tim Gim Yee)
     Re: Split and Print? (Pontus Berglund)
     Re: Unix and ease of use  (WAS: Who makes more ...) <david@batcave.bungi.com>
     Re: Unix and ease of use (WAS: Who makes more ...) <NOSPAMplas@fmi.ch>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 08 Apr 1997 03:48:52 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: Battling the regular expression -- how do I fix this?
Message-Id: <3349bd30.40470553@news.seanet.com>

On Mon, 07 Apr 1997 16:56:30 +0000, Charles Herold
<cherold@pathfinder.com> wrote:

>What I've got is a bunch of files that contains something like the below
>HTML snippet, and what I want is to find every <TH></TH> combination and
>put a <FONT> tag inside.  But the substitute expression I am using only
>changing the last incidence of the <TH></TH> combo.  Why?

Because your quantifiers are greedy.  See perlre.

>HTML snippet:
>
><TR VALIGN=TOP BGCOLOR="#99CCCC">
>        <TH WIDTH="25%">
>        INDUSTRY<BR>RANK
>        </TH>
>        <TH>
>        INDUSTRY
>        </TH>
>        <TH WIDTH="25%">
>        1996 $
>        </TH>
></TR>
>
>CODE that doesn't do what I expected ($intext contains the entire
>document):
>
>$intext =~ s#(<TH.*>)(.*)(</th>)#$1<FONT SIZE="-1">$2</FONT>$3#sgi;

$intext =~ s#(<TH.*?>)(.*?)(</th>)#$1<FONT SIZE="-1">$2</FONT>$3#sgi;
                   ^     ^


-- Tim Gim Yee             tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"


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

Date: Tue, 08 Apr 1997 05:07:56 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Can It Be Done
Message-Id: <5icis4$646$1@news3.microserve.net>

Good luck!  This is much too hard to describe in a quick note.  You
are asking for a complete process.  Getting and putting data on the
web takes a book.  For your purposes I think you will find the
following book very usefull:
  Teach Yourself CGI Programming with Perl in a week
  By Eric Herrmann

jhardy@cins.com wrote:


>Come on guy's, give me a break! I know one of you Guru's know how to do this 
>and I just can't figure it out. 




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

Date: 8 Apr 1997 10:08:12 GMT
From: "SAA" <paull@saa-cons.co.uk>
Subject: CGI output HTML
Message-Id: <01bc4404$e6b7e2a0$d314020a@char.saa-cons.co.uk>

Hello,

I am using Perl to produce the CGI functions behind a series of web-pages,
nothing new there !

I've got the script reading in various form-fields from the form which
calls it, the script processes these values does a bit of jiggery-pokery
with other information ( file sizes, system information etc. ) and produces
an output HTML file which is returned to the browser with information and
an href link supplied by the Perl script.
All well and good.

I'm now trying to make it easier to maintain the HTML which is returned as
it is currently in the Perl code  i.e. 	print <<END_OF_HTML;
			        	<html goes here>
				END_OF_HTML;
so I took the HTML and placed it in another file which the scripts reads in
using 
OPEN(IN, filename) and outputs it as before, unfortunately the variable
values marked by $var_name in the HTML no longer get replaced with the Perl
values but just get shown as '$var_name'.

Has anybody managed to get this to work where Perl reads in the HTML file,
replaces the $var_name with the Perl generated value and then outputs it to
the browser ?

Any ideas or comments are most welcome.

				Paul Lovell

paull@saa-cons.co.uk


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

Date: Mon, 07 Apr 1997 20:32:27 -0600
From: bruce langlois <langlois@csn.net>
Subject: EXPORT question
Message-Id: <3349AE3B.8176C08@csn.net>

Can anybody fill me in on specific details concerning
the use of EXPORT and EXPORT_OK statements when creating
packages?  The documentation (camel and faq) both describe
these statements, but I can't quite make out why the
lists would be different.

-- 
Everything goes better with a delayed blast fireball =8)
lothar@acsp.com
langlois@csn.net


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

Date: 8 Apr 1997 03:05:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: EXPORT question
Message-Id: <5iccmm$p8f$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    bruce langlois <langlois@csn.net> writes:
:Can anybody fill me in on specific details concerning
:the use of EXPORT and EXPORT_OK statements when creating
:packages?  The documentation (camel and faq) both describe
:these statements, but I can't quite make out why the
:lists would be different.

Perhaps the following from the FAQ will help.

FAQ: How do I create a module?

    A module is a package that lives in a file of the same name. For
    example, the Hello::There module would live in Hello/There.pm. For
    details, read the perlmod manpage. You'll also find the Exporter
    manpage helpful. If you're writing a C or mixed-language module with
    both C and Perl, then you should study the perlxstut manpage.

    Here's a convenient template you might wish you use when starting
    your own module. Make sure to change the names appropriately.

	package Some::Module;  # assumes Some/Module.pm

	use strict;

	BEGIN {
	    use Exporter   ();
	    use vars       qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

	    ## set the version for version checking; uncomment to use
	    ## $VERSION     = 1.00;

	    # if using RCS/CVS, this next line may be preferred,
	    # but beware two-digit versions.
	    $VERSION = do{my@r=q$Revision: 1.15 $=~/\d+/g;sprintf '%d.'.'%02d'x$#r,@r};

	    @ISA         = qw(Exporter);
	    @EXPORT      = qw(&func1 &func2 &func3);
	    %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],

	    # your exported package globals go here,
	    # as well as any optionally exported functions
	    @EXPORT_OK   = qw($Var1 %Hashit);
	}
	use vars      @EXPORT_OK;

	# non-exported package globals go here
	use vars      qw( @more $stuff );

	# initialize package globals, first exported ones
	$Var1   = '';
	%Hashit = ();

	# then the others (which are still accessible as $Some::Module::stuff)
	$stuff  = '';
	@more   = ();

	# all file-scoped lexicals must be created before
	# the functions below that use them.

	# file-private lexicals go here
	my $priv_var    = '';
	my %secret_hash = ();

	# here's a file-private function as a closure,
	# callable as &$priv_func;  it cannot be prototyped.
	my $priv_func = sub {
	    # stuff goes here.
	};

	# make all your functions, whether exported or not;
	# remember to put something interesting in the {} stubs
	sub func1      {}    # no prototype
	sub func2()    {}    # proto'd void
	sub func3($$)  {}    # proto'd to 2 scalars

	# this one isn't exported, but could be called!
	sub func4(\%)  {}    # proto'd to 1 hash ref

	END { }       # module clean-up code here (global destructor)

	1;            # modules must return true
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
     "... an initial underscore already conveys strong feelings of
      magicalness to a C programmer."
	--Larry Wall in <1992Nov9.195250.23584@netlabs.com>


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

Date: Tue, 08 Apr 1997 00:39:21 -0700
From: anthony@outshine.com (Anthony Boyd)
Subject: Re: Getting system function output into variable?
Message-Id: <anthony-0804970039210001@anthony.outshine.com>

tchrist@mox.perl.com (Tom Christiansen) wrote:
> aboyd@wpo.borland.com (Anthony Boyd) writes:

> :I couldn't find this in the FAQ, so here goes.  
> 
> You didn't look hard enough. :-(

You're right, I read a printout.  I should have done a grep online.

> :I thought
> :putting backticks around the grep would return the data.  
> 
> It would, but you didn't use backticks. Does Microsoft Brain Damage
> extend to confusion about ticks and backticks the way it does to 
> slashes and backslashes? :-)

I'm not sure.  As a Mac & Unix person, I have managed to avoid Microsoft
Brain Damage.  But if you get it, let me know the results.  :-)

>   Why can't I get the output of a command with system()?
> 
>     You're confusing the purpose of system() and backticks ('').  
>     system() runs a command and returns exit status information (as 
>     a 16-bit value -- the low 8 bits are the signal the process died from, if
>     any, and the high 8 bits are the actual exit value).  Backticks ('')
>     run a command and return what it sent to STDOUT.
> 
>         $status = system("mail-users");
>         $output = `ls`;
> 
> Make sense?

Yep, brilliant.  Succinct.  Solved my problem and headed off a follow-up
question ("so, what's the difference between backticks and system?").  I
hope Larry gets something similar into the 3rd edition of Programming
Perl.  The 2nd edition's page on system() isn't very intuitive compared to
your paragraph.

-Anthony Boyd


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

Date: 8 Apr 1997 08:38:39 GMT
From: Casper.Dik@Holland.Sun.COM (Casper H.S. Dik - Network Security Engineer)
Subject: Re: HELP: perl5.003 dynamic extensions don't build on Solaris ?
Message-Id: <casper.860488927@uk-usenet.uk.sun.com>

benedict@daimi.aau.dk (Benedict Lofstedt) writes:

>lib/anydbm.....Can't load '../lib/auto/Fcntl/Fcntl.so' for module Fcntl: ld.so.1: ./perl: fatal: relocation error: symbol not found: main: referenced in ../lib/auto/Fcntl/Fcntl.so at ../lib/DynaLoader.pm line 140.

This is what happens when you compile a shared library with gcc and use:

	gcc -G

instead of

	gcc -shared

(The first one will link in the runtime startup which expects a function
main, the second one will only put in the library "init/fini" stuff)

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.


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

Date: Tue, 08 Apr 1997 04:57:37 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: How to use COOKIES from perl ???
Message-Id: <5ici8p$61a$1@news3.microserve.net>

Perl read and writes.

Cookies are a form of data formated so that a www browser can process
it.

This is not a perl question.  use another news group.
   try comp.info.system.www.authoring.cgi



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

Date: Tue, 08 Apr 1997 09:12:30 +0000
From: Alex Schajer <schajer@dircon.co.uk>
Subject: LWP - again...
Message-Id: <334A0BFE.167E@dircon.co.uk>

Hi,

I'm trying to user the LWP library and in particular the HTTP/Header
part.
All I want to do is go through a list of URL's and check when they were
last modified. It says in the LWP manual user 

if ($h->last_modified < time - 60 *60 {
 ...
}

However how do I tell the script what webpage to look at?

Thanks

Please reply by email too.

Alex


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

Date: 8 Apr 97 02:56:18 GMT
From: scole@liberty.uc.wlu.edu (Stephen J. Cole)
Subject: Newbie Question about Llama Book
Message-Id: <3349b3d2.0@logic.uc.wlu.edu>

Greetings, I am playing with Perl and going through the llama book and am 
stumped on page 56.  The fifth, sixth, and seventh printed lines state:

($d,@fred) = ($a,$b,$c); # give $a to $d, and ($b,$c) to @fred
($e,@fred) = @fred; # remove the first element of @fred to $e
# this makes @fred = ($c) and $e =$b

Would someone be so kind to explain this to me.  Perhaps I am rather 
"thick" but it doesn't seem to make sense to me.

As there isn't probably a huge need to waste bandwidth here, feel free to 
just email me rather than doing a followup.

Thanks,

Stephen

--
Humor is an affirmation of dignity, a declaration of man's superiority to 
all that befalls him.  -Romain Gary
/* Stephen J. Cole            scole@wlu.edu           www.wlu.edu/~scole */
/* Computing and Network Specialist        Washington and Lee University */


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

Date: 8 Apr 1997 01:20:49 -0400
From: jlerner@panix.com (Joshua Lerner)
Subject: Re: Newbie Question about Llama Book
Message-Id: <5ickjh$dob@panix3.panix.com>

[posted and mailed]

In article <3349b3d2.0@logic.uc.wlu.edu>,
Stephen J. Cole <scole@liberty.uc.wlu.edu> wrote:
>Greetings, I am playing with Perl and going through the llama book and am 
>stumped on page 56.  The fifth, sixth, and seventh printed lines state:
>
>($d,@fred) = ($a,$b,$c); # give $a to $d, and ($b,$c) to @fred

$a is assigned to $d, and the remaining scalars ($b and $c) are assigned
to @fred.  @fred now consists of two scalars.

>($e,@fred) = @fred; # remove the first element of @fred to $e
># this makes @fred = ($c) and $e =$b

The second line of code is actually pretty much the same as the first.

	($e, @fred) = @fred;

is like saying

	($e, @fred) = ($b, $c);

 ..  So, as in the first example, $b is assigned to $e, which only leaves $c
to be assigned to @fred.

Joshua Lerner


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

Date: 8 Apr 1997 00:20:44 -0700
From: jberry@islandnet.com (Jonathan Berry)
Subject: Newbie Uncertainties, Chess Translator
Message-Id: <y+cSz4mipRgR090yn@islandnet.com>

I have only ever programmed in BASIC, and today I wrote my
first Perl script, using the Win32 version in Win95 (after an
embarrassing number of compile cycles):

# french.pl perl script to translate chess games from English to French.
# Notation is standard FIDE algebraic: 1.e4 c5 2.Nf3 d6 3.d4 cxd4
# This should not harm any non-chess text.  Input file(s) should be on the
# command line.  Jonathan Berry, April 1997.
# Hereby tossed into the public domain.

open (OUTFILE, ">> outfile");

@English = qw ( P N B R Q K );
@French  = qw ( P C F T D R );

foreach $Piecex (@English) {
  $Trans {$Piecex} = $French [$counter++];
}

while (<>)  {
  foreach $Key (keys %Trans) {
    s/($Key)(x?[1-8]?[a-h]{1,2}x?[1-8])/$Trans{$Key}$2/g;
  }
  print OUTFILE;
}

Criticisms?

I found the way I discovered (tim-woody?) of assigning the
arrays to a hash to be inelegant, especially when you try to
apply it to a "general case" such as translating a chess game
from any language to any other language.  Surely there's a way
to choose any array as the keys--and any other array as the
values--of the hash without going through what in BASIC would
be a double SELECT CASE process.

The general case process also fails in half the cases when the
two languages share a letter for the pieces.  For example, if I
were to reverse the two languages here, the French Tour (T)
would be translated to the English Rook (R) and then in the
subsequent processing this would be confused with the French
Roi (R) and translated to the English King (K).  So every French
rook move would become an English king move.  I could avoid
this problem by moving the kings up before the rooks in the
arrays, but it could easily rear its ugly head again in other
languages.

A possible solution is to split the input line into words,
process each word separately, exiting the loop on success, and
then joining the processed words.  Each word (entity separated
by whitespace) would contain no more than one chess move.

The compiler gave me a warning message on account of the
$counter which it thought was used only once.

Most of my recompiles involved the mistaken use of the e switch
on the substitution.

If you want a game to try this out on, here's one:

[Event "1997 Toronto Closed Chess Championship"]
[Site "Primrose Hotel"]
[Date "1997.01.18"]
[Round "2"]
[Result "1-0"]
[White "Zugic, Igor"]
[Black "Day, Lawrence"]

1. d4 g6 2. c4 Bg7 3. Nf3 d6 4. g3 Nf6 5. Bg2 O-O
6. O-O Nbd7 7. Nc3 c6 8. e4 e5 9. h3 Qa5 10. Qc2 exd4
11. Nxd4 Qc5 12. Nce2 Nb6 13. b3 Re8 14. Be3 Qh5
15. Rad1 Qe5 16. Nc3 Qe7 17. Rfe1 Qc7 18. f4 a6
19. Bf2 Bd7 20. a4 a5 21. Rd2 Rad8 22. Red1 Bc8
23. Ndb5 cxb5 24. Nxb5 Qc6 25. Rxd6 Rxd6 26. Rxd6 Nxe4
27. Rxc6 Nxf2 28. Rxc8 Nxh3+ 29. Bxh3 Nxc8 30. Qd2 f5
31. Bg2 b6 32. Qd7 Kf8 33. Nc7  1-0

The html files containing the Perl documentation have
next-to-no links, so you can only jockey around inside the file
that you are currently viewing.  Was that on purpose?

I have the (dromedary) book "Programming Perl" from the local
library.  The first chapter is very good.  The following
chapters assume that you are a denizen of the UNIX and C worlds
(I am not).  However, it is *less* objectionable on that
account than anything else I have encountered from the UNIX
world, so thumbs up anyway.

 --
cheers,
Jonathan


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

Date: 8 Apr 1997 09:46:02 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Newbie Uncertainties, Chess Translator
Message-Id: <5id44q$7cp@pirate.shu.edu>

Hello -

jberry@islandnet.com (Jonathan Berry) writes:

>I have only ever programmed in BASIC, and today I wrote my
>first Perl script, using the Win32 version in Win95 (after an
>embarrassing number of compile cycles):

Now we just need to get you an operating system, and you'll
be all set :-)

># french.pl perl script to translate chess games from English to French.
># Notation is standard FIDE algebraic: 1.e4 c5 2.Nf3 d6 3.d4 cxd4
># This should not harm any non-chess text.  Input file(s) should be on the
># command line.  Jonathan Berry, April 1997.
># Hereby tossed into the public domain.

>open (OUTFILE, ">> outfile");

>@English = qw ( P N B R Q K );
>@French  = qw ( P C F T D R );

>foreach $Piecex (@English) {
>  $Trans {$Piecex} = $French [$counter++];
>}

>while (<>)  {
>  foreach $Key (keys %Trans) {
>    s/($Key)(x?[1-8]?[a-h]{1,2}x?[1-8])/$Trans{$Key}$2/g;
>  }
>  print OUTFILE;
>}

>Criticisms?

Check the return value of your system calls:

open (OUTFILE, ">>outfile") or die "Can't append to outfile: $!";

and close OUTFILE or die... when done.

Here's another approach you might use or adapt, although it depends
on two things, neither of which I'm 100% sure of:

1. All chess lines begin with an integer followed by a period.
2. In chess lines, it is safe to change all occurrences of the
letters in question.

Assuming these two conditions are true, you could do something like:

while (<>) {
tr /PNBRQK/PCFTDR/ if /^\d+\./;
print OUTFILE;
}

This will protect you from the multiple-pass/wrong piece problem, and
you could generalize this to handle different languages by abstracting
the piece lists.  For instance (as a start, anyway):

my $english = "PNBRQK";
my $french = "PCFTDR";

while (<>) {
eval "tr /$english/$french/" if /^\d+\./;
print OUTFILE;
}


David Black
dblack@icarus.shu.edu


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

Date: Tue, 08 Apr 1997 07:20:46 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: perl Alpha compiler on OS/2?
Message-Id: <334ae930.11228890@news.ntr.net>

On 7 Apr 1997 20:39:07 GMT, nvp@shore.net (Nathan V. Patwardhan)
wrote:

>Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
>
>: I wonder why people are so excited on the compiler? Currently it
>: provides (almost?) no advantages over just running your application.
>
>I think "executable" might be the magic word for some.
>
>--
>Nathan V. Patwardhan
>nvp@shore.net
>

Not having to e-mail someone perl, gcc, a good book on make, etc
seemed to do it for some of them.  Plus some of those crazy bums don't
want to just give their code away in an easily modifiable form.

(ps sarcasm use here for emphasis only.  I still haven't found a use
for it either :>  I just couldn't let the thread go un-answered)

--
Mark <mark@ntr.net>
Please don't sue my boss because you don't 
understand the concept of free speech.


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

Date: 7 Apr 1997 21:06:00 -0700
From: "Smith A. Cat" <imbe@primenet.com>
Subject: Perl and MSDOS
Message-Id: <3349C449.6A9B@primenet.com>

I know I am the ONLY person using Perl in MSDOS, but I would like to
share my experience getting the latest Ilyaz port running "as
advertised" under DOS:

got the files:
		1. perl_aou.zip
		2. perl_mlb.zip

unzipped perl_.exe into c:\perl and renamed it to perl.exe

pkunzip -d perl_mlb.zip from c:\perl\lib

hex edited the perl.exe so that one of the internal directory
entries pointed at c:/perl/lib (instead of f:/blah/blah/blah).

hex edited the perl.exe so that where it said f:/bin/sh.exe it
now says c:4dos.com (shareware DOS command interpreter) so that
the exe will spawn a subshell nicely.

and most importantly:

DID NOT set the PERLLIB variable! If you set it to anything at all
the system will not spawn a subshell!! don't know why.  this is why
I hex edited the binary.

but i did:

use emm386 with the noems switch.
loadhigh cwsdpmi -p (charles sandman's excellent DPMI service!)
set emx=c:rsx.exe (since emx won't do the piping stuff perl wants)

(also helps to hex edit rsx.exe so that the version reads c9.0. not
necessary, but disables irritating emx (yes emx) version warning. most
emx stuff seems to work with cwsdpmi and rsx, including TeX, metafont, 
and all the DJGPP stuff.)

and after doing this can use the system, exec, and backtick functions
very well, thank you!  if you don't do all of these things you will 
absolutely NOT get system , exec, and backticks (``) working.


question: how many of you REALLY get fed-up when you post DOS questions
and some yo-yo with a CRAY gives a wrong answer.  and then says it's
YOUR
fault that his answer is bogus?  come on, raise your hands!!




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

Date: Mon, 07 Apr 1997 19:39:39 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Perl and multicasting
Message-Id: <3349AFEB.6103@ixlabs.com>

I have a simple UDP program in Perl which spits datagrams out to a
remote host. I send it to multiple hosts using a loop.

I believe there is some way I can multicast the datagram instead. Does
anyone have any info or pointers on how this is done?

Thanks
Chris


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

Date: Tue, 08 Apr 1997 09:24:11 +0200
From: Luca Passani <lpa@sysdeco.no>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Problems with OO Perl5 features
Message-Id: <3349F29B.C92@sysdeco.no>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc,
>     Luca Passani <lpa@sysdeco.no> writes:
> :### perl -d convertdia.pl diag0
> :Stack dump during die enabled outside of evals.
> :
> :Loading DB routines from perl5db.pl patch level 0.94
> :Emacs support available.
> :
> :Enter h or `h h' for help.
> :
> :Undefined subroutine &Carp::longmess called at
> :/usr/local/lib/perl5/perl5db.pl l
> :ine 1361.
> :###
> 
> That happens when you have a syntax error in your original program.
> If you can't compile, you can't debug.

yes, and the error is that I can't load the two packages I reported in
the rest of the original article correctly. My problem remains.

BTW Another poster mentions a possible bug in the debugger. What do you
think?

thanx

Luca


======================================================================
Luca Passani.          | Sysdeco Innovation AS, http://www.sysdeco.no
Email: lpa@sysdeco.no  | Trondheimsveien 184, 0570 Oslo, Norway
Tel: (+47) 22 09 66 06 | Fax: (+47) 22 09 65 03
======================================================================


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

Date: 8 Apr 1997 06:25:58 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Renegade script setting own values?
Message-Id: <5icodm$sd2@pirate.shu.edu>

Hello -

Matt Riggsby <mriggsby@sybex.com> writes:

># If $bodyappend is "Yes," attach the current line to the end of
># the body text
>   if ($bodyappend = "Yes") {
>	chop;
>	$value = $_;
>	$valueholder{body} .= $value;
>	}

Change that to:

	if ($bodyappend eq "Yes") {...}

As it stands, you are assigning the value "Yes" to $bodyappend,
and testing the value of the assignment (which is "Yes").


David Black
dblack@icarus.shu.edu


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

Date: Tue, 08 Apr 1997 07:20:43 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: Renegade script setting own values?
Message-Id: <3349e6c9.10613978@news.ntr.net>

On Mon, 07 Apr 1997 10:48:58 -0700, Matt Riggsby <mriggsby@sybex.com>
wrote:

>
>"lines" separated by a newline.  My problem is that the variable I'm
>using to mark the beginning and end of the body text appears to be on at
>all times.  As a result, the Date:, From:, and Subject: lines are all
>fine, but the body text variable includes *everything* else.  Clearly,
>I'm missing something important and obvious, but I haven't a clue what

>	$bodyappend = "No";

>   if ($bodyappend = "Yes") {


You need to find out the difference between these
$bodyappend= "Yes"
$bodyappend=="Yes"
$bodyappend eq "Yes"

hint, one assigns a lvalue (sets a variable to a value)
      one tests for numerical equality
      one tests for string equality

For extra credit, find out what an assignment returns when it is
successful.

Don't sweat this too much BTW.  you'll soon be VERY happy you don't
use = for three DIFFERENT things.  :>

--
Mark <mark@ntr.net>
Please don't sue my boss because you don't 
understand the concept of free speech.


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

Date: 7 Apr 97 13:24:38 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: Split and Print?
Message-Id: <01bc4357$4b228320$e20f10c2@odens.di.vhojd.skovde.se>

>>Elizabeth Hamilton <hamilte@one.net> wrote 
> # This one produces error messages (See below)
> 
> if (m#/gclc/members.html#) {
>   ($hits, $bytes, $size, $304, $URL) = split(/\s+/, $_);
>   print $hits >OUTFILE;
             ^^^^^^^^^^

This looks kinda AWKward to me. I think Perl will
intepretate this as, print zero if OUTFILE is less then $hits (i e it does
a
numrical "greater than" comparision). Try it this way instead:

   print OUTFILE, "$hits\n";

or something.

> close <INFILE>;
> clsoe <OUTFILE>;
   ^^^

:-) Probably not in your real source code eh? 

And it should be "close(INFILE)" or "close INFILE", i e without the < and
>.

Hope this helps.

/Fredrik


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

Date: 8 Apr 1997 02:14:13 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Split and Print?
Message-Id: <slrn5kjafl.qoe.Alain.Deckers@nessie.mcc.ac.uk>

In <01bc4357$4b228320$e20f10c2@odens.di.vhojd.skovde.se>,
	Fredrik Lindberg <flg@vhojd.skovde.se> wrote:
>
>   print OUTFILE, "$hits\n";
#                ^ Don't want comma here.

Cheers,
-- 
Alain.Deckers@man.ac.uk          <URL:http://www.man.ac.uk/%7Embzalgd/>
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
   Perl software: <URL:http://www.perl.com/CPAN/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: Tue, 08 Apr 1997 03:11:47 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: Split and Print?
Message-Id: <3349ad28.36366472@news.seanet.com>

On Sun, 06 Apr 1997 20:47:29 -0400, Elizabeth Hamilton
<hamilte@one.net> wrote:

># This one produces error messages (See below)
>
>if (m#/gclc/members.html#) {
>  ($hits, $bytes, $size, $304, $URL) = split(/\s+/, $_);
>  print $hits >OUTFILE;
>  print MAIL;
>  }
>
>-------------------------
>Error messages:
>Identifier "main::size" used only once: possible typo at ./gclclog6.pl
>line 33.
>Identifier "main::bytes" used only once: possible typo at ./gclclog6.pl
>line 33
>Identifier "main::URL" used only once: possible typo at ./gclclog6.pl
>line 33.

You only used $size, $bytes, and $URL once.  You've assigned values to
them, but then neglected them.  If $hits is the only variable you plan
to use, then perhaps...

$hits = (split)[0];

>Modification of a read-only value attempted at ./gclclog6.pl line 33,
><INFILE>
>hunk 106.

Assigning to $304 is like assigning to $1.  That's some RE you must
have there :)


-- Tim Gim Yee             tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"


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

Date: Tue, 08 Apr 1997 07:57:31 GMT
From: pontus@se.adsanker.com (Pontus Berglund)
Subject: Re: Split and Print?
Message-Id: <334cf94e.331928359@sfunix2.fln.ads.se>

On Tue, 08 Apr 1997 03:11:47 GMT, tgy@chocobo.org (Tim Gim Yee) wrote:

[...]
>
>You only used $size, $bytes, and $URL once.  You've assigned values to
>them, but then neglected them.  If $hits is the only variable you plan
>to use, then perhaps...
>
>$hits = (split)[0];

Oh, this is a good one. But if I want to use two or three variables,
which is often the case when I'm stating a file? Is there a similar
trick then?

I'm new to Perl and I'm waiting for my copy of the camel book, so
please excuse me if this question is particularly.

    [Pontus]



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

Date: Tue, 8 Apr 1997 06:49:19 GMT
From: David Masterson <david@batcave.bungi.com>
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <m2k9meggb4.fsf@batcave.bungi.com>

John Johnson <johntj@bellsouth.net> writes:

> David Masterson wrote:
> > tomw@tsys.demon.co.uk (Tom Wheeley) writes:
> > > Windows is a closed standard.  Could anyone write a product to
> > > compete with Windows?  (well, there's WINE of course... imho the
> > > most important project for free software on the intel platform)
> > Yeah, but didn't Microsoft realize the potential hurt that WABI/WINE
> > would cause to their bottom line and change the playing field again
> > with Windows-95/Windows-CE/Windows-NT and thus limit or even eliminate
> > WABI/WINE as a serious competitor?
>   You can't be serious.

Serious about what?  I'll admit that perhaps I overstated things, but
which of those things are you referring to?

* Is WABI/WINE too small a thing to worry about for Microsoft?
* Will WABI/WINE be able to handle W95/WCE/WNT binaries?
* Why is WABI no longer making headlines against W95/WNT?

-- 
David Masterson
david@batcave.bungi.com
-- 
David Masterson
david@batcave.bungi.com


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

Date: Tue, 8 Apr 1997 06:40:07 GMT
From: Stephane Plattner <NOSPAMplas@fmi.ch>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <3349E847.3A94@fmi.ch>

> NO!  freeware is voluntary activity (free enterprise) with no guns or
> g-men in sight.  It is the opposite of socialism.

You have a rather bizarre and strange idea of socialism! It's more to Socialism 
than a group of gangster pointing with their machine guns at you. I hope RAMBO 
is NOT your only historical teacher ...  :-)

As someone else stated: socialism in theory it's a great thing, but in practice 
it contradicts to the human (or better saying: ape-ish) motivational structure.
-- 
Best
Stephane Plattner
DMS - Digitale Medien Systeme AG / Digital Media Systems Inc.
CEO Broadcast Communication Technologies

For reply remove NOSPAM!


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

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

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