[7295] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 920 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 25 21:17:20 1997

Date: Mon, 25 Aug 97 18:00:36 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 25 Aug 1997     Volume: 8 Number: 920

Today's topics:
     Re: "-T" problem after building 5.0004_01 (Randy J. Ray)
     Re: Calculating Days between two dates!! (Stephen P Lee)
     Calling another PERL script <nick@wireedm.com>
     cdk.h missing for CDK module? (Nigel Reed)
     CGI timing out problem kchadha@hotmail.com
     DB_File->push() on an EMPTY (new) file (DB_RECNO)  ??? (James L. McGill)
     defunct process after using open2() <apage@ml.com>
     Re: Easy Question: Dont Care. <petri.backstrom@icl.fi>
     Executing Java App from Perl lbj_ccsi@atl.mindspring.com
     Extensions <nick@wireedm.com>
     getservbyport does't work for me ?! (Sascha Ottolski)
     grep filelist for value <nospam.gibsonc@aztec.asu.edu>
     Re: grep filelist for value (Josh Purinton)
     Re: HELP! WinNT/perl cgi newbie (Matthew Cravit)
     Re: homepage maker needed <MELTON@PITNET.NET>
     Re: How do I drop trailing spaces? <rootbeer@teleport.com>
     Re: How to implement a settings file? (Michael Schuerig)
     Re: How to implement a settings file? (Daniel E. Macks)
     Re: Install Oraperl - help (John D Groenveld)
     Is this a permissions problem <jaydee@worsdall.demon.co.uk>
     Re: Is this a permissions problem (Jot Powers)
     Re: last line of a @list... (Craig Berry)
     Re: last line of a @list... <rootbeer@teleport.com>
     Re: logging source via cgi ??? <rootbeer@teleport.com>
     Re: Need Help with bidirectional sockets (Chip Salzenberg)
     Re: NNTPClient Module <serginho@mail.serve.com>
     Re: Parsing multiple arguments with Perl (Jeremy D. Zawodny)
     Re: Parsing multiple arguments with Perl (Alastair)
     perl bug in pushing anonymous arrays?? <ceh@suntan.sce.carleton.ca>
     Re: Perl on NT udefined subroutine call (Jeremy D. Zawodny)
     Re: Perl Performance FAQ? (Gurusamy Sarathy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 25 Aug 1997 16:21:49 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: "-T" problem after building 5.0004_01
Message-Id: <uowoh6laooy.fsf@tremere.ecte.uswc.uswest.com>

>>>>> "Raymond" == Raymond W Yu <rayyu@cup.hp.com>
>>>>> wrote the following on Tue, 19 Aug 1997 10:57:03 -0700

  Raymond> After building 5.0004_01, everything works except the "-T"
  Raymond> option.

  Raymond> % perl -c hello.pl Too late for "-T" option at hello.pl
  Raymond> line 1.

By running perl directly, it encounters the -T option after it has already
started parsing the code. If you just ran hello.pl, it would still work fine.
"perl -Tc" will also work fine.

Running with -T under the debugger is a recipe for frustration. You can't
dump data because the commands are passed to eval straight from STDIN and thus
considered tainted.

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
                Denver, CO                                     rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin


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

Date: 25 Aug 1997 20:45:01 GMT
From: splee@sfu.ca (Stephen P Lee)
Subject: Re: Calculating Days between two dates!!
Message-Id: <5tsqsd$ajd$1@morgoth.sfu.ca>

Is there a script or module that can convert between Julian and Lunar
(Chinese or Asian) dates?

Thanks,
Stephen


In article <33f718bd.2274949@news-in.anc.net>,
Network Operations Center <noc@REMOVEarkansas.net> wrote:
>I always like to keep these types of calculations simple:
>
># !/usr/bin/perl
>#
>require "timelocal.pl"
>
>$DAY_SECONDS = 60 * 60 * 24;
>
>$start_day = 1;
>$start_month = 0;
>$start_year = 97;
>
>$end_day = 15
>$end_month = 0;
>$end_year = 97;
>
>$start_time = &timelocal(0,0,0,$start_day,$start_month, $start_year);
>$end_time = &timelocal(0,0,0,$end_day,$end_month,$end_year);
>
>$diff = $end_time - $start_time;
>
>print $diff / $DAY_SECONDS, "\n";
>
>
>Basically, calculate the number of seconds between your two dates and
>then divide that number by the number of seconds in a normal day.  The
>result is the number of days between your two dates.
>
>Hope that helps!
>
>On 17 Aug 1997 18:49:24 GMT, maliksm4@aol.com (MALIKSM4) wrote:
>>Hello,
>>
>>I was trying to use the subroutine julian_day from the module Julianday.pm
>>but have a problem. I am not sure how to pass the parameters, year, month
>>and date to this routine. I tried passing parameters like 1997 for year,
>>02 for month and 03 for date but got a very weird result. (something in
>>decimals).
>>
>>Could someone assist me.? Basically I was tring to calculate the # of days
>>between two dates.
>>
>>Thanks.
>


--
Stephen P. Lee					Office: (604) 291-4291
Department of Biological Sciences		Fax: (604) 291-3496
Simon Fraser University				E-mail: Stephen_p_lee@sfu.ca
Burnaby, BC, Canada. V5A 1S6


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

Date: Mon, 25 Aug 1997 15:37:53 -0700
From: John Grimm <nick@wireedm.com>
Subject: Calling another PERL script
Message-Id: <34020941.5B04@wireedm.com>

How do I call another Perl script from another Perl script and pass
arguments to it?


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

Date: 25 Aug 1997 20:54:00 GMT
From: nigelr@convex.hp.com (Nigel Reed)
Subject: cdk.h missing for CDK module?
Message-Id: <5tsrd8$m6j$1@news.rsn.hp.com>

Hi there,

I'm trying to compile the cursors development kit and have a
problem whereby cpp cannot find cdk.h, neither can I when I
do a find for it! I've tried both 4.7.0 and 4.8 both with the
same results.

Any ideas would be appreciated.
Compiling on a HP 7xx with 9.05. Using perl 5.004_01.

Regards
nigel


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

Date: Mon, 25 Aug 1997 17:22:01 -0600
From: kchadha@hotmail.com
Subject: CGI timing out problem
Message-Id: <872547514.22931@dejanews.com>

My CGI script needs to execute a subroutine
which takes a long time to run- this causes
the browser to time out. To avoid this,
I fork a process, let the child process
execute the subroutine and let the parent
keep printing "wait" until the child is done.
The problem is that while it runs fine
from the command line, from the browser,
it saves up all the "wait" statements until
teh subroutine has finished and then prints
them all together. This problem remains even if
I flush out the buffer. Any ideas on how
to force the web browser to print even while
teh routine is executing ?
Or any other way to avoid the timeout issue ?

Please e-mail answers to kchadha@hotmail.com

Thanks!

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 25 Aug 1997 16:00:51 -0500
From: fishbowl@fotd.netcomi.com (James L. McGill)
Subject: DB_File->push() on an EMPTY (new) file (DB_RECNO)  ???
Message-Id: <5tsrq3$oh5$1@fotd.netcomi.com>

If I open a file with:

use Fcntl;
use DB_File;

$File = tie( @records, 'DB_File', "file.name", O_RDWR|O_CREAT|O_NDELAY, 0644, $DB_RECNO );

And that has *created a new* file,

and then I:

$File->push("New Record Here");

The process just hangs and eats up 99% CPU.
Same code works, if I first create the file,
even if it is a zero-byte file.

Is this a bug, or did I miss something?


--
g-r-a-t-e-f-u-l-l-y---[   email:<fishbowl@conservatory.com>   ]---l-i-v-i-n-g
d-e-a-d-i-c-a-t-e-d---[     http://www.conservatory.com/      ]-----l-i-g-h-t
Linus' Law: There is no heavier burden than a great potential.


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

Date: Mon, 25 Aug 1997 15:19:28 -0400
From: Alan Page <apage@ml.com>
Subject: defunct process after using open2()
Message-Id: <3401DAC0.A41B1A38@ml.com>

Does anyone know the proper way to close the process started when using
open2()?
I tried killing the process, closing each handle and I still end up with
a defunct process.
Thanks




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

Date: Mon, 25 Aug 1997 14:00:22 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Easy Question: Dont Care.
Message-Id: <340165C6.6F8E@icl.fi>

Michael W Peterson wrote:
> 
> On 25 Aug 1997 03:23:45 GMT,
>  the Thief of Always <omard@blue.seas.upenn.edu> wrote:
> >
> >whats the dont care variable as in.
> >
> >($wanted, ______I DONT GIVE A SHIT ___) = split (/&/,$_);
> 
>  ($wanted, undef) = split (/&/,$_);
> 
> and since you're splitting $_ you could even:
> 
>  ($wanted, undef) = split /&/;

Or better yet just

   $wanted = ( split /&/ )[0];

If you only need one value from split, then
take just that one value.

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Mon, 25 Aug 1997 15:38:39 -0600
From: lbj_ccsi@atl.mindspring.com
Subject: Executing Java App from Perl
Message-Id: <872540713.16478@dejanews.com>

I am having trouble getting Perl to execute a Java App.  The following is
my code:

#!E:\Perl\bin\perl -w

# Execute a Command Line Command
$name     = "lenniej";
$password = "passwd";
$domain   = "3mc.com";
$fullName = "Lennie Jarratt";

$return = system "D:\\VisualCafePro\\Java\bin\\java.exe NewAccount
\"$name\" \"$password\" \"$domain\" \"$fullName\""; print "Return:
$return \n";


The error I get is Bad command or file name.  I can run the java app from
the command line and it runs so my paths are correct.

Any suggestions?

Thanks,

Lennie

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Mon, 25 Aug 1997 15:14:12 -0700
From: John Grimm <nick@wireedm.com>
Subject: Extensions
Message-Id: <340203B4.71D8@wireedm.com>

How can I see if a file has a .tec extension?


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

Date: 25 Aug 1997 19:20:11 GMT
From: sascha@alzhimer.isdn.cs.tu-berlin.de (Sascha Ottolski)
Subject: getservbyport does't work for me ?!
Message-Id: <5tsltb$d58$1@news.cs.tu-berlin.de>

Hi,

I could see that other people do have problems with this as well, but I 
couldn't figure out a solution. The problem is, getservbyname doesn't return
me an answer. I've seen a suggestion to use pack(), but this didn't help 
either. I'm using perl.5_003.

A script like this

#!/usr/bin/perl -w

$number=23;
($name,$alias,$port_number,$protocol_name)=getservbyport($number,"tcp") ;
print "name: $name\nalias: $alias\nport: $port_number\nprotocol: $protocol_name\n";

gives my this result:

warning: setlocale(LC_CTYPE, "") failed.
warning: LC_ALL = "ISO-8859-1", LC_CTYPE = "ISO-8859-1", LANG = "DE",
warning: falling back to the "C" locale.
Use of uninitialized value at ./getserv.pl line 5.
Use of uninitialized value at ./getserv.pl line 5.
Use of uninitialized value at ./getserv.pl line 5.
Use of uninitialized value at ./getserv.pl line 5.
name: 
alias: 
port: 
protocol: 

Thanks in advance for any hint,

Greetings Sascha


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

Date: Mon, 25 Aug 1997 12:28:08 -0700
From: Gip <nospam.gibsonc@aztec.asu.edu>
Subject: grep filelist for value
Message-Id: <3401DCC8.2622@aztec.asu.edu>

How should I find the list of files to process that contain a string?

Currently I look at all of 'em:

  while ($insFileName = glob($inspectFiles)) {
    :
  }

but what I want to do is fileter the $inspectFiles first for the string
in $str.

Thanks for your time.
CG


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

Date: 25 Aug 1997 14:01:37 -0700
From: joshp@silmaril.com (Josh Purinton)
Subject: Re: grep filelist for value
Message-Id: <5tsrrh$9up$1@shell3.ba.best.com>

[ posted and mailed ]

The one and only Gip <nospam.gibsonc@aztec.asu.edu> writes:

> How should I find the list of files to process that contain a
> string? Currently I look at all of 'em:
>  while ($insFileName = glob($inspectFiles)) {
>    :
>  }
> but what I want to do is fileter the $inspectFiles first for the
> string in $str.

On Unix, it's fastest to use backquotes to read the output of
'grep -l', which prints only the names of files with matching lines:

my @files = `grep -l $str $inspectFiles`;
chomp @files;
foreach $insFileName (@files) {
	...
}

Otherwise, you'll have to write grep -l in Perl:

@files = grep contains($_, $str), glob($inspectFiles);
foreach $insFileName (@files) {
        ...
}
sub contains {
        my($file, $str) = @_;
        local $_;
        open F, $file or die "couldn't open $file: $!";
        my $found = 0;
        my $code = "
                while(<F>) {
                        \$found = 1, last if /$str/o;
                }
        ";
        eval $code;
        close F;
        die $@ if $@; # propagate exceptions, shouldn't happen
        return $found;
}

Hope this helps.

--Josh


--
Josh Purinton <joshp@silmaril.com>
	
That which can be said to deceive
	can also be said to enchant. -- Plato


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

Date: 25 Aug 1997 13:03:10 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: HELP! WinNT/perl cgi newbie
Message-Id: <5tsodu$5n5$1@shell3.ba.best.com>

In article <mblase-2508971350110001@mblase.ncsa.uiuc.edu>,
Marty Blase <mblase@ncsa.uiuc.edu> wrote:

>- what do filenames look like? (Just C:\dir\dir\file.txt, right?)

No. Since the "\" character is a special one in Perl, you need to double
it to produce an actual "\". So:

	$foo = "C:\\dir\\dir\\file.txt";

>- what's the NT equivalent of sendmail, and how to I call it?

There isn't one built in; there are a number of shareware/freeware 
programs you can use to send mail from Perl. I don't have any direct
experience with any of them, but I'm told blat.exe works pretty well.
Try searching the web for it.

>- what do I put at the top instead of #!/usr/local/bin/perl ?

#!/usr/bin/perl, I think, although as long as it mentions perl, I don't
think it matters. (NT runs perl scripts based on the file extension, not
the shebang-magic that UNIX uses.)

/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: Mon, 25 Aug 1997 17:12:58 -0500
From: "April D. Melton" <MELTON@PITNET.NET>
To: Chris Allen <chrisall@dtc.net>
Subject: Re: homepage maker needed
Message-Id: <34020369.22EE47DA@PITNET.NET>

Today is August 25, 1997. If you are stillinterested in a good "home Page"
maker, please visit Celebration Central at
http://www.corenet.net/melton/CC/index.html. There you can see how my modified
"home page" maker works. This script has some special functions: 1.) allows the
creator to send & recieve "bind" postcards from the page, 2.) allows you to
select background colors, 3.) import graphics from other sites & 4.) includes a
map linking function. If you like it, I'll make it available for download.

