[9474] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3067 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 6 21:07:25 1998

Date: Mon, 6 Jul 98 18:01:40 -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           Mon, 6 Jul 1998     Volume: 8 Number: 3067

Today's topics:
        -- Question on Reading Hash Info From A File. <kamenar@webmall.net>
    Re: -- Question on Reading Hash Info From A File. <dgris@rand.dimensional.com>
    Re: -- Question on Reading Hash Info From A File. (Josh Kortbein)
    Re: -w on production code (was Re: better way of gettin (Abigail)
    Re: -w on production code (was Re: better way of gettin (Michael J Gebis)
    Re: -w on production code (was Re: better way of gettin <tchrist@mox.perl.com>
    Re: -w on production code (was Re: better way of gettin (Michael J Gebis)
    Re: 2-byte code match problem (Abigail)
    Re: 2-byte code match problem (Yun Giljung)
    Re: 5.004_69 win32 Glob problem (Dominic Dunlop)
    Re: 5.004_69 win32 Glob problem (Bbirthisel)
        <STDIN> chunk 1 - Error <thomas@provideo.dk>
    Re: <STDIN> chunk 1 - Error (Larry Rosler)
        [Q] Environment size causing pbs in Perl 5.004_04 (HP-U philippe.sockeel@cdn.fr
        Accessing UDB from perl? <shah@xnet.com>
        altering formmail.pl <howard@vortexweb.com>
    Re: altering formmail.pl (Michael Budash)
    Re: attachment to email (Sigi)
    Re: better way of getting the last modified file? (Larry Rosler)
    Re: better way of getting the last modified file? (Jon Hamilton)
    Re: better way of getting the last modified file? (Abigail)
    Re: better way of getting the last modified file? (Larry Rosler)
    Re: better way of getting the last modified file? <mgregory@asc.sps.mot.com>
        C++ ref variables in XS perl bindings. <kurt_hertz@mentorg.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 05 Jul 1998 01:10:04 -0400
From: Webcruiser <kamenar@webmall.net>
Subject: -- Question on Reading Hash Info From A File.
Message-Id: <359F0AAB.2DF7@webmall.net>

I am trying to read in a series of variables from a file and load them
into a hash. I have printed the results on the screen and compared them
to the results obtained by entering them via a program. The problem is
that after reading the values from a disk file, the hash does not
recognize them. What is wrong here? How do I update a hash set and store
the values on my server?

Here is some of the test code lines I used:

	open(FILE,"<$merchants");  # $merchants is defined as a disk file.
	@merchants=<FILE>;
	close FILE;
	$merchantlist=@merchants[0];  # loads the file from disk to a variable
	@merchant = $merchantlist;    # loads it into the hash array
	%merchant=@merchant;          # sets up the hash
	print "@merchant";            # test the hash list
# The follosing line is the one I used to fill the hash manually. These
are the variables stored on disk. I tried storing them just as the hash
would list them, without the "" and comma, and just as shown.
#	%merchant=("markman","New","kamenar","New","marty","Old");
#	@merchant=%merchant;          # Associated with the prior line.
	print "@merchant";            # Another Test step.
	print "$merchant{markman}";   # When I do this without manually
entering the hash list, I get nothing on this statement.


Why doesn't a hash function accept reading the keys and values from a
disk file? What is being done wrong here? Thans for your assistance.
Please REPLY via email.
mailto:kamenar@webmall.net


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

Date: Mon, 06 Jul 1998 06:47:11 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: -- Question on Reading Hash Info From A File.
Message-Id: <6nprc0$o05$1@rand.dimensional.com>

In article <359F0AAB.2DF7@webmall.net>
Webcruiser <kamenar@webmall.net> wrote:

>                                                    The problem is
>that after reading the values from a disk file, the hash does not
>recognize them. What is wrong here? How do I update a hash set and store
>the values on my server?
>
>Here is some of the test code lines I used:

You need to use strict and diagnostics while developing.  Trust me, it'll
make things a whole lot easier.

>	open(FILE,"<$merchants");  # $merchants is defined as a disk file.

Always check the return value of open.

>	@merchants=<FILE>;

@merchants now contains the entire file, one line per element.

>	close FILE;
>	$merchantlist=@merchants[0];  # loads the file from disk to a variable

You already loaded the file into a variable (@merchants).  This assigns the
first line of the file to $merchantlist.  You also probably don't want
to use @merchants[0], $merchants[0] would be a better choice.  See
perlfaq4 for why.  Enabling diagnostics would have caught this.

>	@merchant = $merchantlist;    # loads it into the hash array

Now you've created a new array with one element.  It's not a hash.

>	%merchant=@merchant;          # sets up the hash

No, this attempts to create a hash consisting of one key and no
values.  Diagnostics would have told you-
  (S) You specified an odd number of elements to initialize a hash, which
  is odd, because hashes come in key/value pairs.
 
>	print "@merchant";            # test the hash list

No, this doesn't do anything with a hash (you need to read perldata :-).
It prints the contents of @merchant.

># The follosing line is the one I used to fill the hash manually. These
>are the variables stored on disk. I tried storing them just as the hash
>would list them, without the "" and comma, and just as shown.
>#	%merchant=("markman","New","kamenar","New","marty","Old");
>#	@merchant=%merchant;          # Associated with the prior line.
>	print "@merchant";            # Another Test step.
>	print "$merchant{markman}";   # When I do this without manually
>entering the hash list, I get nothing on this statement.
>
Here, try this-

#!/usr/bin/perl
use strict;
use diagnostics;

my $merchants = '/path/to/merchant/file';
my %merchant;

open(FILE, $merchants) || die "Couldn't open $merchants: $!";

# this assumes that the file contains one or more lines
# like-
#  markman New kamenar New marty Old
# it will break if you have more than one merchant
# with the same name
%merchant = map { chomp; split /\s+/; } <FILE>;

close(FILE) || die "Couldn't close $merchants: $!";

for(keys %merchant){
    print "$merchant{$_} => $_\n";
}
__END__

Daniel
-- 
Daniel Grisinger           dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                           Dave Clark


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

Date: 6 Jul 1998 07:06:39 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: -- Question on Reading Hash Info From A File.
Message-Id: <6npt1v$gtg$1@news.iastate.edu>

Webcruiser (kamenar@webmall.net) wrote:
: I am trying to read in a series of variables from a file and load them
: into a hash. I have printed the results on the screen and compared them
: to the results obtained by entering them via a program. The problem is
: that after reading the values from a disk file, the hash does not
: recognize them. What is wrong here? How do I update a hash set and store
: the values on my server?

: Here is some of the test code lines I used:

: 	open(FILE,"<$merchants");  # $merchants is defined as a disk file.
: 	@merchants=<FILE>;
: 	close FILE;
: 	$merchantlist=@merchants[0];  # loads the file from disk to a variable

Read in the perldata manpage - if you want the first element of
an array, it's better called $merchants[0] (if you used the -w flag
to perl you'd be warned abotu this). As you're doing it, it's an
array slice one element long.

: 	@merchant = $merchantlist;    # loads it into the hash array


This line will cause @merchant to be set to an array containing
$merchantlist (the first line from the file) and nothing else.
Are you sure that's what you want?

: 	%merchant=@merchant;          # sets up the hash

Using the -w flag would also warn you that your hash now contains
an odd number of elements (namely, 1), which is definitely not
what you want when you're supposed to have key-value _pairs._

: 	print "@merchant";            # test the hash list
: # The follosing line is the one I used to fill the hash manually. These
: are the variables stored on disk. I tried storing them just as the hash
: would list them, without the "" and comma, and just as shown.
: #	%merchant=("markman","New","kamenar","New","marty","Old");
: #	@merchant=%merchant;          # Associated with the prior line.
: 	print "@merchant";            # Another Test step.
: 	print "$merchant{markman}";   # When I do this without manually
: entering the hash list, I get nothing on this statement.

That's because the value associated with that key is undefined,
since your hash is one element long. undefs show up as nothing when
printed.

>From the looks of what you're doing, your file consists of pairs
of lines like

key
value
key
value
 ...

so perhaps something like this will do what you want

# TMTOWTDI, this one seems unidiomatic, oh well
open(IN, "test.txt") or die "open test.txt failed: $!\n";
while (<IN>) {
	# Note: if the file has an odd number of lines, the last line
	# will be a key for an undefined value
	$hash{$_} = <IN>;
}
close(IN);

If that's not how your file's set up, then you'll have to be a little
more clear about what you're trying to do.


Josh

--

__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
            - Thomas Pynchon



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

Date: 6 Jul 1998 15:12:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nqphl$j7k$2@client3.news.psi.net>

Zenin (zenin@bawdycaste.org) wrote on MDCCLXX September MCMXCIII in
<URL: news:899685210.339889@thrush.omix.com>:
++ Daniel Grisinger <dgris@rand.dimensional.com> wrote:
++ : >Do you believe everything you read? :-(
++ :
++ : No, only those things that make sense.  Not introducing
++ : unnecessary panic among my users makes sense.
++ 
++ 	If using -w reports a warning in a user's environment, there
++ 	is a chance it's caused by a bug that you should probably be
++ 	made aware of.  The user sees the warning, reports it, and
++ 	you can check it out.  If -w isn't used, you may lose critical
++ 	information needed to fix the bug.
++ 
++ 	But if you're creating CGI code on a Netscape server, ignore
++ 	all the above and lose -w since in that particular setting
++ 	you can trash your entire site by simply upgrading perl as
++ 	a new warning could cause Netscape to think that the CGI
++ 	is broken (read: Netscape servers are braindead).


Then use CGI.pm in a sensible way. There are enough hooks in CGI.pm to
fully blame the author of the program if the program emits warnings to
confuse the server.

The fact that an upgrade of perl might emit new warnings is a *GOOD*
reason to keep -w on production code. What do you customers prefer if
their sysadmins upgrade Perl? Warnings, or silently going on, perhaps
producing wrong results, or even stop working all together on the next
upgrade of Perl?

Of course, if your code is of such a quality that it easily pukes
warnings all over the users, you might want to omit -w. But I wouldn't
have shipped such code in the first place.

Emitting -w is as silly as to get rid of all die()s and warn()s in
your program.




Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: 6 Jul 1998 17:09:06 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nr0bi$5f4@mozo.cc.purdue.edu>

abigail@fnx.com (Abigail) writes:
}The fact that an upgrade of perl might emit new warnings is a *GOOD*
}reason to keep -w on production code. What do you customers prefer if
}their sysadmins upgrade Perl? Warnings, or silently going on, perhaps
}producing wrong results, or even stop working all together on the next
}upgrade of Perl?

}Of course, if your code is of such a quality that it easily pukes
}warnings all over the users, you might want to omit -w. But I wouldn't
}have shipped such code in the first place.

