[7647] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1273 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 5 07:07:13 1997

Date: Wed, 5 Nov 97 04:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 Nov 1997     Volume: 8 Number: 1273

Today's topics:
     Re: "die" function won't print in CGI!?!! <markm@nortel.ca>
     [Q] call a method not known until runtime (brian d foy)
     Re: [Q] call a method not known until runtime (Toutatis)
     Ability to drive C++ objects with perl? <nospambruce_wheeler@hp.com.nospam>
     Re: Ability to drive C++ objects with perl? <domi@marlis.grenoble.hp.com>
     Re: ARRAYS... Reading file data HELP ME!! <markm@nortel.ca>
     Re: AUTOLOAD and sort <qdtcall@esb.ericsson.se>
     Re: AUTOLOAD and sort (Mike Heins)
     Re: CHMOD 755 PLEASE HELP!! andrew@ugh.net.au
     Re: CPAN confusion (Daniel E. Macks)
     Re: crontab -l reformating (Reinvent the wheel?) <yoda@dagoba.org>
     ExecCGI (Nuno Gomes)
     Re: file locking on win95 <camerond@mail.uca.edu>
     Re: FileHandle->flush not working (?) (Martien Verbruggen)
     Getting bash history in Perl scripts <patneave@anti-spam.com>
     HELP : Setting an Environment Variable/ERRORLEVEL in PE <a.n.farrow@cranfield.ac.uk>
     Re: NT/ Reading command output (Martien Verbruggen)
     Re: pattern matching options (brian d foy)
     Re: pattern matching options <ajohnson@gpu.srv.ualberta.ca>
     Re: Perl file sort <qdtcall@esb.ericsson.se>
     Re: Perl->Java? Java->Perl? Gaaaaa! <steve_crook@mtits.co.uk>
     Re: print aound matched line (Eric Bohlman)
     Stoopid Question ??? <ziggy2@enid.com>
     Re: Stoopid Question ??? (Peter Samuelson)
     Re: trouble with 'application/octet-stream' script (Martien Verbruggen)
     Upload NS2.0+ - A network error ocured while netscape w (Patrick)
     Yet another gethostbyaddr question <krist@oslo.sgi.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 05 Nov 1997 01:46:43 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: "die" function won't print in CGI!?!!
Message-Id: <lq1btzzkfcc.fsf@bmerhe83.nortel.ca>

jacoby@freighter.ecn.purdue.edu (David Jacoby) writes:

> In article <3458FFC6.81A77413@geoplex.com>,
> Mani Prasad Kancherla  <mani@geoplex.com> wrote:
> >#!/usr/bin/perl -w
> >use CGI(":standard");
> >$err_str = start_html("Error").h1("Error:")."Can't find form:
> >$!".end_html;
> >print header;
> >die $err_str unless (param("form") eq "trouble_report");
> >start_html("blah blah"); print "Some stuff"; end_html;
> >Netscape complains "Document has no data". But when I try this program
> >from the command line I get what is expected in both cases (i.e. when "form"
> >"trouble_report" or even otherwise).
> >Is there something wrong with what I'm doing?

Yeah... die prints on stderr, not stdout. Here's something you can do...
wrap the main code in an eval { ... } like this:

   eval {
      main();
   };
   if ($@) {
      print "Content-type: text/html\r\n\r\n";
      print "<h2>An error occurred in this script!</h2>\n";
      print $@;
   }

   sub main
   {
       ...
       die "Some error over here.";
   }

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


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

Date: Wed, 05 Nov 1997 04:55:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: [Q] call a method not known until runtime
Message-Id: <comdog-ya02408000R0511970455040001@news.panix.com>

let's say i have some module that has only an AUTOLOAD method to
provide accessor methods to instance variables whose names aren't
known until runtime.

let's also say i have a method to give me a list of the instance
variable names:

   $config->directives;