Sincerely,
April D. Melton
Melton's Remarketing Services
http://www.corenet.net/melton/bizpage/bizpage.html


Chris Allen wrote:

> I need to find a free home page maker that I can put on my web site. Do any
> one have any suguestion.
>
> Please send a message to cyo@cyo.org





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

Date: Mon, 25 Aug 1997 14:17:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Jeremy D. Zawodny" <zawodny@hou.moc.com>
Subject: Re: How do I drop trailing spaces?
Message-Id: <Pine.GSO.3.96.970825141316.20980G-100000@julie.teleport.com>

On Mon, 25 Aug 1997, Jeremy D. Zawodny wrote:

> On 25 Aug 1997 11:37:57 +0200, robert@ICK.il.fontys.nl (robert) wrote:
> 
> >bernard510@hotmail.com:
> > >How can I replace the contents of $name with the text 
> > >string without the trailing spaces?
> >
> >How about:
> >$name =~ s/\s*$//;
> 
> Or chomp($name);

I don't think you meant that! Maybe you meant one of these.

    $name =~ s/ +\Z//;		# What was requested

    $name =~ s/\s+$//;		# What may have been desired

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 26 Aug 1997 00:47:25 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Re: How to implement a settings file?
Message-Id: <19970826004725220614@rhrz-isdn3-p4.rhrz.uni-bonn.de>

Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:

> On Mon, 25 Aug 1997 12:35:40 +0200, uzs90z@uni-bonn.de (Michael
> Schuerig) wrote:
> 
> >I want to move the configurable settings of a script to a separate file,
> >but can't sort out how to do it. I played around with require and
> >Exporter, without success, though.
> 
> There are some useful modules on CPAN for this:
> 
>   http://perl-com.songline.com/CPAN-local//CPAN.html#option
> 
> As usual, CPAN is your friend. :-)

CPAN can be a complicated friend. I checked out the modules and they do
much more than I need. All I want is to put something like

    my $greeting = 'Hi Michael!';

in a separate file that gets read in by the main script. I'm rather sure
that this must be trivial -- nonetheless I don't know how to do it.

Michael

--
Michael Schuerig                 When each word is read, would you know
mailto:uzs90z@uni-bonn.de           the difference if nothing was said?
http://www.uni-bonn.de/~uzs90z/             -Kansas, "Hopelessly Human"


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

Date: 25 Aug 1997 23:03:22 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: How to implement a settings file?
Message-Id: <5tt2vq$l9s$1@netnews.upenn.edu>

Michael Schuerig (uzs90z@uni-bonn.de) said:
: 
: I want to move the configurable settings of a script to a separate file,
: but can't sort out how to do it. I played around with require and
: Exporter, without success, though.