Hm.  The camel shipped without warnings in many places.  And when I
added them in, I started getting "check '$foo=<>' with defined" warnings.
I guess the camel is of such a quality that it easily pukes warnings
all over the users.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 6 Jul 1998 18:00:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nr3c8$2t3$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
:Hm.  The camel shipped without warnings in many places.  And when I
:added them in, I started getting "check '$foo=<>' with defined" warnings.
:I guess the camel is of such a quality that it easily pukes warnings
:all over the users.

Any other spurious insults for me, Mr. Gebis?  The Camel, written for
5.003, certainly had no such problems.  That warning was accidentally
added for 5.004 by someone who made the wrong decision.  It has been
fixed for 5.005.

You are a very tiresome person.

--tom
-- 


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

Date: 6 Jul 1998 19:56:51 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nra63$9in@mozo.cc.purdue.edu>

gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:

}abigail@fnx.com (Abigail) writes:
}}The fact that an upgrade of perl might emit new warnings is a *GOOD*
}}reason to keep -w on production code. What do you customers prefer if
}}their sysadmins upgrade Perl? Warnings, or silently going on, perhaps
}}producing wrong results, or even stop working all together on the next
}}upgrade of Perl?

}}Of course, if your code is of such a quality that it easily pukes
}}warnings all over the users, you might want to omit -w. But I wouldn't
}}have shipped such code in the first place.

}Hm.  The camel shipped without warnings in many places.  And when I
}added them in, I started getting "check '$foo=<>' with defined" warnings.
}I guess the camel is of such a quality that it easily pukes warnings
}all over the users.