now i want to iterate through that list and get the variable values.
as far as i can tell, UNIVERSAL::can() isn't useful because the
methods don't exist.  so i came up with:

   foreach( $config->directives )
      {
      my $result = '';
      eval("\$result = \$config->$_");
      print "$_: [$result]\n";
      }

but that's not very aesthetically pleasing.

so now the question:  if TMTOWTDI, what are the alternatives?

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
hope i got all that lingo right


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

Date: 5 Nov 1997 11:32:23 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: [Q] call a method not known until runtime
Message-Id: <toutatis-ya023180000511971232240001@news.euro.net>

comdog@computerdog.com (brian d foy) wrote:

> let's say i have some module that has only an AUTOLOAD method to
> provide accessor methods to instance variables whose names aren't
> known until runtime.
> 
> let's also say i have a method to give me a list of the instance
> variable names:
> 
>    $config->directives;
> 
> now i want to iterate through that list and get the variable values.
> as far as i can tell, UNIVERSAL::can() isn't useful because the
> methods don't exist.  so i came up with:
> 
>    foreach( $config->directives )
>       {
>       my $result = '';
>       eval("\$result = \$config->$_");
>       print "$_: [$result]\n";
>       }
> 
> but that's not very aesthetically pleasing.
> 
> so now the question:  if TMTOWTDI, what are the alternatives?

Don't know. But I think:
$obj->param() to get the value, and
$obj->param('value') to set it
is nicer, better managable and probably faster than AUTOLOAD.

-- 
Toutatis


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

Date: Tue, 04 Nov 1997 20:25:40 -0800
From: Bruce Wheeler <nospambruce_wheeler@hp.com.nospam>
Subject: Ability to drive C++ objects with perl?
Message-Id: <345FF544.3E87@hp.com.nospam>

I'm new to perl, so I'm not sure if this is a standard capability
or I need to do an extension. For testing purposes, I want to be 
able to use the perl scripting language to control individual
C++ objects. With tcl and a shareware extension to tcl, I've been
able to do this on Unix. I'm now in the process of porting this to
NT. But possibly perl might be a better choice?


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

Date: 05 Nov 1997 10:06:40 +0100
From: Dominique Dumont <domi@marlis.grenoble.hp.com>
Subject: Re: Ability to drive C++ objects with perl?
Message-Id: <vkzra8vogkf.fsf@marlis.grenoble.hp.com>

Bruce Wheeler <nospambruce_wheeler@hp.com.nospam> writes:

> I'm new to perl, so I'm not sure if this is a standard capability
> or I need to do an extension. For testing purposes, I want to be 
> able to use the perl scripting language to control individual
> C++ objects. With tcl and a shareware extension to tcl, I've been
> able to do this on Unix. I'm now in the process of porting this to
> NT. But possibly perl might be a better choice?