How 'bout the following? To use these configs, just put a 'require
myconfig' the script, and then access the variables as $myconfig::foo
or @myconfig::bar or whatever. Be careful to restrict who can change
myconfig.pm:)

=== file myconfig.pm ===
package myconfig;

$foo='biff';
@bar=('biz','baz');

1;   # in case the last variable is false
===

dan

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



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

Date: 25 Aug 1997 16:06:14 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Install Oraperl - help
Message-Id: <5tsojm$gc$1@tholian.cse.psu.edu>

In article <33EB9234.41C6@spso.gsfc.nasa.gov>,
Truong Le  <tle@spso.gsfc.nasa.gov> wrote:
>I tried to install oraperl v2.4 with perl5.004, oracle v7.1.4
Run, don't walk back to CPAN and fetch DBI/DBD-Oracle. It includes
Oraperl.pm, the oraperl emulator, and will build with the latest versions
of Perl and Oracle.
Happy Oraperl'ng
John
groenvel@cse.psu.edu


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

Date: Mon, 25 Aug 1997 23:46:02 +0100
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Is this a permissions problem
Message-Id: <j9SUoAAqsgA0Ewv3@worsdall.demon.co.uk>

Hi, first let me say my perl books are ordered and on there way, in the
meantime can I have a little bit of help.