I think I had better clarify myself here.  No insult intended towards
Larry, Tom, or Randal--It's obvious that their book _IS_ quality.
(In fact, I don't even conceive of someone questioning this fact, which
is why I didn't even think my original statement could be interpreted
as an insult towards the big three.  Doh.)

But even the big boys have been annoyed by an added warning. 

I leave the -w flag in, but it's caused me some pain and embarassment
(and other people some confusion) too.  It's a tradeoff I'm willing to
take.  It probably isn't the right decision for all people or all
projects.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 6 Jul 1998 15:00:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 2-byte code match problem
Message-Id: <6nqor0$j7k$1@client3.news.psi.net>

lvirden@cas.org (lvirden@cas.org) wrote on MDCCLXIX September MCMXCIII in
<URL: news:6nnm32$t0g$1@srv38s4u.cas.org>:
++ 
++ According to Abigail <abigail@fnx.com>:
++ :Yun Giljung (mingtian@hanmail.net) wrote on MDCCLXVIII September MCMXCIII
++ :in <URL: news:359de7d1.34507217@usenet.kornet21.net>:
++ :++ i hope Perl is not be like Java or Visual Basic or TCL that use Unicode
++ :++ for their internal system, that really does not help 2 bytes codes.
++ 
++ :There doesn't seem to be any indication Perl is going towards fixed
++ :width 16bit characters. But it will have UTF-8 support.
++ 
++ 
++ The sad part of this is that there are additional, wider, versions of unicode
++ that still won't be supported.
++ 
++ However, hopefully if the utf-8 support is done correctly, additional changes
++ to support the wider utf's can be made interally and the perl programmer
++ won't need to know about it.