You should either use XS (provided with perl distribution) or SWIG
(See http://www.cs.utah.edu/~beazley/SWIG/).

Both are discussed and compared in "Advanced perl programming" by 
Sriram Srinivasan published by O'Reilly..

Personnaly I use SWIG to generate interface to test the C programs
we sell. 

Hope this helps

-- 
Dominique_Dumont@grenoble.hp.com


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

Date: 05 Nov 1997 02:08:39 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: ARRAYS... Reading file data HELP ME!!
Message-Id: <lq1affjkebs.fsf@bmerhe83.nortel.ca>

Guy Doucet <gdoucet@ait.acl.ca> writes:

> I have a text data file that I need to store in an array to allow for
> easy calculations. The file would look like this:
> 
> AAAAA    95   40   12
> BBBBB    80   34   11
> CCCCC    88   33    5
> ...
> 
> I would prefer if the fields in each record (row) were separated by a
> tab character so that I could easily read the file with a spreadsheet.
> 
> What I managed so far was to open the file, read the file in an array
> variable, and close the file, for example:
> 
>    open(TOTALS,"$basedir/s_totl\.txt");
>    @totals = <TOTALS>;
>    close(TOTALS);
> 
> But know each $total of @totals is the entire record, how do I store
> each of its field in a variable too?
> 

You'd want to do something similar to the following:

---- CUT ----
use English;
use FileHandle;

my $totals_f = new FileHandle("totals") ||
    die "$0: Open of totals file failed: $OS_ERROR\n";
my @totals = map { [ split(/\s+/, $_) ] } (<$totals_f>);

print "Totals:\n";
foreach my $row (@totals) {
   my($name, @cols) = @$row;
   print "   ${name}:\t", join("\t", @cols), "\n";
}
---- CUT ----

So basically totals will look similar to the following once loaded with
your suggested test data:

   @totals = (  ['AAAAA', 95, 40, 12],
                ['BBBBB', 80, 34, 11],
                ['CCCCC', 88, 33,  5]   );

hope this helps,
mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


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

Date: 05 Nov 1997 09:33:52 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: AUTOLOAD and sort
Message-Id: <isyb33rb7z.fsf@godzilla.kiere.ericsson.se>

Tom Phoenix <rootbeer@teleport.com> writes:

> It had better not have side effects! :-)

Is that a requirement or just a good idea? This line makes my perl
dump core:

perl -e 'print join "\n", sort { print $a } 1..5;'

Perl 5.004_4, Solaris 2.5.1, compiled with gcc 2.7.2.

-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: 5 Nov 1997 09:14:02 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: AUTOLOAD and sort
Message-Id: <63pdcq$4nu$2@vixen.cso.uiuc.edu>

Andrew M. Langmead (aml@world.std.com) wrote:
: hermit@cats.ucsc.edu (William R. Ward) writes:
: 
: >aml@world.std.com (Andrew M. Langmead) writes:
: >> One way around it that I can think of is to give sort a bare code
: >> block that calls your autoloaded sub.
: >> 
: >> @sorted = sort { _sort_subroutine() } @list;
: >> 
: >> You will pay a small performance penalty for the extra subroutine
: >> call.
: 
: >Better to pay that penalty once, at the beginning, than every time it
: >is called, no?
: 
: Yes, but I would feel uncomfortable making a "throwaway" call to a
: subroutine just to autoload it. I doubt that a sort subroutine would
: have side effects, but I'd make sure I'd document that it can't.
: 

I have found that this is necessary even with a lexical code reference:

    # NOAUTO
    my %Sort_field = (
    # END NOAUTO

	none    => sub { $_[0] cmp $_[1]            },
	f   => sub { (lc $_[0]) cmp (lc $_[1])  },
	fr  => sub { (lc $_[1]) cmp (lc $_[0])  },
	n   => sub { $_[0] <=> $_[1]            },
	nr  => sub { $_[1] <=> $_[0]            },
	r   => sub { $_[1] cmp $_[0]            },
	rf  => sub { (lc $_[1]) cmp (lc $_[0])  },
	rn  => sub { $_[1] <=> $_[0]            },
    );

    sub sort_data {
	
	# Develop $code, a closure calling
	# one of the above sort routines.
	[snip]

	# Prime the sort?
	&{$Sort_field{'n'}}('1', '0');

	# Actually sort
	@codes =  sort {&$code} @$list;

    }

If I don't "prime" the sort, the first call to one of the
code references will never return. It is not enough to
merely reference the hash in the enclosing block, as I
do that in developing the closure.

Note that it is not necessary to call the same code reference
that is actually used -- it is enough to call any one of the
routines in the hash.

Why this is necessary, I don't know. I may discover it on my
long-postponed trip into the Perl internals.

-- 
Regards,
Mike Heins

This post reflects the
opinion of my employer.


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

Date: Wed, 5 Nov 1997 20:06:28 +1100
From: andrew@ugh.net.au
To: D2777@rocketmail.com
Subject: Re: CHMOD 755 PLEASE HELP!!
Message-Id: <Pine.BSF.3.96.971105200246.2801J-100000@depravitas.tuu.utas.edu.au>