I have a script to read a given file passed by our server (for test
purposes I am using the variable $visitorshome to store the name and
path of the file to be read) and out it to the mail program. i.e. I am
attempting to mail web pages to myself.

Now I have got the mail part working a treat, I just can't get the file
read in and then out to the mail program. When I first wrote the script
and tested locally it seemed to work and worte the web page to a file I
opened under the handle MAIL.

But it is not working when on the server, no errors a reported when ran
but when run with the -w I get:-

Read on closed filehandle <HTML> at ./jd.pl line 138.

Which I guess means that it failed to open the file, but did it fail to
open as it did not have access to open it?

Here is part of the script just in case anyone can spot the obvious.


# With the variable $visitorshome set to either of these:-
# $visitorshome = 'file:C:\\Homepage\\WorsdallWEB\\startup.html';
# $visitorshome = 'http://www.worsdall.demon.co.uk/goto-ssi.html';

# Open The Mail Program
open(MAIL,"|$mailprog -t");

# have put mail header stuff To:, From: and Subject: in here

print MAIL "Today: $date\n\n";
print MAIL "-" x 75 . "\n\n";

# Put givem html file in here
# by reading the file into a buf and out to the MAIL file handle
# 
open (HTML, "<$visitorshome");
while (<HTML>) {
      $size = -s HTML;
      $size = 1024 if ($size < 512);
      $buf = '';
      while(defined($r = read(HTML,$buf,$size)) && $r > 0) {
            if (syswrite (MAIL,$buf,$r) != $r) {
                         close HTML;
            }
      }
}

print MAIL "-" x 75 . "\n\n";
close (MAIL);


-- 
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydee@worsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmaster@shadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: 25 Aug 1997 23:08:26 GMT
From: news@bofh.com (Jot Powers)
Subject: Re: Is this a permissions problem
Message-Id: <5tt39a$mb$1@gazette.corp.medtronic.com>