UTF-8 is an encoding for UCS-2 and UCS-4. Currently, exactly 0 codepoints
of UCS-4 which aren't part of UCS-2 have been assigned to.

Which wider versions of Unicode are you referring to?



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Mon, 06 Jul 1998 22:41:19 GMT
From: mingtian@hanmail.net (Yun Giljung)
Subject: Re: 2-byte code match problem
Message-Id: <35a151f0.543215@usenet.kornet21.net>

>>Here's a brute-force way to force even byte alignment:
>>
>>  s/^((?:..)*?)\xBC\xA4/$1\x01\x02/sg;
>
>that was not work.. i solved in 3 ways,
>
>$han = chr(30);
>$a = '>H3g H38p5N';
>$a =~ s/([\A1-\xFE][\x4E-\x9F\xF9-\xFE])/$han$1/g;
>$a =~ s/$hanH3/$han5i/g;
>$a =~ s/$han([\A1-\xFE][\x4E-\x9F\xF9-\xFE])/$1/g;
>print $a;

this code space is correct for my example.., sorry.
$a =~ s/([\xA1-\xFE][\x40-\x7E\xA1-\xFE])/$han$1/g;



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

Date: Mon, 6 Jul 1998 09:43:54 +0000
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: 5.004_69 win32 Glob problem
Message-Id: <1dbqm91.1ufmwmnolga7yN@ppp87.vo.lu>

Matthew Morley <m.morley@NOSPAM.worldnet.att.net> wrote:
> There is a new version of Perl I downloaded from
>        http://www.ActiveState.com/ActivePerl/
> 
> This is the new long awaited merged GSAR and ActiveState version!

Hmmm.  I see ActiveState is describing it as a beta release.  As
perl5.004_69 has not yet been described by its developers (who
congregate on the perl5-porters mail list) as ready for beta release
(close, but not yet ready), I think ActiveState is jumping the gun.

