[18964] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1159 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 19 14:08:58 2001

Date: Tue, 19 Jun 2001 11:05:08 -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: <992973908-v10-i1159@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 19 Jun 2001     Volume: 10 Number: 1159

Today's topics:
    Re: [ map { @{ $_ || [ ] } } @$to ] (what does this mea <joe+usenet@sunstarsys.com>
        [ANNOUNCE] Getopt::Attribute 0.02 <marcel@codewerk.com>
        Are there any Perl - NT oriented message boards? (CPERL520335)
        CGI.pm, cookies and redirect PLS HELP! (CPERL520335)
        error making Archive::Zip (Gururaj Upadhye)
        Fetching CGI data as a hash (was DBM in a CGI) <amittai@amittai.com>
    Re: Fetching CGI data as a hash (was DBM in a CGI) <jason@uklinux.net>
    Re: Fetching CGI data as a hash (was DBM in a CGI) <krahnj@acm.org>
        getsockopt and setsockopt: SO_RCVBUF unsupported? (Stephen Scheck)
    Re: Graphical user interfacing? <rsherman@ce.gatech.edu>
    Re: Graphical user interfacing? (Helgi Briem)
    Re: Graphical user interfacing? (isterin)
        HowTo: Run a command in backticks as root? <>
    Re: initialising multi-dimensional array <mjcarman@home.com>
        Looking for descriptions of IngPerl Functions and Varia <czajko@ocas.on.ca>
        Missing copied lines <cbbenefit@nospamhotmail.com>
    Re: Mix JS variables - David Eff.. (BUCK NAKED1)
    Re: Need to Null a Hash?vvp (isterin)
        newbie SMTP problem <noemail@noemail.com>
    Re: parsing log file (darrin)
    Re: premature end of script or malformed header <rsherman@ce.gatech.edu>
    Re: premature end of script or malformed header (isterin)
        Setting Return-Path in sendmail from Perl <steve@newmediacreations.com>
    Re: What is ${'string'} ? <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 19 Jun 2001 12:19:02 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: [ map { @{ $_ || [ ] } } @$to ] (what does this mean?)
Message-Id: <m3bsnk5top.fsf@mumonkan.sunstarsys.com>

Dale Gerdemann <dg@sfs.nphil.uni-tuebingen.de> writes:

> sub flatten;
> sub flatten {
>   my $array = shift;
>   @$array = ( map
              ^
          unnecessary
>       { if ($_) {
>            if (ref($_)) {
>       flatten $_
               ^^^^
    use parens here to avoid predeclaration

>     } else {
>       ($_)
>     }
>   } else {
>     ( )
>   }
    try using ?: here instead

>       } @$array );
> }

Personally, I would let the caller reassign the array,
and allow flatten to operate on lists instead:

  sub flatten {
    map { ref($_) ? flatten(@$_) : $_ || () } @_;

    # or maybe you want this instead?
    # map { ref($_) ? flatten(@$_) : defined($_) ? $_ : () } @_  
  }

  my @to = ( [ 4,[undef, 5,6] ], 7, undef, [8,9]);
  @to = flatten @to;
  print "@to\n";

HTH

-- 
Joe Schaefer                  "Whatever you are, be a good one."
                                               -- Abraham Lincoln



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

Date: 19 Jun 2001 16:53:59 GMT
From: Marcel Grunauer <marcel@codewerk.com>
Subject: [ANNOUNCE] Getopt::Attribute 0.02
Message-Id: <tiv4293atoue25@corp.supernews.com>

NAME
    Getopt::Attribute - Attribute wrapper for Getopt::Long

SYNOPSIS
      use Getopt::Attribute;

      my $verbose : Getopt(verbose!);
      my $all     : Getopt(all);
      my $size    : Getopt(size=s);
      my $more    : Getopt(more+);
      my @library : Getopt(library=s);
      my %defines : Getopt(define=s);
      sub quiet : Getopt(quiet) { our $quiet_msg = 'seen quiet' }
      usage() if my $man : Getopt(man);
      ...

      # Meanwhile, on some command line:

      mypgm.pl --noverbose --all --size=23 --more --more --more --quiet
               --library lib/stdlib --library lib/extlib
               --define os=linux --define vendor=redhat --man -- foo

DESCRIPTION
    This module provides an attribute wrapper around `Getopt::Long'. Instead
    of declaring the options in a hash with references to the variables and
    subroutines affected by the options, you can use the `Getopt' attribute
    on the variables and subroutines directly.

    As you can see from the Synopsis, the attribute takes an argument of the
    same format as you would give as the hash key for `Getopt::Long'. See
    the `Getopt::Long' manpage for details.

    Note that since attributes are processed during CHECK, but assignments
    on newly declared variables are processed during run-time, you can't set
    defaults on those variables beforehand, like this:

            my $verbose : Getopt(verbose!) = 1;  # DOES NOT WORK

    Instead, you have to establish defaults afterwards, like so:

            my $verbose : Getopt(verbose!);
            $verbose ||= 1;

BUGS
    None known so far. If you find any bugs or oddities, please do inform
    the author.

AUTHOR
    Marcel Grunauer, <marcel@codewerk.com>

COPYRIGHT
    Copyright 2001 Marcel Grunauer. All rights reserved.

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

SEE ALSO
    perl(1), Getopt::Long(3pm), Attribute::Handlers(3pm).


Marcel

-- 
We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
 -- London.pm strategy aka "embrace and extend" aka "mark and sweep"




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

Date: 19 Jun 2001 18:03:02 GMT
From: cperl520335@aol.com (CPERL520335)
Subject: Are there any Perl - NT oriented message boards?
Message-Id: <20010619140302.08314.00000040@ng-cm1.aol.com>

I know there aren't any perl - NT newsgroups, but what about messages boards,
etc.

There must be a perl NT community somewhere.

Can anyone point me in the right direction? (I already know activestate, but
there's no community boards)


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

Date: 19 Jun 2001 17:59:22 GMT
From: cperl520335@aol.com (CPERL520335)
Subject: CGI.pm, cookies and redirect PLS HELP!
Message-Id: <20010619135922.08314.00000038@ng-cm1.aol.com>

I have a script that sets a cookie, then re-directs the browser.

It's all been working great with the code:-

  @months =
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  @days = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
  ($sec,$min,$hr,$mday,$mon,$yr,$wday,$yday,$isdst) = gmtime(time +
$cookietime);
  $timestr = sprintf("%3s, %02d-%3s-%4d %02d:%02d:%02d GMT",
$days[$wday],$mday,$months[$mon],$yr+1900,$hr,$min,$sec);
  print "Set-Cookie: AFFILIATE=$userhandle; path=/; expires=$timestr\n";


followed later by:-

print "Location: $site1\n\n";

But now that I'm converting the script to NT the set cookies code isn't
working.

I looked at the activestate FAQ, and followed instructions to use CGI.pm's set
cookie function. So now I have:-

  $cookietime = "+" . $cookietime . "h";
  $query = new CGI; 
  $my_cookie = $query->cookie(-name=>'AFFILIATE', -value=>$userhandle,
-expires=>$cookietime, -path=>'/');
  print $query->header(-cookie=>$my_cookie);

Which works great, but the problem is now that the redirect isn't working. So I
changed the redirect to the CGI.pm version:-

  print $query->redirect($site1);

Which doesn't work either. The "Location: http://......" just get displayed on
the page.

So you see my dilema.

Please could you tell me what was wrong with my original code for set cookie on
NT, and/or how to fix the redirect with the CGI.pm code.

Thanks to all those that reply :)





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

Date: 19 Jun 2001 08:59:25 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: error making Archive::Zip
Message-Id: <23c54ab6.0106190759.5b7abd49@posting.google.com>

I am getting following error while making Archive::Zip. I am working
on Windows NT 4.0, perl 5.6.0. THis is from output of perl -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread

Following is copied from command window:
D:\shared\Download\Archive-Zip-0.11>perl makefile.pl
Writing Makefile for Archive::Zip

D:\shared\Download\Archive-Zip-0.11>nmake

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        D:\Perl\bin\perl.exe -Id:\Perl\lib -Id:\Perl\lib
-MExtUtils::Command -e cp crc32 b
lib\script\crc32
        D:\Perl\bin\perl.exe -Id:\Perl\lib -Id:\Perl\lib  -e "system
qq[pl2bat.bat ].shift
" blib\script\crc32
The name specified is not recognized as an
internal or external command, operable program or batch file.

THanks and regards,
-Gururaj.


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

Date: Tue, 19 Jun 2001 17:09:15 +0200
From: "Amittai Aviram" <amittai@amittai.com>
Subject: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <9gnq13$9ma$1@rznews2.rrze.uni-erlangen.de>

Getting started with Perl, CGI, and Unix and am grateful for help from this
group.  After some troubleshooting, I was able to figure out exactly what is
causing some scripts of mine to return server error messages when I attempt
to run them via Web forms.  The problem comes up when, after creating a new
CGI object, I attempt to create a hash out of the names-values pairs coming
from the form:

use CGI qw(:cgi);

$query = new CGI;
%fields = $query->Vars;

Comment the last line out, the script works (without the hash, of course.)
Uncomment it, I get a server error.  My administator informs me that he is
running Perl 5 and an Apache server.  I have no idea where to go next.  Any
suggestions or help would be appreciated.

BTW, if anybody can suggest a way around this to create a hash from the
incoming data without having to spell out every single field name and using
$value = param("fieldname"), I'd also be grateful.


--
Amittai Aviram
Please note new address! --  amittai@amittai.com





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

Date: Tue, 19 Jun 2001 16:58:45 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <Pine.LNX.4.30.0106191655420.19696-100000@s1.uklinux.net>

On Tue, 19 Jun 2001, Amittai Aviram wrote:

> Getting started with Perl, CGI, and Unix and am grateful for help from this
> group.  After some troubleshooting, I was able to figure out exactly what is
> causing some scripts of mine to return server error messages when I attempt
> to run them via Web forms.  The problem comes up when, after creating a new
> CGI object, I attempt to create a hash out of the names-values pairs coming
> from the form:
>
> %fields = $query->Vars;

This is not supported. You need to do something along the lines of:

my (@names, %fields);
@names = $query->param;
foreach my $p (@names)
    {
    $fields{$p} = param($p);
    }

Jason Clifford
UKLINUX NET
http://www.uklinux.net/



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

Date: Tue, 19 Jun 2001 17:39:33 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <3B2F8E53.4BD04FC8@acm.org>

Jason Clifford wrote:
> 
> On Tue, 19 Jun 2001, Amittai Aviram wrote:
> 
> > Getting started with Perl, CGI, and Unix and am grateful for help from this
> > group.  After some troubleshooting, I was able to figure out exactly what is
> > causing some scripts of mine to return server error messages when I attempt
> > to run them via Web forms.  The problem comes up when, after creating a new
> > CGI object, I attempt to create a hash out of the names-values pairs coming
> > from the form:
> >
> > %fields = $query->Vars;
> 
> This is not supported. You need to do something along the lines of:
> 
> my (@names, %fields);
> @names = $query->param;
> foreach my $p (@names)
>     {
>     $fields{$p} = param($p);
>     }

Or more simply:

my %fields;
my @names = $query->param;
@fields{@names} = param(@names);



John
-- 
use Perl;
program
fulfillment


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

Date: 19 Jun 2001 10:05:26 -0700
From: esteban0@excite.com (Stephen Scheck)
Subject: getsockopt and setsockopt: SO_RCVBUF unsupported?
Message-Id: <aa3f003d.0106190905.61ba805c@posting.google.com>

Hello,

I'm trying, with no success, to get getsockopt() and setsockopt()
to show or set a socket's SOL_SOCKET SO_RCVBUF option. Here's
what I'm doing:

$value = getsockopt($socket, &SOL_SOCKET, &SO_RCVBUF);
print "$value\n" if ( defined($value) );

$result = setsockopt($socket, &SOL_SOCKET, &SO_RCVBUF, 64 * 1024);
die("uh oh!") if ( ! defined($result) );

$value = getsockopt($socket, &SOL_SOCKET, &SO_RCVBUF);
print "$value\n" if ( defined($value) );

Both getsockopt and setsockopt succeed (don't return undef),
but getsockopt returns nothing, so I can't tell whether the
it is working or whether the setsockopt suceeded.

Tested on both Linux and FreeBSD.

What am I doing wrong?


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

Date: Tue, 19 Jun 2001 11:15:32 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Graphical user interfacing?
Message-Id: <3B2EEE04.50F5C38@ce.gatech.edu>

flash wrote:

> Is it possible to interface with a grapical program (GUI)?
> What modules?
>
> This would be on windows.
>
> thanks,
>
> --
> #--*--*--*--*--*--*--*--*--*--*--#
> #        The smash script archive.       #
> #       http://www.floodbox.com       #
> #--*--*--*--*--*--*--*--*--*--*--#

either Win32::GUI or Tk will work. personally, i stick with Tk as it is
portable. you can get these modules on CPAN.

-rob



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

Date: Tue, 19 Jun 2001 15:23:42 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Graphical user interfacing?
Message-Id: <3b2f6cc9.1751826583@news.isholf.is>

On Tue, 19 Jun 2001 08:35:06 -0400, "flash" <bop@mypad.com>
wrote:

>Is it possible to interface with a grapical program (GUI)?
>What modules?
>
>This would be on windows.
>
I'm not sure what you mean by "interfacing with".
1) You can usually produce data files suitable for a GUI 
program.  Modules vary, but as an example see: Win32::OLE.
2  You can usually tell a GUI program to open a particular
data file.  See Win32::Process.  Some programs also allow
you to interact with them.
3) If the GUI program can also handle batch jobs,
i.e. take in arguments from STDIN and send them
to STDOUT, you can call it with backticks or qx.

