[11402] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5003 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 16:27:29 1999

Date: Fri, 26 Feb 99 13:21:25 -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           Fri, 26 Feb 1999     Volume: 8 Number: 5003

Today's topics:
        Use of uninitialized value at (eval 32) (Bill Moseley)
    Re: Use of uninitialized value at (eval 32) (Bill Moseley)
    Re: Use of uninitialized value at (eval 32) (Andrew M. Langmead)
    Re: Use of uninitialized value at (eval 32) (Bill Moseley)
    Re: Use of uninitialized value at (eval 32) (Andrew M. Langmead)
    Re: Use of uninitialized value at (eval 32) (Greg Ward)
    Re: Use of uninitialized value at (eval 32) (Bill Moseley)
    Re: Use of uninitialized value at (eval 32) (Ronald J Kimball)
    Re: Use of uninitialized value at (eval 32) (Greg Ward)
    Re: Use of uninitialized value: related question <christopher.kuhi@stud.uni-muenchen.de>
    Re: Use of uninitialized value: related question (Greg Ward)
        Use Perl to work with file <talbo008@wxs.nl>
    Re: Use Perl to work with file (I R A Aggie)
        use web cgi script output as input to my script? <phil.yeo@ukonline.co.uk>
    Re: use web cgi script output as input to my script? <mflorell@pici.com>
        uselib (Mark P.)
    Re: uselib (Ronald J Kimball)
    Re: Using PERL system call with MS IIS 4.0 derek@seeray.com
        using the perl open function <rajshreesankaran@hotmail.com>
    Re: using the perl open function <jglascoe@giss.nasa.gov>
    Re: using the perl open function (Ronald J Kimball)
    Re: using the perl open function (Larry Rosler)
        UTF-8 - Latin 1 <fge@elsamprojekt.dk>
    Re: UTF-8 - Latin 1 (Ilya Zakharevich)
    Re: UTF-8 - Latin 1 <jhi@alpha.hut.fi>
    Re: UTF-8 - Latin 1 (Greg Ward)
    Re: UTF-8 - Latin 1 (Bart Schuller)
    Re: Web Browser Setup <nospam@geniusweb.com>
    Re: What is a 'Scripting Language' (was Re: Perl, PHP,  <metcher@spider.herston.uq.edu.au>
    Re: What is a 'Scripting Language' (was Re: Perl, PHP,  <theglauber@my-dejanews.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 22 Feb 1999 08:32:53 -0800
From: moseley@best.com (Bill Moseley)
Subject: Use of uninitialized value at (eval 32)
Message-Id: <MPG.113b268faddd0d849896b3@206.184.139.132>

My program has a number of here docs and a few evals.  Is there an easy 
way to find out what line is causing this error?

Use of uninitialized value at (eval 32) line 18, <LIBS> chunk 500.

Thanks,

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Mon, 22 Feb 1999 22:56:49 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <MPG.113bf10a367b135a9896b6@206.184.139.132>

Oh thanks so much, Ronald.  This works great.

I said:
> > What is '(eval 32)' saying?  And what about '<LIBS>'.  I'm not using a
> > file handle called <LIBS>, if that's what it's saying.
> 

In article <1dnnhmh.1ij4r671yw2abgN@bay1-200.quincy.ziplink.net>, 
Ronald J Kimball says...


> (eval 32) is the 32nd execution of an eval statement.
> Anyway, I don't know any good way to debug this either.  :-(
> Hmm...  Perhaps you could do something with $SIG{__WARN__} and caller()?
> 
> 
> #!/usr/local/bin/perl
> 
> use vars qw($pack $file $line $subname $hasargs $wantarray);
> 
> $SIG{__WARN__} =
>     sub {
>         warn @_;
>         $i=0;
>         while (($pack,$file,$line,$subname,$hasargs,$wantarray)
>                = caller($i++)) {
>             print STDERR
>                 "  WARN pack='$pack' file='$file' line='$line' ",
>                 "subname='$subname'\n";
>         }
>     }
> ;
> 
> eval 'print "$foo\n"';
> __END__
> Use of uninitialized value at (eval 1) line 1.
>   WARN: pack='main' file='(eval 1)' line='1' subname='main::__ANON__'
>   WARN: pack='main' file='tmp.pl' line='18' subname='(eval)'
> 
> 

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Tue, 23 Feb 1999 13:15:43 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <F7LzI8.9oF@world.std.com>

moseley@best.com (Bill Moseley) writes:

>In article <F7KqAq.Kuq@world.std.com>, aml@world.std.com says...
>> One way that I can think of is:
>> 
>>    $SIG{__WARN__} = sub { $DB::single = 1; warn @_};
>> 
>> This will cause the debugger to break at any warnings.

>Sorry to leave out this info from the first post, but this is a cgi 
>script (about 5000 lines, not including use'd modules).  So I'm just 
>seeing the warning in the server logs, and it doesn't happen each 
>execution, just once in a while. 

And you aren't running the script under the debugger to see when and
why this is happening? (Using the CGI.pm modules "offline mode" or
some other way of imitating a web server's input.)

Do you just put the script up on the production server the moment it
passes "perl -c"?
-- 
Andrew Langmead


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

Date: Tue, 23 Feb 1999 14:14:30 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <MPG.113cc82097e603639896b7@206.184.139.132>

In article <F7LzI8.9oF@world.std.com>, aml@world.std.com says...
> >Sorry to leave out this info from the first post, but this is a cgi 
> >script (about 5000 lines, not including use'd modules).  So I'm just 
> >seeing the warning in the server logs, and it doesn't happen each 
> >execution, just once in a while. 
> 
> And you aren't running the script under the debugger to see when and
> why this is happening? (Using the CGI.pm modules "offline mode" or
> some other way of imitating a web server's input.)
> 
> Do you just put the script up on the production server the moment it
> passes "perl -c"?

My contract for this job doesn't say anything about debugging the script.  
I've never had a bug before this ;-)

It generated just a few warnings over a number of days of testing.  I 
think Ronald's suggestion is most helpful.


-- 
Bill Moseley mailto:moseley@best.com


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

Date: Mon, 22 Feb 1999 20:59:14 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <F7KqAq.Kuq@world.std.com>

moseley@best.com (Bill Moseley) writes:

>My program has a number of here docs and a few evals.  Is there an easy 
>way to find out what line is causing this error?

>Use of uninitialized value at (eval 32) line 18, <LIBS> chunk 500.

One way that I can think of is:

   $SIG{__WARN__} = sub { $DB::single = 1; warn @_};

This will cause the debugger to break at any warnings.



-- 
Andrew Langmead


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

Date: 22 Feb 1999 23:45:51 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <7asq7f$6hr$3@news0-alterdial.uu.net>

Bill Moseley <moseley@best.com> wrote:
> My program has a number of here docs and a few evals.  Is there an easy 
> way to find out what line is causing this error?
> 
> Use of uninitialized value at (eval 32) line 18, <LIBS> chunk 500.

Well, if good ol' fashioned "read the code carefully, thinking through
the consequences of every decision and considering the likelihood of
undefined values slipping in somewhere" fails, you could try putting
this near the beginning of your main program:

  $SIG{'__WARN__'} = sub { croak $_[0]; }

(Don't forget to "use Carp" in order to get croak.)  This will die with
a stacktrace as soon as any runtime warning, such as "Undefined value",
happens.  That might help you track things down more easily.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Mon, 22 Feb 1999 16:46:06 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <MPG.113b9a259bb3694a9896b4@206.184.139.132>

In article <F7KqAq.Kuq@world.std.com>, aml@world.std.com says...
> moseley@best.com (Bill Moseley) writes:
> 
> >My program has a number of here docs and a few evals.  Is there an easy 
> >way to find out what line is causing this error?
> 
> >Use of uninitialized value at (eval 32) line 18, <LIBS> chunk 500.
> 
> One way that I can think of is:
> 
>    $SIG{__WARN__} = sub { $DB::single = 1; warn @_};
> 
> This will cause the debugger to break at any warnings.

Sorry to leave out this info from the first post, but this is a cgi 
script (about 5000 lines, not including use'd modules).  So I'm just 
seeing the warning in the server logs, and it doesn't happen each 
execution, just once in a while.  I haven't been able to generate the 
warnings running the script from the command line.

What is '(eval 32)' saying?  And what about '<LIBS>'.  I'm not using a 
file handle called <LIBS>, if that's what it's saying.

Regarding trapping $SIG{__WARN__}:  If I want to keep my errors and 
warnings out of the web server logs, should I just redirect STDERR or use 
$SIG{__WARN__} to write my own log file?

Thanks very much,

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Mon, 22 Feb 1999 23:46:42 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <1dnnhmh.1ij4r671yw2abgN@bay1-200.quincy.ziplink.net>

Bill Moseley <moseley@best.com> wrote:

> What is '(eval 32)' saying?  And what about '<LIBS>'.  I'm not using a
> file handle called <LIBS>, if that's what it's saying.

(eval 32) is the 32nd execution of an eval statement.

~> perl -we'$x=5;eval"print qq{$x\n}"while$x--;eval"print\$foo"'
4
3
2
1
0
Use of uninitialized value at (eval 6) line 1.
~>


<LIBS> chunk 500 is the 500th getline() from the LIBS filehandle.  You
may not be using LIBS in your own code, but that filehandle is being
used somewhere in your script.


Anyway, I don't know any good way to debug this either.  :-(
Hmm...  Perhaps you could do something with $SIG{__WARN__} and caller()?


#!/usr/local/bin/perl

use vars qw($pack $file $line $subname $hasargs $wantarray);

$SIG{__WARN__} =
    sub {
        warn @_;
        $i=0;
        while (($pack,$file,$line,$subname,$hasargs,$wantarray)
               = caller($i++)) {
            print STDERR
                "  WARN pack='$pack' file='$file' line='$line' ",
                "subname='$subname'\n";
        }
    }
;

eval 'print "$foo\n"';
__END__
Use of uninitialized value at (eval 1) line 1.
  WARN: pack='main' file='(eval 1)' line='1' subname='main::__ANON__'
  WARN: pack='main' file='tmp.pl' line='18' subname='(eval)'



Yup, looks like it works.  The problem eval is on line 18 of the file
tmp.pl.


Of course, you'll get a much longer trace, since there will be a whole
stack of function calls leading up to the (eval).  You could probably
get away with just printing the results of caller(1), skipping caller(0)
and caller(>1) entirely.

HTH!

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
perl -e'$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: 24 Feb 1999 18:23:59 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Use of uninitialized value at (eval 32)
Message-Id: <7b1g3v$42f$1@news0-alterdial.uu.net>

> Sorry to leave out this info from the first post, but this is a cgi 
> script (about 5000 lines, not including use'd modules).  So I'm just 
> seeing the warning in the server logs, and it doesn't happen each 
> execution, just once in a while.  I haven't been able to generate the 
> warnings running the script from the command line.

Instead of croaking (my idea) or triggering a debugger breakpoint (as
another poster suggested), you could roll-your-own traceback using
'caller'.  See the source for 'croak' (in Carp.pm, part of the standard
library) for an example.  Or, you could just croak and immediately catch
the exception:

  $SIG{'__WARN__'} = sub {
     eval { croak "caught warning!"; };
     print STDERR $@;
  };

> What is '(eval 32)' saying?  And what about '<LIBS>'.  I'm not using a 
> file handle called <LIBS>, if that's what it's saying.

"(eval 32)" is in lieu of a line number -- it means the warning is
triggered on the 32nd eval statement executed by your script.  Not as
much information as you'd like, but better than nothing.

The "<LIBS>" bit means that some bit of code somewhere has a filehandle
called LIBS open, and it was at chunk 500 (chunks == lines when you
haven't messed with $/) when the warning was triggered.  Probably this
is off in some module that you don't know the guts of; in that case,
it's not much use to you.  (Although it does seem to imply that some
module is leaving a filehandle open, when perhaps it ought not to.)

> Regarding trapping $SIG{__WARN__}:  If I want to keep my errors and 
> warnings out of the web server logs, should I just redirect STDERR or use 
> $SIG{__WARN__} to write my own log file?

It is generally advisable (from what I've read -- never done much in the
way of CGI programming myself) to have CGI error log files distinct from
your server error logs.  The simple way to do this is to have a bit of
boilerplate near the beginning of every CGI script:

   open (STDERR, ">$cgi_error_log") || warn "couldn't redirect STDERR: $!\n";

However, the CGI::Carp module takes care of this (and many other issues
related to error logging in CGI scripts); from its documentation
("perldoc CGI::Carp"):

     CGI scripts have a nasty habit of leaving warning messages
     in the error logs that are neither time stamped nor fully
     identified.  Tracking down the script that caused the error
     is a pain.  This fixes that.  Replace the usual

         use Carp;

     with

         use CGI::Carp

     And the standard warn(), die (), croak(), confess() and
     carp() calls will automagically be replaced with functions
     that write out nicely time-stamped messages to the HTTP
     server error log.

It also supports redirecting error messages, but apparently at a
performance cost.  :-(  RTFM for details.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Wed, 24 Feb 1999 03:49:00 +0100
From: Chris Kuhi <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Use of uninitialized value: related question
Message-Id: <36D3689C.722FEC72@stud.uni-muenchen.de>

I've been wondering if there's a flag to have Perl say WHICH variable
was uninitialized.  I often have the unitialized warning on a line with
several variables, and it would certainly speed up finding the problem
if the message were:

$blah used without being initialized on LINE xx

I know, I know.  There are ways of getting this information (Probably
with the debugger which I don't quite have the hang of yet)
nevertheless, for small throw-away scripts, this is the most common bug
I get and it would be nice to find out immediately which variable is the
culprit.  Thanks in advance,

Christopher Kuhi
christopher.kuhi@stud.uni-muenchen.de


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

Date: 24 Feb 1999 18:53:56 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Use of uninitialized value: related question
Message-Id: <7b1hs4$4k7$3@news0-alterdial.uu.net>

Chris Kuhi <christopher.kuhi@stud.uni-muenchen.de> wrote:
> I've been wondering if there's a flag to have Perl say WHICH variable
> was uninitialized.  I often have the unitialized warning on a line with
> several variables, and it would certainly speed up finding the problem
> if the message were:

Apparently the implementation would make this really difficult -- or at
least, the last time I saw somebody ask about this, a Perl guru of high
standing responed that it would be really hard to implement.  This was a
couple years ago, I dunno if that's still the case.

I agree, though, it would be a really nice feature!

> I know, I know.  There are ways of getting this information (Probably
> with the debugger which I don't quite have the hang of yet)
> nevertheless, for small throw-away scripts, this is the most common bug
> I get and it would be nice to find out immediately which variable is the
> culprit.  Thanks in advance,

As it happens, I find that "Uninitialized value" warnings are *much*
less frequent when you "use strict".  They don't go away, especially if
you're sloppy... but "use strict" is a big win all 'round.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Wed, 24 Feb 1999 23:07:07 +0000
From: Fabrice TALBOT <talbo008@wxs.nl>
Subject: Use Perl to work with file
Message-Id: <36D4861B.5AAF@wxs.nl>

Hi there,

I have read some literatures on PERL and this language looks interesting
when you want to perform server-side scripting on files. Can someone
tell me what is the difference (avantage?) using PERL rather than some
VBScript in ASP pages to work with files (it's what I am currently
doing).

Does it exist some book which are known as references for PERL
programmers ?

Thanks in advance for anybody help


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

Date: 24 Feb 1999 22:36:08 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Use Perl to work with file
Message-Id: <slrn7d8vrj.eqg.fl_aggie@enso.coaps.fsu.edu>

On Wed, 24 Feb 1999 23:07:07 +0000, Fabrice TALBOT <talbo008@wxs.nl> wrote:

+ Does it exist some book which are known as references for PERL
+ programmers ?

<url:http://reference.perl.com/query.cgi?section=books>

In particular: Learning Perl, Programming Perl, and The Perl Cookbook.

James


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

Date: Tue, 23 Feb 1999 02:43:02 GMT
From: Phil <phil.yeo@ukonline.co.uk>
Subject: use web cgi script output as input to my script?
Message-Id: <36D215B6.4C75383B@ukonline.co.uk>

I'd like to write a script that extracts the relavant data from the
output of another cgi script on the web. How do I get my script to run
the web script (supplying the parameters and recieve the html page as
input)
Is this easy as I'm new to perl?

Phil


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

Date: Tue, 23 Feb 1999 13:43:43 -0600
From: matt <mflorell@pici.com>
Subject: Re: use web cgi script output as input to my script?
Message-Id: <36D304BC.BB06295F@pici.com>

Hello,

    Here's one solution:

    You first must make sure that the LWP modules are loaded on you
server, then use this in your code:

use LWP::Simple;
$url=$ENV{"QUERY_STRING"} ||
"http://www.sourceserver.com/sourcefile.html";
$file="/path/to/root/sourcefilename.txt";  #destination of source
material on your server
getstore($url, "sourcefilename.txt");

Matt
----------

Phil wrote:

> I'd like to write a script that extracts the relavant data from the
> output of another cgi script on the web. How do I get my script to run
> the web script (supplying the parameters and recieve the html page as
> input)
> Is this easy as I'm new to perl?
>
> Phil



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

Date: Tue, 23 Feb 1999 18:53:56 GMT
From: mag@imchat.com (Mark P.)
Subject: uselib
Message-Id: <36d2f8d4.170864009@news.ionet.net>

	Hey I've looked in the faqs, searched dejanews, and checked
the current messages.

	I just need to know the syntax for uselib because I need to
add a module, but don't have root access.

Thanks


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

Date: Tue, 23 Feb 1999 21:47:12 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: uselib
Message-Id: <1dnp85p.1u1u8pr1b8qmg3N@bay1-193.quincy.ziplink.net>

Mark P. <mag@imchat.com> wrote:

>   Hey I've looked in the faqs, searched dejanews, and checked
> the current messages.

Look again.

  How do I keep my own module/library directory?

        When you build modules, use the PREFIX option when generating
        Makefiles:

            perl Makefile.PL PREFIX=/u/mydir/perl

        then either set the PERL5LIB environment variable before you run
        scripts that use the modules/libraries (see the perlrun manpage)
        or say

            use lib '/u/mydir/perl';

        See Perl's the lib manpage for more information.


I found this very quickly by searching the FAQ pages for 'lib'.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
perl -e 'for(@ARGV){require $_;print "$_\n  $INC{$_}\n"}' File/Find.pm


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

Date: Sun, 21 Feb 1999 20:34:59 GMT
From: derek@seeray.com
Subject: Re: Using PERL system call with MS IIS 4.0
Message-Id: <7apqlj$f3s$1@nnrp1.dejanews.com>

Optionally you can try this within your perl script.....


system ("command.exe");

That will execute another process and return its results to the browser.

What I have experienced is the reverse....if you wish to execute a command and
NOT have it return anything to the browser.... system ("start command.exe");
should work in theory but only works on localhost and not from a browser.

If anyone knows the way to execute a process and pushing it to the background
while returning immediately back to the perl script please advise.  NT IIS
Perl5

Thanks,
Derek







In article <36c27336.524144494f47414741@radiogaga.harz.de>,
  MARTIN@RADIOGAGA.HARZ.DE wrote:
> Rolland Suh (rolland@MCS.COM) wrote:
> : With PERL and MS IIS 4.0, how can I use "system" call to run a child
process,
> : and have the result go back through the parent, to the IIS and finally back
> : to the browser? (All through the parent's STDOUT)
>
> I/O redirection is broken in M$ IIS. For IIS 4, follow these
> instructions to make it work (at the expense of some performance):
>
> - Make sure that you've got Windows Scripting Host installed as part
>   of Option Pack 4. You can verify this by looking for the file
>   %system32%\cscript.exe. If it isn't there, run setup.exe from
>   the Option Pack CD-ROM and install it.
> - Using the CLI, go to %system32%\inetsrv\adminsamples.
> - Run this:
>
>         adsutil.vbs SET W3SVC/1/CreateCGIWithNewConsole 1
>
>   (the number after "W3SVC/" may vary if you have multiple websites.
>    If you have, repeat the procedure for all websites.)
>   It'll say that CScript isn't set up to handle this. That's ok.
> - Click Ok.
> - Click yes, you want to register.
> - Run it again.
> - Using the ISM, restart all web sites.
>
> Hope it helps,
>   Martin
> --
>                         | Martin Vorlaender | VMS & WNT programmer
>  VMS is today what      | work: mv@pdv-systeme.de
>  Microsoft wants        |       http://www.pdv-systeme.de/users/martinv/
>  Windows NT 8.0 to be!  | home: martin@radiogaga.harz.de
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 25 Feb 1999 15:31:32 -0800
From: RS <rajshreesankaran@hotmail.com>
Subject: using the perl open function
Message-Id: <36D5DD54.288E@hotmail.com>

Hi,

I am trying to create and open a file in a directory using Perl 4 on NT.

If I try the following, it seems to work

$DIR = "E:\\Inetpub\\sdir";
open (WR, ">$DIR\\reg.htm");

However, if I try the following, I can't seem to get it to work:

$DIR = "E:\\Inetpub\\$DIRNAME";
open (WR, ">$DIR\\reg.htm");

Does anybody know why this is the case...

Thanks,

RPS


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

Date: Thu, 25 Feb 1999 19:18:50 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: RS <rajshreesankaran@hotmail.com>
Subject: Re: using the perl open function
Message-Id: <36D5E86A.DCDBB6B0@giss.nasa.gov>

[courtesy copy sent to RPS via email]

RS wrote:
> 
> Hi,
> 
> I am trying to create and open a file in a directory using Perl 4 on NT.

hmph.  You really should upgrade to Perl5.

> 
> If I try the following, it seems to work
> 
> "$DIR = "E:\\Inetpub\\sdir";

$DIR = 'E:\Inetpub\sdir';

> open (WR, ">$DIR\\reg.htm");

open WR, ">$DIR\\reg.htm" || die "can't open file: $!";

> However, if I try the following, I can't seem to get it to work:
> 
> $DIR = "E:\\Inetpub\\$DIRNAME";
> open (WR, ">$DIR\\reg.htm");
> 
> Does anybody know why this is the case...

maybe check news:7b43nl%247ev%241%40info.uah.edu

> 
> Thanks,
> 
> RPS


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

Date: Thu, 25 Feb 1999 23:35:02 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: using the perl open function
Message-Id: <1dnt2ri.kqwwhz15hdy2oN@bay2-368.quincy.ziplink.net>

Jay Glascoe <jglascoe@giss.nasa.gov> wrote:

> open WR, ">$DIR\\reg.htm" || die "can't open file: $!";

Ack!  Mind your operator precedence!


ITYM

  open(WR, ">$DIR\\reg.htm") || die "can't open file: $!";

or

  open WR, ">$DIR\\reg.htm" or die "can't open file: $!";

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 25 Feb 1999 21:08:14 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: using the perl open function
Message-Id: <MPG.113fcc14f291eefa98968e@nntp.hpl.hp.com>

In article <36D5E86A.DCDBB6B0@giss.nasa.gov>, on Thu, 25 Feb 1999 
19:18:50 -0500 jglascoe@giss.nasa.gov says...
> RS wrote:
 ...
> > $DIR = "E:\\Inetpub\\sdir";
> 
> $DIR = 'E:\Inetpub\sdir';

Better style, but these are the same.
 
> > open (WR, ">$DIR\\reg.htm");
> 
> open WR, ">$DIR\\reg.htm" || die "can't open file: $!";

No error will be reported if the 'open' fails, because the precedences 
are wrong.  Use 'or', or put parens around the arguments to 'open'.

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


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

Date: Mon, 22 Feb 1999 15:02:39 +0100
From: "F. Geeb" <fge@elsamprojekt.dk>
Subject: UTF-8 - Latin 1
Message-Id: <36D1637E.113BA770@elsamprojekt.dk>

I wondered if there is a smart (perl-) way to translate a UTF-8-string
into Latin-1?




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

Date: 23 Feb 1999 08:53:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: UTF-8 - Latin 1
Message-Id: <7atqai$pfi$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Greg Ward
<gward@cnri.reston.va.us>],
who wrote in article <7asq9r$6hr$4@news0-alterdial.uu.net>:
> Not yet.  5.006 will have Unicode support from the ground up.  I gather
> that the bleeding-edge, leading-up-to-5.006, development versions
> (5.0055x) have the beginnings of Unicode support, but

but buggy.  Moreover, it is very hard to fix bugs unless you can *see*
these darn things!  I asked this on p5p, but I'm afraid that answers
were lost in the disk crash on perl.org:

==================================================================
My impression was that it should be possible to see UTF-8 on Solaris
7.  Looking in Answerbook, I tried

  env LANG=en_US.UTF-8 dtterm \
      -xrm '*fontList:-dt-interfaceuser-medium-r-normal-l*-*-*-*:' &

but doing
  perl -Mutf8 -le 'print "1\x{00a4}1"'

in the obtained window does not show UTF-8's

  00A4    CURRENCY SIGN
          * other currency symbol characters: 20A0-20CF
          x (dollar sign - 0024)

but two high-bit chars.

So: what do I need?  There are many bugs in -Mutf8, and it would be
nice if I could look for them with some visual feedback...

Ilya


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

Date: 22 Feb 1999 18:08:06 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: UTF-8 - Latin 1
Message-Id: <oeeyalql8ux.fsf@alpha.hut.fi>


"F. Geeb" <fge@elsamprojekt.dk> writes:

> I wondered if there is a smart (perl-) way to translate a UTF-8-string
> into Latin-1?

Depends on your definition of "smart".

Here's a small script to do the conversion.  Normally this does ISO
Latin-1 to UTF-8 conversion, if called with -r it does the reverse
(what you asked).  Note that this is a script with very little brain:
I do not guarantee what happens if you feed it UTF-8 that does not map
into ISO Latin-1.

#!/usr/bin/perl -sp

if ($r) {
    # UTF8 to Latin-1
    s/([\xC0-\xDF])([\x80-\xBF])/chr(ord($1)<<6&0xC0|ord($2)&0x3F)/eg;
} else {
    # Latin-1 to UTF8
    s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
}

Then there are modules for doing all kinds of character set
conversions.  The modules are also much more robust.  Try the modules
Unicode::Map8 and Unicode::Map.  They implement more or less the same
conversions and in future they may be merged into one module, perhaps.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 22 Feb 1999 23:47:07 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: UTF-8 - Latin 1
Message-Id: <7asq9r$6hr$4@news0-alterdial.uu.net>

F. Geeb <fge@elsamprojekt.dk> wrote:
> I wondered if there is a smart (perl-) way to translate a UTF-8-string
> into Latin-1?

Not yet.  5.006 will have Unicode support from the ground up.  I gather
that the bleeding-edge, leading-up-to-5.006, development versions
(5.0055x) have the beginnings of Unicode support, but that's probably a
bit dicey unless you really want to get into helping to test and debug
Perl.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 26 Feb 1999 13:22:25 GMT
From: schuller+news@lunatech.com (Bart Schuller)
Subject: Re: UTF-8 - Latin 1
Message-Id: <920035341.563154@perla.rotterdam.luna.net>

In article <7atqai$pfi$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>So: what do I need?  There are many bugs in -Mutf8, and it would be
>nice if I could look for them with some visual feedback...

Try the yudit text editor 
http://metalab.unc.edu/pub/Linux/apps/editors/X/yudit-1.2.tar.gz

I can imagine that standard terminal emulators get confused when one
byte doesn't equal one character.

-- 
The idea is that the first face shown to people is one they can readily
accept - a more traditional logo. The lunacy element is only revealed
subsequently, via the LunaDude. [excerpted from the Lunatech Identity Manual]


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

Date: Sun, 21 Feb 1999 23:16:05 -0600
From: Matt Steven <nospam@geniusweb.com>
Subject: Re: Web Browser Setup
Message-Id: <36D0E815.BC75C63B@geniusweb.com>

Bob Laflamme wrote:

> I have some perl scripts which run on NT IIS. When I access the url from
> Internet Explorer 4.x, everything works fine. However, when using Netscape
> or older versions of IE, the user gets prompted with the "Save As" dialog.
>

Use .cgi, for some reason I always had trouble with .pl on NT but by changing
the extension to .plx or .cgi the problem ceased.   Must have something to do
with windoze preferring 3 letters.

--
Matthew Steven
Freelance Web Developer
And Linux Hobbyist
http://GeniusWeb.com/
PERL * C * HTML * JavaScript * You name it...




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

Date: Mon, 22 Feb 1999 12:57:30 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: What is a 'Scripting Language' (was Re: Perl, PHP, Python,  ColdFusion, MS Frontpage, which one for beginner)
Message-Id: <36D0C79A.3AF93E20@spider.herston.uq.edu.au>

We obviously need terms other than 'scripting' and 'programming'.  These
are activities, not languages.  Most people seem to agree that Perl is a
different kind of language to Pascal, but the difference isn't measured
on the scripting->programming axis.  How about:

DOH (Declarations Optional Here)
 .
 .
 .
[Many shades of grey]
 .
 .
 .
FASCIST (Full And Systematic Checking of Inviolable Strong Types)

So perl is more of a DOH language, but Pascal is definitely more
FASCIST.  Of course DOH->FASCIST is only one axis of comparison.

-- 
Jaime Metcher

Jonathan Stowe wrote:
> 
> 
> Eh oh,
> 
> So I guess we will have to start calling certain implementations of C a
> 'Scripting Language' as they might create intermediate Assembler code
> that is handed off to 'as' to make the object files.
> 
> A bit more tenuous is something like Informix 4GL that is translated
> to C with embedded SQL then to straight C (then possibly to assembler)
> then to object file. Now some might not call this a proper programming
> language but I sure as hell have ever heard of anyone calling it a
> scripting language.
> 
> What would you call BASIC,Forth,Logo, blah,blah ... ?
> 
> Perl is a programming language even if some people might use it for
> what they might describe as scripting - but I and the majority of the
> people who frequent this group would describe ourselves as programmers
> not scripters (whatever one of those might be ).
> 
> This scripting business is basically something that has been cooked up
> by software vendors to soft sell programming languages to people who
> dont want to be programmers IMO.
> 
> /J\
> --
> Jonathan Stowe <jns@btinternet.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
> Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 23 Feb 1999 13:18:00 GMT
From: The Glauber <theglauber@my-dejanews.com>
Subject: Re: What is a 'Scripting Language' (was Re: Perl, PHP, Python, ColdFusion, MS Frontpage, which one for beginner)
Message-Id: <7au9q1$88i$1@nnrp1.dejanews.com>

A "script" that does anything other than the most trivial is so similar to a
"program" that i can't tell the difference.

Glauber

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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