(You can find information on how to join the perl5-porters list at
<http://www.perl.com>.  ActiveState lists more-or-less Win32-specific
lists at <http://www.ActiveState.com/support/mailing_lists.htm>.)

But anyway...

> It seems to fail returning directory nodes using the following
> segment:
 ...
> This match fails completely on win98 but of course works on UNIX.
> It used to work with the previous GSAR port.

As with any suspected bug in perl, try putting this information in a bug
report mailed to <mailto:perlbug@perl.com>.  If possible, use the
perlbug program to help create the report.  Bug reports are seen by
Perl's developers, and reports concerning development versions are
welcome -- although don't expect too much sympathy if using a
development version in a production situation is causing you grief.  You
could also take the matter up with ActiveStste direct at
<mailto:ActivePerl@ActiveState.com>.

> Is there a more efficient way to return a list of subdirectories with
> the 4-th level subdirectory matching in "*-*" (star dash star)?
> without using globing?

Personally, I'd use the File::Find module to select the target files.
Unfortunately, it doesn't currently have a built-in emulation of GNU
find's -maxdepth and -mindepth options, which would make your life
really easy, but you should be able to code these yourself pretty
easily.  If File::Find works for you, that's great.  But please don't
let that stop you from submitting a bug report.
-- 
Dominic Dunlop


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

Date: 6 Jul 1998 12:51:38 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: 5.004_69 win32 Glob problem
Message-Id: <1998070612513800.IAA01475@ladder03.news.aol.com>

Hi Dominic:

>Hmmm.  I see ActiveState is describing it as a beta release.  As
>perl5.004_69 has not yet been described by its developers (who
>congregate on the perl5-porters mail list) as ready for beta release
>(close, but not yet ready), I think ActiveState is jumping the gun.

I thought so at first as well. But they DO include suitable disclaimers.
Since many Win32 users don't have the tools to build their own
perl from the development source kit (NT and a supported compiler
and a suitable shell, at least), this will help identify some bugs
without forcing an early maintenance release. I would certainly
agree if they had tried 5.004_61 as a beta.

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Mon, 06 Jul 1998 13:24:58 -0700
From: Thomas Albech <thomas@provideo.dk>
Subject: <STDIN> chunk 1 - Error
Message-Id: <35A1329A.D9D5A89F@provideo.dk>

Hi everyone,

I just bought the Learning Perl book. I got to page 14 and typed in the
following code as in the book:

### CODE BEGIN ###

#!/usr/freeware/bin/perl -w
%words = qw(
 fred camel
 barney llama
 betty alpaca
 wilma alpaca
);
print "What is your name? ";
$name = <STDIN>;
chomp ($name);
$original_name = $name;
$name =~ s/\W.*//;  # Get rid of everything after first word
$name =~ tr/A-Z/a-z/;  # Lowercase everything
if ($name =~ "randal") {
 print "Hello, Randal! How good of you to be here!\n";
}  else {
 print "Hello, $original_name!\n";
 $secretword = $words{$name};  # get the secret word
 print "$secretword\n";   # Displays secret word
 if ($secretword eq "") {  # oops, not found
  $secretword = "groucho"; # sure, why a duck
 }
 print "What is the secret password? ";
 $guess = <STDIN>;
 chomp ($guess);
 while ($guess ne $secretword) {  # keep checking til we know
  print "Wrong, try again. What is the secret word? ";
  $guess = <STDIN>;
  chomp ($guess);
 }
}      # end of "not Randal"

### CODE END ###

I get this errormessage:

Use of uninitialized value at ./Guess_Password line 19, <STDIN> chunk 1.

Use of uninitialized value at ./Guess_Password line 20, <STDIN> chunk 1.

whenever I type in a name not listed in the array. I thought the if
(secretword eq "") should take care of non-known names? This might sound
like a stupid quiestion, but I'm lost.

Thanks,
Thomas



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

Date: Mon, 6 Jul 1998 12:38:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: <STDIN> chunk 1 - Error
Message-Id: <MPG.100ac7871c1f5b0c9896e6@nntp.hpl.hp.com>

In article <35A1329A.D9D5A89F@provideo.dk> on Mon, 06 Jul 1998 13:24:58 -
0700, Thomas Albech <thomas@provideo.dk> says...
> Hi everyone,
> 
> I just bought the Learning Perl book. I got to page 14 and typed in the
> following code as in the book:
 ...
> if ($name =~ "randal") {

Type more carefully.

if ($name eq "randal") {

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 06 Jul 1998 09:34:57 GMT
From: philippe.sockeel@cdn.fr
Subject: [Q] Environment size causing pbs in Perl 5.004_04 (HP-UX)
Message-Id: <6nq5o1$jve$1@nnrp1.dejanews.com>

Hi All,

By installing then using Perl 5.004_04 on HP-UX 9.04, I had pbs with some
environment variables which are too large (1280 bytes long).

Whenever I reduce those variables, everything goes right but I suspect to
have pbs in some scripts which may overflow the environment.

Does anybody know how could this be solved ?

Thanks for answer
Philippe

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 6 Jul 1998 15:57:47 GMT
From: Hemant Shah <shah@xnet.com>
Subject: Accessing UDB from perl?
Message-Id: <6nqs5r$kd$1@flood.xnet.com>


Folks,

   Is there a perl library/module I can use to access DB2 UDB on AIX?
   
   
   Thanks in advance :-)

   To reply, please remove no_junk_mail from my e-mail address.
-- 
Hemant Shah, LIDP Inc.                /-------------------\    ^~~~~^
 Voice: +1 630 960 0133 x 664         |TECHNOLOGY         |    |    |
   Fax: +1 630 960 0717               |No place for wimps |   o|-OO-|o
E-mail: shah@xnet.com                 |          -Dilbert |--- | () |
                                      \-------------------/    |    |
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


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

Date: Mon, 6 Jul 1998 01:10:36 -0500
From: "Howard Dierking" <howard@vortexweb.com>
Subject: altering formmail.pl
Message-Id: <e8wcfPKq9GA.297@upnetnews03>

here is a block of code from the formmail.pl script
-------------------------
        # Check for a Return Link and print one if found.
#
        if ($Config{'return_link_url'} && $Config{'return_link_title'}) {
            print "<center><ul>\n";

            print "<li><a
href=\"$Config{'return_link_url'}\">$Config{'return_link_title'}</a>\n";

^^^^^^^
            print "</ul></center>\n";
        }
-------------------------
 where the return link is, I need to put in a target="_top" statment into
the <a href...> -- only thing is, I can't figure out what perl is doing with
the quotes (which ones belong to the print() function etc...)  Any ideas one
where to put this, and how to format the quotes that would normally surround
"_top" ???  Thanks in advance

howard




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

Date: Mon, 06 Jul 1998 01:28:11 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: altering formmail.pl
Message-Id: <mbudash-0607980128110001@209.204.139.53>

In article <e8wcfPKq9GA.297@upnetnews03>, "Howard Dierking"
<howard@vortexweb.com> wrote:

>> here is a block of code from the formmail.pl script
>> -------------------------
>>         # Check for a Return Link and print one if found.
>> #
>>         if ($Config{'return_link_url'} && $Config{'return_link_title'}) {
>>             print "<center><ul>\n";
>> 
>>             print "<li><a
>> href=\"$Config{'return_link_url'}\">$Config{'return_link_title'}</a>\n";
>> 
>> ^^^^^^^
>>             print "</ul></center>\n";
>>         }
>> -------------------------
>>  where the return link is, I need to put in a target="_top" statment into
>> the <a href...> -- only thing is, I can't figure out what perl is doing with
>> the quotes (which ones belong to the print() function etc...)  Any ideas one
>> where to put this, and how to format the quotes that would normally surround
>> "_top" ???  Thanks in advance
>> 
>> howard

print "<li><a href=\"$Config{'return_link_url'}\"
target=\"_top\">$Config{'return_link_title'}</a>\n";

hth -

-- 
Michael Budash, Owner * Michael Budash Consulting
707-255-5371 * 707-258-7800 x7736
mbudash@sonic.net


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

Date: Mon, 06 Jul 1998 21:09:41 GMT
From: sigi@mail2me.de (Sigi)
Subject: Re: attachment to email
Message-Id: <35a13c4e.53676884@news.isk.de>

Gangadhar Vaddepalli <vadepali@ix.netcom.com> wrote:

>Hi There,
>I'm wondering whether we can attach another file to email using Perl.
>I want to send an attchment which is also an HTML file along with the
>message.
>
>Can anybody give me some idea?

  $ERG = `mutt -H $HEADERFILE 
         -a $ATTACHFILE $RECIPIENT < $BODYFILE`;

  or

  $ERG = `mutt -H $HEADERandBODYFILE
         -a $ATTACHFILE $RECIPIENT < /dev/null`;

  you must have "mutt" installed.

  sigi.

>--
>Thanks
>Gangadhar
>Tel: (650)964-1807
>vadepali@ix.netcom.com
>
>



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

Date: Sun, 5 Jul 1998 22:45:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: better way of getting the last modified file?
Message-Id: <MPG.100a04718d4b3761989717@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <m3pvfk109h.fsf@windlord.Stanford.EDU> on 05 Jul 1998 14:00:26 
-0700, Russ Allbery <rra@stanford.edu> says...
> Sitaram Chamarty <sitaram@diac.com> writes:
> > On 05 Jul 1998 10:35:40 -0700, Russ Allbery <rra@stanford.edu> wrote:
> 
> >> Yup.  You need to actually check your code against new releases of Perl
> >> and against test suites, and that should be done with -w.  But once
> >> your code is out of your hands and in the hands of people who can't fix
> >> it when they see warnings, there's no reason for the warnings.
> 
> > When I ship code I send the warnings to a log file that the "customer"
> > (they're actually my co-workers in another office :-) can look at if
> > they want to, but are not forced to.
> 
> This is a great idea if your application is one that can create and
> maintain a log file.  (Most of what I write is intended to be run by
> normal users and therefore that doesn't work quite as well.)

Can the application not intercept $SIG{'__DIE__'} and $SIG{'__WARN__'} 
and send an appropriate message to its maintainer using sendmail (or an 
equivalent on Windows/DOS systems)?  The application need not create and 
maintain a log file, and the normal users who can't fix it when they see 
warnings won't see them.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 6 Jul 1998 12:11:56 GMT
From: hamilton@pobox.com (Jon Hamilton)
Subject: Re: better way of getting the last modified file?
Message-Id: <6nqeuc$9f7@newsops.execpc.com>

On Sun, 5 Jul 1998 22:45:58 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
} 
} In article <m3pvfk109h.fsf@windlord.Stanford.EDU> on 05 Jul 1998 14:00:26 
} -0700, Russ Allbery <rra@stanford.edu> says...
} > Sitaram Chamarty <sitaram@diac.com> writes:
} > 
} > > When I ship code I send the warnings to a log file that the "customer"
} > > (they're actually my co-workers in another office :-) can look at if
} > > they want to, but are not forced to.
} > 
} > This is a great idea if your application is one that can create and
} > maintain a log file.  (Most of what I write is intended to be run by
} > normal users and therefore that doesn't work quite as well.)
} 
} Can the application not intercept $SIG{'__DIE__'} and $SIG{'__WARN__'} 
} and send an appropriate message to its maintainer using sendmail (or an 
} equivalent on Windows/DOS systems)?  The application need not create and 
} maintain a log file, and the normal users who can't fix it when they see 
} warnings won't see them.