In general, though, GUI programs are not terribly 
well suited for batch job type automation.

HTH
Regards,
Helgi Briem



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

Date: 19 Jun 2001 09:34:54 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Graphical user interfacing?
Message-Id: <db67a7f3.0106190834.1d3eb269@posting.google.com>

"flash" <bop@mypad.com> wrote in message news:<LGHX6.20183$Vl2.1062499@news20.bellglobal.com>...
> Is it possible to interface with a grapical program (GUI)?
> What modules?
> 
> This would be on windows.
> 
> thanks,

Tk.pm

Ilya


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

Date: 19 Jun 2001 12:23:05 -0500
From: Simon Devlin <>
Subject: HowTo: Run a command in backticks as root?
Message-Id: <kc2vito4h41i847sm3d26bgdi3d3h8qnkc@4ax.com>

Can anyone offer any suggestions?

I have a utility (a portscanner) that needs to be run as root in order
to function fully.

$command="nmap -sS -O -oX - 10.1.1.1-255 |";
open(NMAP, $command) || die "Can't start nmap : $!";
while (<NMAP>) {
 ...whatever
}
close(NMAP};

The upshot of this is that it runs a port scan and in the process
returns an XML file that is parsed line by line, producing a report at
the end.

Basically, it's fine, but some of the features, require that NMAP be
run as root, and I'm not sure how to make perl do this.