In article <j9SUoAAqsgA0Ewv3@worsdall.demon.co.uk>, Mark Worsdall wrote:
>Hi, first let me say my perl books are ordered and on there way, in the
>meantime can I have a little bit of help.
>
>But it is not working when on the server, no errors a reported when ran
>but when run with the -w I get:-
>
>Read on closed filehandle <HTML> at ./jd.pl line 138.

>Which I guess means that it failed to open the file, but did it fail to
>open as it did not have access to open it?

That sounds likely.

>Here is part of the script just in case anyone can spot the obvious.
>
>
># With the variable $visitorshome set to either of these:-
># $visitorshome = 'file:C:\\Homepage\\WorsdallWEB\\startup.html';
># $visitorshome = 'http://www.worsdall.demon.co.uk/goto-ssi.html';
>
># Open The Mail Program
>open(MAIL,"|$mailprog -t");

open(MAIL,"|$mailprog -t") or die "Error opening $mailprog: $!";

>
># have put mail header stuff To:, From: and Subject: in here
>
>print MAIL "Today: $date\n\n";
>print MAIL "-" x 75 . "\n\n";
>
># Put givem html file in here
># by reading the file into a buf and out to the MAIL file handle
># 
>open (HTML, "<$visitorshome");

open(HTML,"<$visitorshome") or die "Error opening $visitorshome: $!";

>while (<HTML>) {
>      $size = -s HTML;
>      $size = 1024 if ($size < 512);
>      $buf = '';
>      while(defined($r = read(HTML,$buf,$size)) && $r > 0) {
>            if (syswrite (MAIL,$buf,$r) != $r) {
>                         close HTML;

			close(HTML) or die "Close HTML error:$!\n";

>            }
>      }
>}

I'm not sure what you're trying to do with this though.  You're going
through the HTML filehandle, but then you're making sure it's non-zero
size and not doing anything with it.

Someone else with more of a clue will have to help here.  :)

>
>print MAIL "-" x 75 . "\n\n";
>close (MAIL);

close(MAIL) or die "Error closing MAIL handle: $!";

So, make sure you have a die with every open and close, and include
$! to see why it failed.  Let us know if that helps.

-Jot "Why lurk when you can spout wrong advice and learn from it" Powers
-- 
Jot Powers  news@bofh.com
Unix System Administrator
"Sometimes you just have to grab the bull by the tail and face the situation."


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

Date: 25 Aug 1997 18:55:06 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: last line of a @list...
Message-Id: <5tskea$mlg$1@marina.cinenet.net>

Bert ten Cate (bert@arsnova.xs4all.nl) wrote:
: I'm new to perl and have a question that might sound stupid, but I'm stuck so
: here it goes...
: 
: I need to get the last line of @list into $lastline. Does anybody know how to
: do this? Any help is appriciated...

I assume by 'line' you mean 'element':

  $lastline = $list[-1];

Hope this helps!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Mon, 25 Aug 1997 14:13:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bert ten Cate <bert@arsnova.xs4all.nl>
Subject: Re: last line of a @list...
Message-Id: <Pine.GSO.3.96.970825141213.20980F-100000@julie.teleport.com>

On 23 Aug 1997, Bert ten Cate wrote:

> I need to get the last line of @list into $lastline. 

Do you mean the last element of @list?

	$lastline = $list[-1];		# Fetch last element.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 Aug 1997 16:57:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "David J. Thomas" <thomasdj@wam.umd.edu>
Subject: Re: logging source via cgi ???
Message-Id: <Pine.GSO.3.96.970825164653.24449D-100000@julie.teleport.com>

On Sun, 24 Aug 1997, David J. Thomas wrote:

> I need to simply log the url of each page to a logfile at my internal
> web.  So when a page is hit... it automatically appends a log file with
> the name of that url. 

Your webserver probably does this by default.

> I am using a hidden form, with javascript, and calling a cgi-script to
> do this.  Only problem is... the cgi-script has to return a page. I
> don't want to return anything.  

I think that the CGI specification may tell you something useful.

    http://hoohoo.ncsa.uiuc.edu/cgi/

> #!/usr/bin/perl

What, no -w? No -T? No 'use strict'? You should include those in your
CGI script (almost) always.