There are several problems with that approach:

- If your code is popular, you'll get inundated with mail

- If you're talking about warn() and the code still works, you may not 
  be able to convince all your users to upgrade, so you'll continue getting
  mail every time they run your app

- Lots of people have broken or misconfigured mail setups; you may just
  cause lots of bounces or other problems for them

- More and more people are behind firewalls, many of which don't allow
  SMTP out

- Some people get very irritated when programs do this kind of thing
  "behind their backs"

Of course, it all depends on who you give your code to and what they do
with it.  

-- 

   Jon Hamilton 
   hamilton@pobox.com


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

Date: 6 Jul 1998 15:13:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: better way of getting the last modified file?
Message-Id: <6nqpiv$j7k$3@client3.news.psi.net>

Daniel Grisinger (dgris@rand.dimensional.com) wrote on MDCCLXIX September
MCMXCIII in <URL: news:6nocc3$mi5$1@rand.dimensional.com>:
++ [posted and mailed to the cited author]
++ In article <MPG.10093ff12a871673989715@nntp.hpl.hp.com>
++ lr@hpl.hp.com (Larry Rosler) wrote:
++ 
++ >Dropping '-w' and 'use strict;' from production code is like removing 
++ >one's lifejacket as soon as the ship leaves the harbor and goes out to 
++ >sea.
++ 
++ I have to disagree with this.  Using -w in production code does nothing
++ but alarm your users unnecessarily.  This is discussed in Effective
++ Perl Programming, and since reading that book I no longer ship code
++ with -w enabled.