I've seen stuff about $< and $> but to be honest, probably don't
understand quite enough about the underlying principles to make full
use of it.

Does anyone have a barebones example of making perl do something as
root, then returning to normal?

Note, that in this instance, the perl program is running under the
apache user as the result of a webfronted report generator.

Regards


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

Date: Thu, 14 Jun 2001 09:41:50 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: initialising multi-dimensional array
Message-Id: <3B28CD2E.783E966E@home.com>

Mark Grimshaw wrote:
> 
> How do I initialise everything in a multi-dimensional array to 0
> (or any variable for that matter)?  Currently, all rows/column
> elements are undef.

The straightforward approach is to use a nested loop:

my @x;
foreach my $i (0..9) {
    foreach my $j (0..9) {
        $x[$i][$j] = 0;
    }
}

But it's much more Perlish to say:

my @x = map{[(0) x 10]} 0..9;

Of course, you may not need to initialize anything at all. For example,
it's perfectly okay to say

my @x;
$x[5][5]++;

-mjc


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

Date: Tue, 19 Jun 2001 15:56:55 GMT
From: "Daniel Czajko" <czajko@ocas.on.ca>
Subject: Looking for descriptions of IngPerl Functions and Variables in Perl v5
Message-Id: <GF6psE.uLr@alfalfa.utcs.utoronto.ca>

