[13619] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1029 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 10 07:05:43 1999

Date: Sun, 10 Oct 1999 04:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939553513-v9-i1029@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 10 Oct 1999     Volume: 9 Number: 1029

Today's topics:
        .pl files How to convert in text format ? <memoire@worldnet.fr>
    Re: .pl files How to convert in text format ? (Kragen Sitaker)
        ActivePerl - Running? <rmnesu@ptd.net>
    Re: Backtick programs oliver.cookIYKICG@ukonline.co.uk
    Re: Backtick programs oliver.cookCGAHGE@ukonline.co.uk
    Re: calling a dll from perl <lsilver@information-concepts.com>
    Re: GD Modul Version 1.19 for win32 ? (John Armsby)
    Re: how to call a sub roght by form (Kragen Sitaker)
    Re: Installing GD.pm HELP!!! on Unix (Kragen Sitaker)
    Re: Need help making arrays. (Bart Lateur)
        newbie question about quotes in code <clavikal@voicenet.com>
    Re: newbie question about quotes in code (Martien Verbruggen)
    Re: Overkill of warnings in module <NoSpam@JSoft.xs4all.nl>
        Prob. with cgi-script (need help) skeeta@gmx.net
    Re: reading binary data files fheitka@attglobal.net 
    Re: reading binary data files (Martien Verbruggen)
    Re: s/// used on a file slurped into a scalar (Kragen Sitaker)
        saving images <troja2977@my-deja.com>
    Re: Shell and Perl have different $? (Kragen Sitaker)
    Re: tool to convert BMPs to GIFs programatically? <flavell@mail.cern.ch>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 09 Oct 1999 23:18:44 +0200
From: ledanseurs <memoire@worldnet.fr>
Subject: .pl files How to convert in text format ?
Message-Id: <37FFB134.6E70197F@worldnet.fr>

Il s'agit d'un message multivolet au format MIME.
--------------ED203351366A0A2B6A4B35D0
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit

    Hi ,


I am working on Win NT 4 Workstation. I was given some files with 'pl'
extension,
(ex file.pl ), I can read them with a software called Worldview.
I have to convert those files to text files (.txt), do you know how to
do that ?
If I open those files with Word Pad or Note pad , they are full of
unreadable ascii
caracters, so i really need a program that can convert those kind of
files.

Thank you

Laurent

e-mail: lsouriau@club-internet.fr

--------------ED203351366A0A2B6A4B35D0
Content-Type: text/x-vcard; charset=us-ascii;
 name="memoire.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Carte pour ledanseurs
Content-Disposition: attachment;
 filename="memoire.vcf"

begin:vcard 
n:;
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
x-mozilla-cpt:;1
end:vcard

--------------ED203351366A0A2B6A4B35D0--




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

Date: Sun, 10 Oct 1999 10:52:21 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: .pl files How to convert in text format ?
Message-Id: <Fd_L3.2442$UG5.155106@typ11.nn.bcandid.com>

In article <slrn7vvlm8.3ul.efflandt@efflandt.xnet.com>,
David Efflandt <efflandt@xnet.com> wrote:
>On Sat, 09 Oct 1999 23:18:44 +0200, ledanseurs <memoire@worldnet.fr> wrote:
>>I have to convert those files to text files (.txt), do you know how to
>>do that ?
>>If I open those files with Word Pad or Note pad , they are full of
>>unreadable ascii
>>caracters, so i really need a program that can convert those kind of
>>files.
>
>Probably Unix text files that are missing the carriage return that DOS/Win
>use.  So the newline shows up as a black box in Notepad.

Wordpad should handle this fine, though.  I suspect you're right and le
danseur hasn't actually tried opening them in wordpad, but just assumes
the results would be the same as with notepad.

>If you have MS Word, or other word processor, you should be able to
>load them fine and then save as DOS text.

Surely there is a solution with perl -ip, no?  :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 09 Oct 1999 21:10:56 GMT
From: Richard Neidermyer <rmnesu@ptd.net>
Subject: ActivePerl - Running?
Message-Id: <37FFAFC8.25BA8BDF@ptd.net>