Some books are better than other books.



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Mon, 6 Jul 1998 10:05:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: better way of getting the last modified file?
Message-Id: <MPG.100aa3a116df605d9896e5@nntp.hpl.hp.com>

In article <6nqeuc$9f7@newsops.execpc.com> on 6 Jul 1998 12:11:56 GMT, 
Jon Hamilton <hamilton@pobox.com> says...
> On Sun, 5 Jul 1998 22:45:58 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
 ...
> } Can the application not intercept $SIG{'__DIE__'} and $SIG{'__WARN__'} 
> } and send an appropriate message to its maintainer using sendmail (or an 
> } equivalent on Windows/DOS systems)?  The application need not create and 
> } maintain a log file, and the normal users who can't fix it when they see 
> } warnings won't see them.
> 
> There are several problems with that approach:
> 
> - If your code is popular, you'll get inundated with mail
> 
> - If you're talking about warn() and the code still works, you may not 
>   be able to convince all your users to upgrade, so you'll continue getting
>   mail every time they run your app

If the code really works, the warnings are superfluous and can be 
controlled by 'local $^W;'.  Uncontrolled warnings are usually generated 
by unanticipated conditions involving user data; I, for one, would 
certainly want to know about them in code I was responsible for.

> - Lots of people have broken or misconfigured mail setups; you may just
>   cause lots of bounces or other problems for them
> 
> - More and more people are behind firewalls, many of which don't allow
>   SMTP out
> 
> - Some people get very irritated when programs do this kind of thing
>   "behind their backs"