>   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>   @pairs = split(/&/, $buffer);

You should really use CGI.pm. It does all of that for you.... 

>   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/~!/ ~!/g;
>     $FORM{$name} = $value;
>    }

 ...but it does it _correctly_. :-)

>    open(OUTF,">>data.txt");

Don't forget to check the return value of open.

>    print OUTF "$FORM{'data1'}\n";

Do you really want to print to the file _anything_ that somebody sends
your script? That may be what you want, but I'd be more cautious
(especially if that file might ever be read by a non-Perl program). 

Also, you may need to use flock on that file.

> #  I really don't want the following line... but... I don't think I have
> a choice unless
> #  I use SSI... Is there any other way?
>    print "Location:http://www.something.com/cgi-bin/data.txt\n\n";

If you don't want that line, don't put it in; perl won't mind. :-)  But if
you're trying to follow the CGI specification, maybe the docs, FAQs, and
newsgroups about CGI will be of more help to you than any of the Perl
docs, FAQs, and newsgroups. (I'm not trying to be unhelpful here, of
course. You seem to understand the vital Perl part of what you're trying
to do; next you need to learn the CGI part.) Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 25 Aug 1997 23:28:59 GMT
From: chip@rio.atlantic.net (Chip Salzenberg)
Subject: Re: Need Help with bidirectional sockets
Message-Id: <5tt4fr$c11$1@news1.atlantic.net>

According to "Mark J. Schaal" <mark@tstonramp.com>:
>Since sockets are filehandles they default to buffered I/O, so thus
>your data is never transmitted.  You need to set any transmitting 
>socket to autoflush.
>
>$old_fd = select(SOCK); $| = 1; select($old_fd);

Also see the autoflush method:

    use IO::Handle;
    SOCK->autoflush;

Also see SelectSaver:

    use SelectSaver;
    { my $ss = new SelectSaver 'SOCK'; $| = 1 }

-- 
Chip Salzenberg          - a.k.a. -           <chip@pobox.com>
 (Roller coaster on camera:)  "Wow, this square quarter mile
    has unbelievably good light rail transit!"  // MST3K


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

Date: 25 Aug 1997 19:29:35 GMT
From: "Sergio Stateri Jr" <serginho@mail.serve.com>
Subject: Re: NNTPClient Module
Message-Id: <01bcb18d$ad50f3c0$ca75e7c8@AFXTD_202.Autofax>

> >Hi ! I'm learning to use NNTPClient module, and in Win32 always's ok
> >(running a script in Win'95 DOS). I connect a news server and view the
help
> >results command). But, in NT under Peer Web Service, I don't see
anything.
> 
> You don't see anything?
> 
> Try adding some debugging code to your script and see how far it gets.
> Maybe a few:
> 
> print "I made it *this* far...<BR>\n";

Of course that I did this before to post the message...And, how I said
before, the array that must get the return of help() or any other method
doesn't get anything...Then there isn't what to show...

> 
> Check out the Idiot's Guide to Solving Perl/CGI Problems at:
> 
> 
> http://perl-com.songline.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html
> 
> Jeremy

Maybe you must to see this guide...

> ---
> Jeremy D. Zawodny
> WCNet Technical Geek & Web Stuff
> <URL:http://www.wcnet.org/~jzawodn/>




-- 
--------------------------------------------------------------
Sergio Stateri Jr (Serginho)
Sao Paulo (SP) Brazil
e-mail : serginho@mail.serve.com
--------------------------------------------------------------


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

Date: Mon, 25 Aug 1997 19:12:09 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Parsing multiple arguments with Perl
Message-Id: <3402d8d3.16161519@igate.hst.moc.com>