On Sun, 26 Oct 1997, John W wrote:

> web page is, www.orc.ca/~davidh  But every Telnet command Ive tried

Your web page is probably stored elsewhere...thats just where its mapped
to in "web space". How do you upload your web pages? If its by FTP then
you must have found where to put them...

> fiona:~ $
> 
> Now which command, and what path do I use?

First type ls. This will show you all the files and directories in your
directory.  One of them will proabbly contain your web pages...It may be
called public_html or web_pages or something like that. If your not sure
type cd <directory>. Then type ls again. Once you are in the same
directory as the file you want to chmod just typ[e chmod 755 file

andrew



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

Date: 5 Nov 1997 07:32:20 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: CPAN confusion
Message-Id: <63p7e4$679$1@netnews.upenn.edu>

Ignoring the (hopefully accidental) tone of the poster...if you
feel there's a problem, why not solve it? You can learn how CPAN
is constructed from reading the docs (on CPAN, obv.). Then see
if it's a problem with the CPAN system (should it extract PODs
from the modules?) or with module authors (what have we left out
of the READMEs?).

Or if you really want to help others in your boat and you want a
solution now dammit...write a script (in perl, using CPAN modules:)
that watches a local CPAN for new modules, then grabs the POD, runs
pod2html, and puts the pages on your website including keyword
searching and hyperlinks between various pages.

dan

William R. Ward (hermit@cats.ucsc.edu) said:
: 
: Maybe I'm just missing something here, but I find CPAN to be a total
: pain in the ass to browse.  If I access the module list I am unable to
: find any documentation or detaile descriptions of the modules.  It
: seems to me that the package name should be a hyperlink to that
: package's manpage.  If I go to the author's page I can usually find
: the docs I'm looking for but it's awkward to do it that way.
: 
: Who maintains the CPAN web interface that I see mirrored all over the
: place and how can I get him/her to change this?

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Wed, 05 Nov 1997 11:03:48 +0000
From: Jedi Master Yoda <yoda@dagoba.org>
Subject: Re: crontab -l reformating (Reinvent the wheel?)
Message-Id: <34605294.66FF@dagoba.org>

Martien Verbruggen wrote:
> 
> In article <63nbgu$jdv@suriname.earthlink.net>,
>         bodhi1@nonamesleft.com (bodhi1@nonamesleft.com) writes:
> > I am looking for any Perl scripts that will allow me to take the output of
> > crontab -l and format it into something that is readable by normal human
> > beings. It would be ideal if it would put it into a .html format.
> 
> In what way is the output of 'crontab -l' not human readable? I am perfectly
> capable of reading it, and I am not an alien...

He said 'normal' human beings...

What would be nice would be a script that takes crontab -l and outputs:

On the 1st of every month, at 9.15am: /home/admin/foo.sh
At 2 minutes past every hour, between 9am and 6pm: /home/admin/bar.sh
Every Thursday morning at 6am: /home/admin/baz.sh
&c.

There's something to while away the long winter evenings with...


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

Date: 5 Nov 1997 10:40:54 GMT
From: ee95195@tom.fe.up.pt (Nuno Gomes)
Subject: ExecCGI
Message-Id: <63pifm$1vb@news.fe.up.pt>

Apache error message when i tried to run a script that handles a form and creates & save files - " ExecCGI off in this directory "
And yes i'm new at perl cgi progaming...what i'm doing wrong?

--
     //////  //////  //  //     //   //      //////      Nuno Gomes 
    //	//  //      //  //     //  // //    //  // 
   //////  //////  //  //  // //  //////   //////   www.psynet.net/psiwar
  //          //  //  // //////  //   //  // //
 //      //////  //  ////  ///  //    // //   //      psiwar@psynet.net
 


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