Anybody knows where I can find those descriptions?

e-mail replies are preferred

thanks




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

Date: Tue, 19 Jun 2001 12:08:37 -0500
From: "CharlieB" <cbbenefit@nospamhotmail.com>
Subject: Missing copied lines
Message-Id: <3b2f86f2$1_2@newsa.ev1.net>

Here is a very strange thing I have noticed with a system script I wrote and
have added to for months:

I parse a file for lines of two different data types (master record line or
detail line) and after accumulating some stats (amount of master record and
sum of detail records must be equal) I copy the file(s) created by
seperating the lines by month of invoice to another folder. The files that
reside in the original folder are fine, but the ones copied from those
originals are missing lines of data from the end of the file. Here is the
code block I am using to copy them. (I get the same result when using the
system() call and the File::Copy routine)

foreach $FileMove (@FilesCreated)

{

$Target4Move = $CopyDir . $FileMove;

$Source4Move = $OutDir . $FileMove;

print "File to Copy: $FileMove\n";

open (COPYFROM, "<$Source4Move") or LogAndDie ("*COULD NOT OPEN $Source4Move
FOR COPY TO $Target4Move\n");

open (COPYTO, ">>$Target4Move") or LogAndDie ("*COULD NOT OPEN $Target4Move
FOR COPY FROM $Source4Move\n");

while (<COPYFROM>)

{

print COPYTO "$_";

}

close (COPYFROM) or LogAndDie ("ERROR: COULD NOT CLOSE $Source4Move\n");

close (COPYTO) or LogAndDie ("ERROR: COULD NOT CLOSE $Target4Move\n");

print RPT2PRN "$Source4Move Copied to $Target4Move Successfully\n";

$EventText = $EventText . " " . $Source4Move;

}





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

Date: Tue, 19 Jun 2001 12:02:05 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Mix JS variables - David Eff..
Message-Id: <6392-3B2F858D-177@storefull-241.iap.bryant.webtv.net>

Thanks, David. Now, THAT was helpful! 

I'm still curious if anyone knows of a site that explains mixing JS with
Perl. All I can find on the subject are the JS Event Handlers that are
mixed with perl in CGI.pm.

--Dennis



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

Date: 19 Jun 2001 09:37:12 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Need to Null a Hash?vvp
Message-Id: <db67a7f3.0106190837.6346f920@posting.google.com>

"Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com> wrote in message news:<3B2F5BB6.9F2DE69F@americasm01.nt.com>...
> Hello,
> 
> I am trying to get some info from a database - put it into a has.  But
> some of the fields are blank resulting in this error:
> 
> Use of uninitialized value at /table1/table1.cgi line 103
> 
> Here is the code block:
> 
> sub load_category_names
> {
>    ### Perform the connection using the Mysql driver
>    my $dbh = DBI->connect( "dbi:mysql:xxx", "xxx", "xxx" , \%attr )
>     or die "Can't connect to database: ", $DBI::errstr, "\n";
> 
>    my $sth = $dbh->prepare("select * from table1") or
>       err_trap("Cannot prepare the table1 query");
>    $sth->execute or err_trap("Cannot execute the table1 query");
> 
>         my @cat;
>         my $rowhash;
>         while ( my @row = $sth->fetchrow_array )
>         {
>         my %rowhash;
>   LINE
> 103->$rowhash{'sign_off_type','sign_off_desc','global_id','crit1','crit1_desc','crit2','crit2_desc','crit3','crit3_desc'}
> = @row;
>         push @cat, \%rowhash;
>   print $cgi->p("$rowhash");
>          }
> 
> 
>    err_trap("Error fetching table1") if $DBI::err; 
> 
> In some of there records, the last 4 fields are blank - not data - I
> suspect this is the reason?  Do I have to put a NULL value in the hash? 


Since it will be set to undef in NULL is returned from db you can
check it with exists($foo{bar}) before accessing it.

Ilya

 
> 
> Any help?
> 
> Thanks,
> 
> V


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

Date: Tue, 19 Jun 2001 17:30:37 GMT
From: "Thing" <noemail@noemail.com>
Subject: newbie SMTP problem
Message-Id: <1%LX6.20151$Kq4.1868106@newsread2.prod.itd.earthlink.net>

i dont know why this code doesnt work, does anyone see anything wrong with
the code ?
if i telnet to my isp, and run the commands, it works, but if i use this
code nothing happens and i get no errors.
the $CRLF i am trying to make a carriage return line feed so that it
executes the commands.
*Note i changed the server and email address.

#!/perl/bin/perl.exe
use CGI qw/:standard/;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use IO::Socket;
$CRLF = "\015\012";
my $sock = new IO::Socket::INET (PeerAddr => 'smtpout.something.net',
PeerPort => '25',
Proto => 'tcp');
if ($sock)
{
print "my god, its full of stars";
}
print $sock "HELO insurance.com$CRLF
MAIL From:<thing@insurance.com>$CRLF
RCPT To:<guy@aol.com>$CRLF
DATA$CRLF
This was from Perl$CRLF
 .$CRLF
QUIT$CRLF" || die "didnt work";
close($sock) || die "didnt work";




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

Date: 19 Jun 2001 09:14:45 -0700
From: dthusma@balsasoft.com (darrin)
Subject: Re: parsing log file
Message-Id: <525a9ea2.0106190814.2dd90c50@posting.google.com>

"kevin" <emailkevin@charter.net> wrote in message news:<titgl8jpfkj5bf@corp.supernews.com>...
> Can someone tell me a simple way to read a log file and act on it?...I mean
> a REAL log file...one that is constantly updated...I need to know how to
> read each new line as it comes in and take some action.  Any reference I
> find is for a static log file...not a dynamic,  new entry a minute, log
> file....ANY help appreciated!!
> 
> thanks

try 
8.5 in the perl cookbook, second ed

Here is a rough applied example of it:

sub readfile
{
 ($tA,$filename) = @_;
 #what is the size of the file? Used to read from last read_to to end of file
 $size=stat($filename)->size;
 $len  = $size - ${$filename}{'size'}; 
 $prev_size=${$filename}{'size'} || $posit; 
 ${$filename}{'size'}=$size; 
 if ($len > 0)
  {
   open(FA,"<$filename");
   seek(FA,$prev_size,0);
   # you can have regexps or whatever here. I use it to update a TK window
   $tA->configure(-state=>'normal'); 
   #$tA->insert('end',"-----------------------------------------------------\n",$code);
   for ( $curpos=tell(FA);<FA>; $curpos=tell(FA)) { 
	$tA->insert('end',$_);
   };		
   close(FA);
   $tA->insert('end',"-----------------------------------------------------\n",$code);
   $tA->{posn} += $len;
   $tA->see('end');
   $tA->configure(-state=>'disabled'); 
  }
}

Happy Coding!

Darrin


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

Date: Tue, 19 Jun 2001 11:24:15 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: premature end of script or malformed header
Message-Id: <3B2EF00F.90BCF366@ce.gatech.edu>

Christophe Gibert wrote:

> I am running a cgi script written in perl that causes an internal server
>
> error. the error logs say "premature end of script" or "malformed header
>
> from script" but the script is running when it is launched from the
> shell. And it is so simple that it it can not be wrong
> My server is apache 1.3.14
>
> What'ts wrong ?
>
> --
> Christophe Gibert
> http://www.e-xode.com/cv/christophe.htm
> Reportage multimedia interactif : les enfants tibétains exilés
> http://www.e-xode.com

scripting rule #123: it can always be wrong.

you are likely not constructing the HTTP header properly...are you doing
this with or without CGI.pm? (if not, you may want to try it)

also check your permissions (more specifically, the web server's
permissions), as this is a common issue if it will run from the shell but
not in the CGI environment.

-rob



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

Date: 19 Jun 2001 09:43:11 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: premature end of script or malformed header
Message-Id: <db67a7f3.0106190843.5b04f81d@posting.google.com>

Christophe Gibert <christophe@e-xode.com> wrote in message news:<3B2F6816.A9D937C5@e-xode.com>...
> I am running a cgi script written in perl that causes an internal server
> 
> error. the error logs say "premature end of script" or "malformed header
> 
> from script" but the script is running when it is launched from the
> shell. And it is so simple that it it can not be wrong
> My server is apache 1.3.14
> 
> What'ts wrong ?

I don't think I nor anyone else knows, but with a sample script that's
not working we might be able to help.

Ilya


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

Date: Tue, 19 Jun 2001 17:43:37 GMT
From: "Steven Stalzer" <steve@newmediacreations.com>
Subject: Setting Return-Path in sendmail from Perl
Message-Id: <dbMX6.46110$Ua3.3684466@typhoon2.ba-dsg.net>

Hi,

I want to be able to set up the return path in sendmail so that when my email
script sends out an email to an invalid email address, the offending email
message gets bounced back to a POP mailbox I can access (so I can remove the
email address from the mailing list). Since I am running the script (and
sendmail) on a virtual shared server environment, there is a default address
that is used by the server when sendmail is executed, which I can't modify. I am
hoping to do something like this:
    open(MAIL,"|$mailprog -t");
    print MAIL "To: $email\n";
    print MAIL "From: $steve\n";
    print MAIL "Return-Path: $bounce_alias\n";
    print MAIL "Subject: $subject\n\n" ;

where $bounce_alias is simply a valid POP email I can log onto and retrieve
messages from. (Of course the example above doesn't work...)

Any ideas?
Thanks.

Steve
--
Steven Stalzer
New Media Creations, Inc.




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

Date: Tue, 19 Jun 2001 16:29:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: What is ${'string'} ?
Message-Id: <m8vuitobsv8i1q39j62aav95htq9r1p1e2@4ax.com>

Michael Carman wrote:

>%foo is a hash. $foo{bar} is the value in the hash %foo with a key of 
>'bar'. $foo{'bar'} and $foo{"bar"} are the same thing. You don't 
>normally need to quote your keys -- Perl does that for you -- 

if the keys are barewords, i.e. typically acceptable for sub names, and
maybe even variables (except Perl's special variables) minus the prefix.

Barewords may contain digits, but cannot start wih one.

>but it is 
>necessary if your keys contain certain characters (like spaces)

Then they wouldn't be barewords.

Note that "Foo'Bar" is a bareword, but then, it's taken as "Foo::Bar".

>or 
>happen to be keywords (like time).

Wrong. That used to be the case in old Perls. 5.004 (e.g. MacPerl) still
warns about an ambiguity resolved in favour of the quoted word, but that
warning has been removed in 5.005 (and later). $foo{time} IS
$foo{'time'}.

-- 
	Bart.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1159
***************************************


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