[cc'd automagically to original author]

On Mon, 25 Aug 1997 18:47:28 GMT, NOSPAMjsab@insync.net (James
Sablatura) wrote:

>Hi all,
>
>Would someone be so kind as to let me know how I can pass multiple
>arguments to a perl script.
>
>I have done one argument successfully by doing:
>http://wwww.domain.com/cgi-bin/script.cgi?arg1
>
>and arg1 is stored in argv[0], but how can I pass multiple arguments
>so that I can access them like argv[1] or argv[2]?

I believe you can separate the parts with commas ',' or ampersands
'&'. But this is really not related to Perl, so I'll suggest the HTTP
RFC as a place to get the definite answer.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Mon, 25 Aug 1997 23:30:58 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Parsing multiple arguments with Perl
Message-Id: <872551858.24940.0.nnrp-4.9e98c215@news.demon.co.uk>

In article <3402d8d3.16161519@igate.hst.moc.com>,
	zawodny@hou.moc.com (Jeremy D. Zawodny) writes:
> [cc'd automagically to original author]
> 
> On Mon, 25 Aug 1997 18:47:28 GMT, NOSPAMjsab@insync.net (James
> Sablatura) wrote:
> 
>>Hi all,
>>
>>Would someone be so kind as to let me know how I can pass multiple
>>arguments to a perl script.
>>
>>I have done one argument successfully by doing:
>>http://wwww.domain.com/cgi-bin/script.cgi?arg1
>>
>>and arg1 is stored in argv[0], but how can I pass multiple arguments
>>so that I can access them like argv[1] or argv[2]?
> 
> I believe you can separate the parts with commas ',' or ampersands
> '&'. But this is really not related to Perl, so I'll suggest the HTTP
> RFC as a place to get the definite answer.
> 
> Jeremy

If you're writing CGI scripts try using the CGI.pm
module (check CSPAN).

#!/usr/bin/perl

use CGI;

$query = new CGI;

# arg1,arg2 are passed to CGI program via submit button in HTML form
$arg1 = $query->param('arg1');
$arg2 = $query->param('arg2');

Args can be passed explicitly via ;

http://wwww.domain.com/cgi-bin/script.cgi?arg1=N&arg2=M

for whatever values N and M are passed.

Hope this helps.

Alastair


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

Date: 25 Aug 1997 15:29:06 -0400
From: Curtis Hrischuk <ceh@suntan.sce.carleton.ca>
Subject: perl bug in pushing anonymous arrays??
Message-Id: <wkd7mdaxdrx.fsf@suntan.sce.carleton.ca>

Hi.  The following two code segments are not equivelant:

================================================================
Segment #1:
      my(@item) = (ref($$redge), $rserver_entry);
      push(@ar1, \@item);

This pushes a reference to an array onto @ar1, which is what I want.

================================================================
Segment #2:
      push(@ar1, \(ref($$redge), $rserver_entry));

Segment #2 flattens the array @ar1, appending the items; it does not
create the reference to the anonymous array. Is this a bug?

Thanks

Curtis
-- 
_/ Curtis Hrischuk (PhD Cand)  "in reality that comes from above      _/
_/ ceh @ sce . carleton . ca    God is calling                        _/
_/ Carleton University          there's no bigger love                _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/


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

Date: Mon, 25 Aug 1997 19:10:39 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl on NT udefined subroutine call
Message-Id: <3401d849.16023700@igate.hst.moc.com>

[cc'd automagically to original author]

On 25 Aug 1997 09:50:12 GMT, "Vincent Martin" <vmartin@be.oracle.com>
wrote:

>I am just experiencing Perl on Windows NT and it seems that The Registry
>settings are strange.
>I installed the distribution coming with the NT resource Kit and when I try
>one of the Win32 library, I get the undefined subroutine call.
>
>Does it mean anything to you

I'd recommend that you upgrade to the current version of Perl for
Win32 at http://www.activestate.com/, which has decent support and
good documentation.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 25 Aug 1997 21:37:31 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Perl Performance FAQ?
Message-Id: <5tstur$cr3@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <5t3mae$5sg@news.service.uci.edu>,
Eric D. Friedman <friedman@uci.edu> wrote:
>Another tip I derive from a posting I saw here not too long ago:
>
>If you have a loop which will be executed many times, it may actually
>be faster if you declare 'my' variables outside of the repeated block,
>since the declaration will then only take place once.

This is not quite accurate.  `my' declarations are compile-time,
so they happen only once.  Any slowdowns you might see may be the
result of destruction of the lexical everytime through the loop (though
perl optimizes for the simple case, for non-objects).  So in practice,
it might make a difference.

`local' (which I wouldn't really call a declaration) happens at runtime,
so what you say applies there.

 - Sarathy.
   gsar@umich.edu




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

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

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