Date: Sun, 02 Nov 1997 15:35:50 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Hussein <hussein@vt.edu>
Subject: Re: file locking on win95
Message-Id: <345CF236.290508E0@mail.uca.edu>

Hussein wrote:
> 
> hi
> 
> i am trying to convert a set of perl scripts from a unix machine to
> win95. however, the original code uses a lot of file locking and i've
> just found out that flock is only available on NT. is there any other
> way i can go about locking files ?
> 
> thanx
> 
> ttfn
> 
> hussein

No. (at least not to my knowledge). However, you can always create a
dummy file when you want to flock your file, delete it when you want to
unlock, and check for the existance of that dummy file when you need to
find out whether "flock" has been invoked or not. This is probably the
same thing as the Win32::Semaphore module, but I don't haven't used the
latter, and the former works just fine for my applications.

Cameron Dorey
camerond@mail.uca.edu

OT: Why are the Hokies going through their famous Self-Destruct Drill
*again* this season? It's getting a little old (about 28 years worth for
me, so far and _still_ counting).


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

Date: 5 Nov 1997 05:56:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FileHandle->flush not working (?)
Message-Id: <63p1q3$4ga$1@comdyn.comdyn.com.au>

In article <wk7maodsfa.fsf@auckland.ac.nz>,
	Worik Macky Stanton <w.stanton@auckland.ac.nz> writes:
> Friends
> 
> The following code does not work as I would expect.
> 
>     $self->{logfile}->print($line);
>     $self->{logfile}->flush;

Is flush a method? Try using flush(). Are you running perl with the -w
flag?

> In that the file is not flushed.  All the infomation is in the file
> after I kill the programme with a ^c, but not there while it runs.

You have forgotten to tell us what $self is... If it is a FileHandle
object, the documentation for FileHandle (perldoc FileHandle) doesn't
mention any flush() method, but then, it might be inherited (from
IO::Handle?).

Anyway, if it is a FileHandle, and if it indeed inherits the flush
method from IO::Handle, you should call it as

$self->flush;

If $self is an object that holds a reference to a FileHandle object in
$self->{logfile} then it should work. What does ref($self->{logfile}) 
return?

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: Wed, 05 Nov 1997 09:20:27 +0000
From: Pat Neave <patneave@anti-spam.com>
Subject: Getting bash history in Perl scripts
Message-Id: <34603A5B.2016@anti-spam.com>

Hi,

I would like to write a Perl script to display the command history saved
by the bash shell. Problem is that `history` is a bash internal command
so using history in back ticks fails with command not found.
Alternatively using history in a shell script means that a new instance
of the shell is run with a new history list.

Anyone know of an elegant solution to the problem, I would rather not go
through the "saving the history to a temp file and then reading it into
the Perl script" route as there must be a better way.

Thanks 

Pat
-- 
-    Patrick Neave                     Tel No +44 (0) 1666 833723    -
-    Lucent Technologies               Fax No +44 (0) 1666 832925    -
-    Chippenham, England.              mailto:patneave@lucent.com    -
-            To reply anti-spam ==> lucent in return address         -


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

Date: Wed, 5 Nov 1997 10:19:01 -0000
From: "A Farrow" <a.n.farrow@cranfield.ac.uk>
Subject: HELP : Setting an Environment Variable/ERRORLEVEL in PERL for NT
Message-Id: <346039d2.0@news.cranfield.ac.uk>


Dear All,
Does anybody know how I can set a WINNT Environment Variable
from within PERL 5 for NT? I can get the listing using $ENV
but I do not appear to be able to change it.

Alternatively, does anybody know how to raise an ERRORLEVEL
that can be tested from a batch file.

Regards,
    Anthony Farrow
a.n.farrow@cranfield.ac.uk




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

Date: 5 Nov 1997 05:59:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: NT/ Reading command output
Message-Id: <63p20q$4ga$2@comdyn.comdyn.com.au>