I downloaded activePerl for my home system on windows95. I am not too
familiar with Perl and how it works. I have noticed that its enviorment
is not like that of programming languages like C, VB, ect... There is no
editor? Now i am lost. When I click on perl.exe all I get is a dos
window. How would I run a program from here. A program like hello world.
I have it written and saved, just cant get anything to run. Obviously I
do not understand the enviorment. Any help would be appreciated.

Thanks Richard

Please reply by message on board and by email. Thanks



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

Date: 9 Oct 1999 11:33:34 GMT
From: oliver.cookIYKICG@ukonline.co.uk
Subject: Re: Backtick programs
Message-Id: <7tn96e$1b9$1@apple.news.easynet.net>


Thanks for your comments on my code, which i will bear in mind. I am
no expert, and the very fact that it works I am happy about.

Regards,
Ollie

>oliver.cookUYNQFM@ukonline.co.uk wrote:
>> 
>> Thanks for all the suggestions. I solved it like this:
>> 
>> #!/usr/bin/perl
>
>You forgot the -w flag and 'use strict;' here.
>
>> open (DB, "/etc/data");
>
>Oops.  You forgot to check the return on your open() .
>
>> @data = <DB>;
>
>I hope your DB is small, since this can be a major memory-pig
>otherwise.
>
>> close(DB);
>
>It wouldn't hurt to check the return on your close() either.
>
>> $ref = "0";
>
>my $ref = 0;   #you really want a number, not a string
>
>> foreach $line (@data) {
>>  $ref++;
>>  ($user[$ref],$domain[$ref],$logfile[$ref],$location[$ref]) =
split
>> (/:/, $line);
>
>I would have written this as an array of arrays instead.
>See the perldsc and perllol pages.
>
>>  $location[$ref] =~ s/\n//;
>> }
>> 
>> for $c (1..$ref) {
>> $webmaster = "webmaster\@".$domain[$c];
>> $baseurl = "http://www.".$domain[$c];
>> #write out analog.cfg
>> system("cp -f analog.txt /usr/local/apache/analog/analog.cfg");
>
>I would have use File::Copy here..
>
>> system("echo LOGFILE $logfile[$c]
>
>and print() here..
>
>> >>/usr/local/apache/analog/analog.cfg");
>> print "-----------ANALOG DONE----------\n";
>> #write out rmagic.ini
>> system("cp -f rmagic.ini /root/statsrun/temp.ini");
>
>and File::Copy again..
>
>> system("echo Frame_File_Out = $location[$c]/index.html
>> >>/root/statsrun/temp.ini");
>> system("cat rmagic.ini.2 >>/root/statsrun/temp.ini");
>> system("echo File_Out = $location[$c] >>/root/statsrun/temp.ini");
>> system("cat rmagic.ini.3 >>/root/statsrun/temp.ini");
>> system("echo File_Out = $locationpc]/navfile.html
>> >>/root/statsrun/temp.ini");
>> system("cat rmagic.ini.4 >>/root/statsrun/temp.ini");
>> system("echo webmaster = $webmaster >>/root/statsrun/temp.ini");
>> system("echo Base_URL = $baseurl >>/root/statsrun/temp.ini");
>
>and a few print() statements here..
>
>> system("rm -f /usr/local/apache/rmagic/report.dat");
>
>and unlink() here.  You really ought to check the returns
>on calls using system(), particularly when you do something
>like rm .
>
>> print "-----------RMAGIC DONE-----------\n";
>> 
>> #run analog
>> system("/usr/local/apache/analog/analog");
>> print "---------RUN ANALOG--------\n";
>> #run rmagic
>> system("rm -rf $location");
>> system("cd /usr/local/apache/rmagic");
>
>I see only two places so far where system() looks like
>a decent idea.
>
>> system("/usr/local/apache/rmagic/rmagic.pl
/root/statsrun/temp.ini");
>
>And I wouldn't do this using system() either.
>Look up do() and require() in perlfunc.
>
>> print "---------RUN RMAGIC-------\n";
>> }
>> exit;
>
>You use an exit() at the end of your program? 
>But you don't bother to define a return value?
>I don't get either.
>
>David
>-- 
>David Cassell, OAO                     cassell@mail.cor.epa.gov
>Senior computing specialist
>mathematical statistician


Please remove the IYKICG before replying by email.

***** Posted via the UK Online online newsreader *****

 Go to http://www.ukonline.co.uk to find out
 about other online services we offer our subscribers.




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

Date: 9 Oct 1999 11:35:35 GMT
From: oliver.cookCGAHGE@ukonline.co.uk
Subject: Re: Backtick programs
Message-Id: <7tn9a7$1d3$1@apple.news.easynet.net>


i am running perl 5.004 on RH Linux 6.0. However, I've got it fixed
now if you see my later posts.

Thanks for answering all the same.

Ollie

>oliver.cookIYAPCR@ukonline.co.uk wrote:
>
>} I'm writing a program which needs to call several shell programs.
To
>} run them I use the following format:
>} 
>} `command1`;
>} `command2`;
>} 
>} however, command2 is started as soon as command1 is. How can I make
is
>} to that command2 isn't started until command1 is finished?
>
>I think you need to tell us more about your environment.  The
semantics of
>perl are such that it *should*not* execute command2 until command1
has
>completed, even doing so in a null context.  [although I'll mention
that it
>is a bit odd instead of
>   `command1`;
>the more usual form would be:
>    system (command1 >/dev/null) ;
>
>Anyhow, the reason I say you need to tell us more is that at least on
my
>perl [5.004 on RH Linux] it doesn't do the commands at the same time
at
>all:
>
>>>> `date >/dev/tty; sleep 30` ;
>>>> `date >/dev/tty` ;
>
>results in:
>
>>>> Fri Oct  8 16:18:57 EDT 1999
>>>> Fri Oct  8 16:19:27 EDT 1999
>
>which is both what I would have expected and what you wanted.   So
if
>you're getting command2 to execute before comman1 completes,
something else
>must be going on...
>
>  /Bernie\
>-- 
>Bernie Cosell                     Fantasy Farm Fibers
>bernie@fantasyfarm.com            Pearisburg, VA
>    -->  Too many people, too few sheep  <--          


Please remove the CGAHGE before replying by email.

***** Posted via the UK Online online newsreader *****

 Go to http://www.ukonline.co.uk to find out
 about other online services we offer our subscribers.




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

Date: Sat, 09 Oct 1999 08:56:44 -0400
From: Lee Silver <lsilver@information-concepts.com>
To: tlars@my-deja.com
Subject: Re: calling a dll from perl
Message-Id: <37FF3B8C.3DA4@information-concepts.com>

Tait:
 
> Does anyone know if it's possible to call a dll in the Win32 version of
> perl?  If so, could you please direct me to the module that allows you
> to do this.

The Win32 package allows this. If you're using ActiveState's Perl it can
be installed with their installer.

Basically, each DLL entry-point that you want to access becomes a new
API-thingie. The entry-point is then invoked via a thingie->Call()
method.
 
-- 
// Lee Silver
// Information Concepts Inc.

Facilitating the automated conversion of Data into Information 
since 1982


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

Date: Sat, 09 Oct 1999 13:52:59 GMT
From: jaws@mindspring.com (John Armsby)
Subject: Re: GD Modul Version 1.19 for win32 ?
Message-Id: <37ff4891.1379758@news.mindspring.com>

What/where is the c.I.p. module(s).

John

On Wed, 06 Oct 1999 17:31:54 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:

>Andreas Schulz wrote:
>> 
>> Was there a win32 version of the gd modul Version 1.19 ? If yes where can I
>> find it, because the new Version 1.21 supports only png instead of gif.
>
>Answered in c.l.p.modules already.  But you ddin't crosspost
>your question, so it doesn't show up here.  
>
>David
>-- 
>David Cassell, OAO                     cassell@mail.cor.epa.gov
>Senior computing specialist
>mathematical statistician



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

Date: Sun, 10 Oct 1999 11:03:43 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: how to call a sub roght by form
Message-Id: <jo_L3.2447$UG5.155683@typ11.nn.bcandid.com>

In article <bFMAOKkb=vlRSBABvkm=nGeuvC21@4ax.com>,
Dave Cross  <dave@dave.org.uk> wrote:
>On Sun, 10 Oct 1999 00:28:01 +0200, "Yuval Hamberg" <yhm@inter.net.il>
>wrote:
>>But that dosent work. i lerned that i sould put this in before:
>># Read and Parse Form:
>>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>>@pairs = split(/&/, $buffer);
>>foreach $pair (@pairs)
>> . . .
>>
>>any ideas
>
>Yes. Throw away the book that told you to write such horrible code.

Better yet, tell us what it is so we can warn other innocent victims
away from it, and put up a web page condemning it.  "This book told me
to write code that got me laughed at."

There are worse things in life than not using CGI.pm, but if you're
going to try to parse CGI input yourself, you should make sure you know
what you're doing, and preferably do it correctly.

(I should talk; I recently wrote a CGI script in sh.  Correct query
string decoding?  Not a chance.)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 10 Oct 1999 10:28:21 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Installing GD.pm HELP!!! on Unix
Message-Id: <9TZL3.2433$UG5.153408@typ11.nn.bcandid.com>

In article <jEDL3.16337$w8.317317@wbnws01.ne.mediaone.net>,
Burt lewis <burt@ici.net> wrote:
>I've spent quite a bit of time trying to install and make gd.PM work on
>my Unix account.
>
>IS THERE AN EASIER WY TO DO THIS?

Get someone else to do it for you.  Use a machine where it's already
been done.  Use a prepackaged distribution.

>I'm following these directions:
>
>IF YOU DON'T HAVE PRIVILEGES TO INSTALL GD.pm in your system's main
>Perl library directory, don't despair.  You can install it into your
>home directory using the following feature of Makefile.PL:
>
>	a.  cd GD-1.XX
>	b.  perl Makefile.PL LIB=/home/fred/lib
>	c.  make
>	d.  make install
>
>It appears I get errors in c. and it looks like it's trying to work in
>the main Perl directories in stead of my 
>local ones.
>
>pic -I/usr/local/lib/perl5/sun4-sunos/5.00404/CORE  GD.c
>GD.xs:7: gd.h: No such file or directory
>*** Error code 1
>make: Fatal error: Command failed for target `GD.o'      

The -I flag means to use include files from that main Perl directory --
it's nothing to worry about.  The error about gd.h probably means you
don't have gd, from boutell.com, installed.  You need to install gd
before you can install GD.pm.

>Also an error in d.

Right, you're not supposed to do d if c fails.  d will try to redo c if
it failed, but it will probably fail again, in exactly the same way.
:)

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 10 Oct 1999 09:47:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Need help making arrays.
Message-Id: <38015fe2.1997677@news.skynet.be>

[posted and mailed]
Matt King wrote:

>  I'm trying to make a simple CGI script that reads 12 different DB-File's,
>stores all the information in an two arrays. Than I can send this
>information to GIFgraph to get a optical display of the information.
>
>The contence of the DB_Files will never be that same, but have the same
>format. That format being in pos 0 is the 'control' word and in pos 1 is the
>'count' for the 'control' word.

>For example:
>File 1:
>  John 12
>  Mike 7
>  Chris 9
>File 2:
>  Sam 8
>  Mike 7
>  Gerry 20
>  Matt 3
 ...

>The script woul then convert the information into something like this:
>                                                  'Totals (array of arrays)'
>'master'            f1     f2    f3    f4    f5    f6    f7    f8    f9
>f10    f11    f12
>  John              12    0     0     0     0     8    0    12    0     0
>20     0
>  Mike              7     0     0     0     0     0     0    0     0     0
>7       0
>  Chris              9     0     0     0     0    3     0     0     0     0
>0      15
 ...

Yes it's possible in Perl. It's not even that difficult. You have to
make good use of Perl's built-in autovivication mechanism: if you refer
to a hash item as if it was an array reference, but it didn't exist,
then it will *create* an anonymous array and reference it in that hash
item. So you needn't even check if it did exist before.

I would create a hash of arrays. I'm not exactly sure HOW your data is
stored in files, but I assume, for simplicity, that the files are tab
delimited (sorry, "separated") text files, and are named "f1" through
"f12". You're free to change that, of course.

	@files = qw(f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12); #file names
	my $i = 0;
	my %data;
	foreach $file (@files) {
	    open(FILE,$file) or die "Cannot open file $file: $!";
	    while(<FILE>) {
	        chomp;
	        my($name,$count) = split /\t/;
		# here's the code you asked for:
		$data{$name}[$i] = $count;
		# That was it. Nothing to it, huh?
	    }
	} continue {
	    $i++; 
	}
	# finished reading
	# Clean up the data: Make sure all arrays contain n entries, 
	# undefined entries need to be set to 0.
	$i--; # last index
	foreach my $name (keys %data) {
	    for my $j (0..$i) {
		$data{$name}[$j] ||= 0;
	    }
        }
	
	#now print it out, as a	demo.
	($\,$,) = ("\n","\t"); # tab separated text
	print "'master'",@files;
	foreach my $name (sort keys %data) {
	    print $name,@{$data{$name}};
	}

-- 
	Bart.


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

Date: Sat, 9 Oct 1999 08:10:21 -0400
From: "clavikal" <clavikal@voicenet.com>
Subject: newbie question about quotes in code
Message-Id: <jgGL3.1851$114.132888@news3.voicenet.com>

I always get an error message (from the www) when putting quotes in HTML
inside a perl program. Is there a way to be able to include quotes?

i.e.
print("<img src="blah/blah.gif">");
Anything like this will give me an error.

Any help is much appreciated,
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Shannon Kurtas
skurtas@voicenet.com
ICQ:11767795 / AOL-IM:rhclav
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       "Facts are chains that bind
        perception and fetter truth"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




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

Date: 9 Oct 1999 12:57:53 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: newbie question about quotes in code
Message-Id: <slrn7vueq4.1pg.mgjv@wobbie.heliotrope.home>

On Sat, 9 Oct 1999 08:10:21 -0400,
	clavikal <clavikal@voicenet.com> wrote:
> I always get an error message (from the www) when putting quotes in HTML
> inside a perl program. Is there a way to be able to include quotes?

Euhmmm, just a few pedantic points: The WWW does not give anyone error
messages. It's not even anything real, but just a name for a group of
servers, sharing information using a bundle of protocols of which HTTP
is the most prominent one.

You probably mean your web server, right? And the error message you
get is? Let me guess.. a 500 Server Error?

You shoulddo yourself a great favour, and read the perl FAQ part 9.
Install perl on your computer, if you haven't done so yet, and use the
perldoc command to read the documentation.

# perldoc perl
# perldoc perldoc
# perldoc perlfaq
# perldoc perlfaq9
# perldoc -f function
# perldoc -q keyword

Or, if you happen to install the ActiveState version, browse through
the HTML version of said documentation.

That Server error means most likeley that your program didn't compile
(read further details on how to resolve that problem next time in perl
faq9)

I will underline in the following, what perl sees as string

> print("<img src="blah/blah.gif">");
        ^^^^^^^^^^^             ^^^
You see the problem? Just use single quotes. or one of the q() or qq()
constructs. They're described in perldata and perlop. Or, if you are
actually printing a lot, you should probably use a here-doc syntax.

print '<img src="blah/blah.gif">';
print q(<img src="blah/blah.gif">);
print qq(<img src="blah/blah.gif">);

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd.       | reflects this.
NSW, Australia                      | 


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

Date: Sat, 9 Oct 1999 13:01:03 +0200
From: "Willem Joosten" <NoSpam@JSoft.xs4all.nl>
Subject: Re: Overkill of warnings in module
Message-Id: <7tn79p$48d$1@news1.xs4all.nl>


David Cassell <cassell@mail.cor.epa.gov> wrote in message
news:37FE6F3B.D06D7C7E@mail.cor.epa.gov...
> Willem Joosten wrote:
> >
> Oh.  You are using -w already.  This must be Win32::ODBC and not
> DBD::ODBC .  Right?  I think there's a known glitch there in
> the GetData subroutine.
>
> > Is there a way to turn these warnings of locally?
>
> Yes.  You can do this:
>
> $^W = 0;
>          # lines of troublesome code go here

The unused variable WARNING is caused by the -w switch. Assumed it was the
strict module and looked all over the manuals for ways to turn the strict
off :)

Thanks!


Groeten




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

Date: Sat, 09 Oct 1999 13:43:42 GMT
From: skeeta@gmx.net
Subject: Prob. with cgi-script (need help)
Message-Id: <7tngqc$cct$1@nnrp1.deja.com>

Hello, hope anybody can help me...

I wrote a (quite simple) script, that subscribes you to several e-
mailadresses, which are first entered in a form and then posted to the
script. The script extracts the subscriber's e-mail address and user-
name and should send the user information to the mailinglists the user
chose by checking the boxes. It works fine at home under Win32 Apache
1.3.6 with perl 5.005. But it fails when i run it on Hypermart's
server. "Premature end of script headers"

Anyway, here's the script:

#!/usr/bin/perl -w
# Copyright (c) 1999 by Sebastian Aberle
# All rightz reversed

# Parameter einlesen

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/<!--(.|\n)*-->//g;
  $FORM{$name} = $value;
  if ($name = 'auswahl') { &empfaenger_ermitteln; }
}

# Ordnen

sub empfaenger_ermitteln

{
if ($empfaenger || "") { $empfaenger = "$empfaenger, $FORM{'auswahl'}";
}
else { $empfaenger = "$FORM{'auswahl'}"; }
}

# E-Mail absenden

open(SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
print SENDMAIL <<"EOF";
From: $FORM{'user-name'} <$FORM{'user-email'}>
To: $empfaenger;
Subject: subscribe $FORM{'user-email'}

Dies ist der Body der Message

EOF
close(SENDMAIL);



# HTML-Seite ausgeben

# print "<h1>Anmeldung erfolgreich!</h1>";


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 9 Oct 1999 12:43:04 GMT
From: fheitka@attglobal.net 
Subject: Re: reading binary data files
Message-Id: <37ff3858_4@news1.prserv.net>

Martien Verbruggen <mgjv@wobbie.heliotrope.home> wrote:
>On 7 Oct 1999 11:45:43 GMT,

I tried your example (Thank you very much!) on Windows NT
4.0 SP5 and Active Perl and got an exception running the 
Perl code.  I haven't tried it on Unix or Linux yet.  I
can get the exact message if you want to know. (I'm not
currently anywhere near the NT machine.)  The Active Perl
was the latest development version as of a month or so
ago; i519e.

-- 
Fred


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

Date: 9 Oct 1999 12:49:30 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: reading binary data files
Message-Id: <slrn7vueac.1pg.mgjv@wobbie.heliotrope.home>

On 9 Oct 1999 12:43:04 GMT,
	fheitka@attglobal.net <fheitka@attglobal.net> wrote:
> Martien Verbruggen <mgjv@wobbie.heliotrope.home> wrote:
> >On 7 Oct 1999 11:45:43 GMT,
> 
> I tried your example (Thank you very much!) on Windows NT
> 4.0 SP5 and Active Perl and got an exception running the 

Well, the code that I showed ran on my linux box. There shouldn't be
anything OS specific about it though. As long as it's written on the
same machine/OS as its being read, pack/upnpack should be binary
compatible with their C equivalents. Or am I wrong in that? Of course,
writing a binary file on one platform, and then trying to read it on
another becomes a lot harder to do.

> Perl code.  I haven't tried it on Unix or Linux yet.  I
> can get the exact message if you want to know. (I'm not

That would, of course be very helpful. But, before posting the message
to here, you should probably have a look in the perldiag documentation
to see if you can find it.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd.       | things get worse.
NSW, Australia                      | 


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

Date: Sun, 10 Oct 1999 10:45:43 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: s/// used on a file slurped into a scalar
Message-Id: <r7_L3.2437$UG5.154585@typ11.nn.bcandid.com>

In article <380002d9_1@news2.one.net>, David Wall <darkon@one.net> wrote:
>I wrote a short script to give the FAQs in the html version of the Activestate 
>docs more descriptive link text.  It works fine, even if it is a bit crude, 
>but then I started tinkering to make it shorter.  The following code doesn't 
>work, and I'm not sure why.  I used the same regular expression in the code 
>that worked, except that here I used s///sig instead of s///si.

What, exactly, do you mean by "doesn't work"?  What does it do?

>s#(<a 
>href="\./lib/Pod/perlfaq\d\.html">.*)perlfaq(\d).*(</a>)#$1$faq{$2}$3#sig;

My PSI::ESP module tells me that you switched from modifying things a
line at a time to modifying them a file at a time at the same time as
you switched from /si to /sig.  This regex -- with the /s modifier --
will find the first <a href="matching stuff">, the last perlfaq\d, and
the last </a> in the file, and chomp everything between them.

The simple fix is to use .*? instead of .*.  I do wonder why you have
the .*'s in there at all, though.  Can you constrain them a bit more?
(I haven't looked at the ActiveState docs.)  If you can't constrain
them, maybe the second one really ought to be captured inside () and
included in the replacement string?

HTH.  :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 10 Oct 1999 10:53:12 GMT
From: Ron Seifenberger <troja2977@my-deja.com>
Subject: saving images
Message-Id: <7tpr6n$shn$1@nnrp1.deja.com>

Hello,

I have the following problem:
I want to read a picture from a website and save it. It works with
normal text but not with pictures (I work under Windows).
I think some newlines or special characters get lost. Has someone an
idea what is wrong with my script (or knows another script doing that?)

Thanks,
  Ron

---------------------
and here the program

use LWP::Simple;

$page = get "http://www.perl.com/images/source_ii.gif";
@lines =  $page;
binmode(DATEI);
open (DATEI, ">picture.gif");
foreach $line (@lines) {
             print DATEI $line;
                       }
close(DATEI);






Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 10 Oct 1999 10:24:27 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Shell and Perl have different $?
Message-Id: <vPZL3.2432$UG5.153597@typ11.nn.bcandid.com>

In article <37fee858.236621587@news.iprolink.ch>,
Sam Carmalt <scarmalt@swconsult.ch> wrote:
>kragen@dnaco.net (Kragen Sitaker) wrote:
>>In other words, if you want the command's exit status -- what you get
>>with sh or csh $? -- you want ($? >> 8) in Perl.
>
>Yes.  But I don't really care about the value.  I just need to know
>whether the command ran successfully.

Well, most standard Unix commands return 0 on success or -1 on failure;
a few return 0 on "nothing interesting", 1 on "something interesting",
or -1 on failure; and there are some (e.g. the pieces of qmail) that
have more elaborate schemes.

Normally dying from a signal is considered "failure".  So normally to
check for failure, we just check to see whether $? is nonzero.

>>>  Now I can
>>>speculate that going via the shell or not (by breaking the system
>>>arguments into multiple parts on not) would cause either one or the
>>>other of these tests to miss 'seeing' the error, but I still don't
>>>understand why BOTH the return value from system() and the $? variable
>>>fail to record the difference between success and failure.
>>
>>I can't understand this either.  Are you saying the value you get in $?
>>is the same, no matter what status the command exits?  I'd be tempted
>>to speculate your Perl or your kernel is broken.
>
>That is EXACTLY what I'm saying -- that $? (and also the return value
>of $ia from $ia = system("something") ) is indeed the same from both
>the success and the failure.

So either (a) the program you're calling is broken and doesn't report
success or failure, or (b) your kernel or your perl is broken and is not getting the status back to you.  If (a), you won't be able to tell
the difference from the shell, either, and I think you said you could.

What OS are you on?  Maybe you could use 'strace' or 'truss' to see
what the actual return value of the wait() system call is, to see if
it's your perl's fault.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 9 Oct 1999 15:46:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: tool to convert BMPs to GIFs programatically?
Message-Id: <Pine.HPP.3.95a.991009154501.3676A-100000@hpplus01.cern.ch>

On Fri, 8 Oct 1999, J. A. Mc. wrote:

> >An amusing party trick, but what use in this context?  Images that are
> >good for GIF or PNG representation are usually very unsuitable as JPEGs,
> >and vice versa (see Tom Lane's JPEG FAQ). 
> >
> This 'context' as you put it, is the original question of:
> 
> "I want to convert some BMPs to GIFs using code, without any user
> interaction.

Exactly.

> My thought was thay perhaps he could use the .jpg form instead, 

And the reason why not is explained by the part of my posting that you
quoted.  Thanks.

-- 

            World Egg Day "got off to a cracking start" -official.




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 1029
**************************************


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