As has been discussed here several times, Unix systems tend to have 
functioning copies of 'sendmail' installed.  A simple test on 
installation might readily reveal those that don't.

> Of course, it all depends on who you give your code to and what they do
> with it.  

Hard to argue with that!

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 06 Jul 1998 18:29:27 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: better way of getting the last modified file?
Message-Id: <r8pvfjz768.fsf@asc.sps.mot.com>

Russ Allbery <rra@stanford.edu> writes:

> Daniel Grisinger <dgris@rand.dimensional.com> writes:
> > lr@hpl.hp.com (Larry Rosler) wrote:
> 
> >> Dropping '-w' and 'use strict;' from production code is like removing
> >> one's lifejacket as soon as the ship leaves the harbor and goes out to
> >> sea.
> 
> > I have to disagree with this.  Using -w in production code does nothing
> > but alarm your users unnecessarily.  This is discussed in Effective Perl
> > Programming, and since reading that book I no longer ship code with -w
> > enabled.
> 
> Yup.  You need to actually check your code against new releases of Perl
> and against test suites, and that should be done with -w.  But once your
> code is out of your hands and in the hands of people who can't fix it when
> they see warnings, there's no reason for the warnings.

1) What makes you think anyone can't fix it?

2) How are you going to narrow down the problem 'over the phone' (via
   email etc) when they say 'This program doesn't do anything any
   more' ... wouldn't 'use of uninitialised variable at line xxx' be
   much more helpful?

Martin.


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

Date: Mon, 6 Jul 1998 14:41:02 -0700
From: "Kurt Hertz" <kurt_hertz@mentorg.com>
Subject: C++ ref variables in XS perl bindings.
Message-Id: <6nrg9t$ps1@hpbab.wv.mentorg.com>

I am having a couple of problems trying to get C++ library objects
accessible from perl.  The simple cases (pointers, objects, atomic objects)
are working, but I am having difficulty setting up my typemap and .xs files
to generate correct code.  I keep getting something along the lines of

   that = (const color)SvIV((SV*)SvRV(ST(1)));
   THIS->methodname(&that);

when what I want is

   that = (const color&)SvIV((SV*)SvRV(ST(1)));
   THIS->methodname(that);

Has anyone used ref's successfully, and if so, I would greatly appreciate
seeing a small working example.  I have tried in my typemap for the
const Obj_t both O_OBJECT and T_PTRREF with both
            const Obj_t&    O_OBJECT
            const Obj_t &    O_OBJECT
            const Obj_t&    T_PTRREF
    etc.

Thanks in advance,

    Kurt





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

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

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