In article <345E6B16.7D4F@beasys.com>,
	"Vernon E. Peets" <vernon.peets@beasys.com> writes:
> I'm converting a script from Unix to NT, in it several external
> commands are used but the output is not being picked up on NT.

Does the command you're using in the pipe write to standard output? Or
does it by any chance write to standard error?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Wed, 05 Nov 1997 00:25:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: pattern matching options
Message-Id: <comdog-ya02408000R0511970025220001@news.panix.com>

In article <34601106.24AF@swbell.net>, tr7488@swbell.net wrote:

>Does anyone know if you can substitute a variable for a pattern matching
>option?  For example:

>if ( $word =~ /$expr/$OPTION) { print $word; } 

how about something like:

   #!/usr/bin/perl
   
   my $word    = 'welcome';
   my $pattern = 'com';
   my $option  = 'i';
   
   my $result;
   eval( "\$result = (\$word =~ m/$pattern/$option)" );
   
   print "It worked!\n" if $result;
   
   __END__

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 05 Nov 1997 00:48:17 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: pattern matching options
Message-Id: <346016B1.33F3DFB@gpu.srv.ualberta.ca>

Todd Reichert wrote:
> 
> Does anyone know if you can substitute a variable for a pattern matching
> option?  For example:
> 
> $OPTION = "i";
> $word = "welcome";
> $expr = "com";
> if ( $word =~ /$expr/$OPTION) { print $word; }
> 

try that last line as:

if ($word=~/(?$OPTION)$expr/){print $word}

or you could try:
 
$expr = "(?i)com";
print $word if $word=~/$expr/;

search for (?imsx) in the perlre manpage.

regards
andrew


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

Date: 05 Nov 1997 10:21:50 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Perl file sort
Message-Id: <iswwinr901.fsf@godzilla.kiere.ericsson.se>

HChicowitz@aol.com writes:

> Any suggestions?

Yes. Read the FAQ before you post.

-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: Wed, 5 Nov 1997 09:13:01 -0000
From: "Steve Crook" <steve_crook@mtits.co.uk>
Subject: Re: Perl->Java? Java->Perl? Gaaaaa!
Message-Id: <63pdhv$p8r@guardhouse.mti.co.uk>


You could have a look at http://www.oroinc.com/products/index.html

There may be something there that you can use ?

Steve





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

Date: Wed, 5 Nov 1997 07:20:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: print aound matched line
Message-Id: <ebohlmanEJ5wE7.6qB@netcom.com>

Tad McClellan (tadmc@flash.net) wrote:
: Michael Hammernik (mhammer@execpc.com) wrote:
: : I'm having trouble finding a way to match a line and then print the line
: : above, the matched line and the line below. I've been browsing through
: : the llama, the camel and the panther without finding what I need. 
: : Thanks in advance for any assistance given.


: while (<>) {
:    if ( /match me/ ) {
:        print $prev;       # print the line before
:        print;             # print the line
:        print scalar(<>);  # read and print the line after
:                           # line after better BE there (ie. problem if
:                           # 'match me' is on the last line...

:    }
:    $prev = $_;  # remember the previous line
: }

This won't correctly handle matches on consecutive lines because the 
"line after" never becomes the current line.  I'd try something like:

 while (<>) {
    my $p=$prev;
    $prev=$_;              #current line should always be previous line
                           #on next iteration
    if ( /match me/ ) {
        print $p;          # print the line before
        print;             # print the current line
        if (defined ($_ = <>)) { #read the next line and print if present
            print;
            redo;	  #will be current line on next iteration 
        }
    }
 }



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

Date: Tue, 04 Nov 1997 23:14:42 -0600
From: Sgt Friday <ziggy2@enid.com>
Subject: Stoopid Question ???
Message-Id: <346000C2.44C7@enid.com>

I am trying to run a CGI script on WIN95. How do I use the "chmod"
command? Forgive me if this is a really dumb question, but I have read
the FAQ's to no avail. Any advice, or URL's to get me headed in the
right direction would be appreciated greatly!
SGT FRIDAY
ziggy@2enid.com


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

Date: 5 Nov 1997 01:11:02 -0600
From: psamuels@sampo.creighton.edu (Peter Samuelson)
Subject: Re: Stoopid Question ???
Message-Id: <63p666$7nq$1@sampo.creighton.edu>

--xxxxx
Content-Type: text/plain

Wrong newsgroup.  comp.infosystems.www.authoring.cgi or some such.

[Sgt Friday  <ziggy2@enid.com>]
> I am trying to run a CGI script on WIN95. How do I use the "chmod"
> command? Forgive me if this is a really dumb question, but I have
> read the FAQ's to no avail. Any advice, or URL's to get me headed in
> the right direction would be appreciated greatly!

To my knowledge Win95 has neither a chmod command nor a web server.  It
does have ATTRIB.EXE and a web browser (sort of).  CGI scripts
generally run best under CGI, i.e. a web server.  If you wanted to make
a script executable, you pretty much have to rely on file types,
i.e. file extensions.  These can be adjusted in the Explorer,  menu
View->Options->File Types.

-- 
Peter Samuelson
<psamuels at sampo.creighton.edu>
--xxxxx
Content-Type: text/html

<P>This post is best viewed with a <I>real newsreader</I>.
--xxxxx--


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

Date: 5 Nov 1997 05:42:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: trouble with 'application/octet-stream' script
Message-Id: <63p10f$4c4$1@comdyn.comdyn.com.au>

In article <MPG.ec7b60790f127ff989681@news.pcnet.com>,
	eriks@haestad.com (Erik Symonds) writes:

> I am trying to create a script in PERL that will send the contents of a 
> binary file when called from a form.  It seems to 'work' with the 
> exception being that the name of the file that I am sending is not being 
> displayed. Is there a header, or other method, that I can use to send a 
> name to the browser to use upon bringing up the save dialog box?

This is not really a question about perl. You will probably have a lot
more success if you ask this question on one of the
comp.infosystems.www.* newsgroups. The people there are discussing
issues that have to do with the WWW, HTTP, HTML and CGI. The people
here mainly are interested in perl.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: Wed, 05 Nov 1997 17:38:58 GMT
From: Venice @ euronet.nl (Patrick)
Subject: Upload NS2.0+ - A network error ocured while netscape was sending data ?
Message-Id: <63pbe0$rg0$1@news.NL.net>

I want to use the upload fucnction from NS 2.0+
(multipart/form-data)

I have trouble getting the upload fuction to work.

I downloaded 2 different scripts from the net which supposed to be
able to retrieve the uploaded file (both perl 5+ scripts).

Both give a network error "while sending data"

I've been able to make 1 script send 1200 bytes, then it quit with the
same error.

If someone has a working version or knows where i go wrong,
please share it with me :-)


All i need is a script that decodes the data to a file.

Thanx in advance,

Patrick




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

Date: Wed, 05 Nov 1997 10:57:40 +0100
From: Kristian Halle <krist@oslo.sgi.com>
Subject: Yet another gethostbyaddr question
Message-Id: <34604314.98E924BA@oslo.sgi.com>

I'm trying to get the hostname of the machine accessing my cgi script.
This is the code I'm using (found somewere on the net), but it doesn't
work. The $remoteaddr gets the correct value, but $remotehost becomes
empty. 

$remoteaddr = $ENV{'REMOTE_ADDR'} ;
$remotehost = (gethostbyaddr($remoteaddr, AF_INET))[0];

Does anyone know why this doesn't work ? I guess I could use something
like 

system("host $remoteaddr") ;

and parse the output, but what is the *easiest* and correct (well, I
guess there is no correct way in perl) to get the hostname ?

-- 
Kristian Halle
krist@sgi.no


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

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

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