[6901] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 526 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 27 12:09:01 1997

Date: Tue, 27 May 97 09:00:24 -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           Tue, 27 May 1997     Volume: 8 Number: 526

Today's topics:
     ?my($foo)=shift;? <alex.t.silverstein@bender.com>
     Re: ?my($foo)=shift;? <thuja@internauts.ca>
     Re: [Q:] Comma use in Unix Review Col 09 (Abigail)
     Re: ANNOUNCE: Perl 5 Pattern Matching for Java (Tad McClellan)
     any editor for perl? <biceps@hkstar.com>
     Re: CGI in Perl for WinNT (Cornelius Griffin)
     Re: Change or Delete a line in a FILE (Chipmunk)
     Re: getting next line in while (Chipmunk)
     How to Send e-mail attachments? <Gaspard@valhall.esrin.esa.it>
     Re: How to Send e-mail attachments? <news@alf.impaq.com.pl>
     Re: How to Send e-mail attachments? (Nathan V. Patwardhan)
     Is it possible to access Microsoft SQL databases with p <RJOWork@postoffice.worldnet.att.net>
     Losing STDOUT and STDERR (FURNERNER)
     Need Help, Will Pay!!! (Mal Paine)
     None (Philippe  Bouige)
     None (Philippe  Bouige)
     ODBC.pm and Parameter Queries <Dean.H.Kier@mro01.usace.army.mil>
     Open and print HTML file insside CGI script <miran.sepic4@mss.tel.hr>
     Perl & database <miran.sepic4@mss.tel.hr>
     Perl 5 Database <neil@charis.co.uk>
     Re: Perl online manuals/tutorials (Abigail)
     Re: print \@ slices (Chipmunk)
     Problem with Carp.pm in NT environnement <postmaster@aspen.namur.be>
     Re: problem with perl, ODBC.pm  and CGI.pm <williame@leisureplan.com>
     PURE PERL .gif creating library needed; not in @#$ C la <paf@fbit.msk.su>
     Re: PURE PERL .gif creating library needed; not in @#$  (Nathan V. Patwardhan)
     Reading binary files: OK under DEC UNIX, error under Wi <john@xray.bmc.uu.se>
     Search Pattern Help???? (Daniel Cody)
     subroutine call as lvalue (was: Re: questions about cho <dehon_olivier@jpmorgan.com>
     Re: Using perl and rlogin <Brian.Ewins@gssec.bt.co.uk>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 27 May 1997 09:52:31 -0700
From: alex <alex.t.silverstein@bender.com>
Subject: ?my($foo)=shift;?
Message-Id: <338B114F.1C61@bender.com>

in perlref I get the following,
but I can't figure out what the "my $x = shift"
lines are doing. I know what shift() and my() do. But
I get the feeling this is s'thing else going on here.
Many Thanks.

example:
             sub newprint {
                 my $x = shift;   #huh?
                 return sub { my $y = shift; print "$x, $y!\n"; };
             }
             $h = newprint("Howdy");
             $g = newprint("Greetings");

-- 
"just what are people for?" (K.V.)


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

Date: Tue, 27 May 1997 10:33:28 -0400
From: Michael Iles <thuja@internauts.ca>
Subject: Re: ?my($foo)=shift;?
Message-Id: <338AF0B8.76EA@internauts.ca>

alex wrote:
1>              sub newprint {
2>                  my $x = shift;   #huh?
3>                  return sub { my $y = shift; print "$x, $y!\n"; };
4>              }
5>              $h = newprint("Howdy");
6>              $g = newprint("Greetings");

Line 5 calls newprint and passes "Howdy" as an argument. Line 2 shifts
"Howdy" off the argument stack and assigns it to $x -- nothing magical.
Line 3 defines an anonymous subroutine that accepts an argument and then
prints "Howdy, <argument>!". A reference to this subroutine is returned
from newprint, and assigned to $h.

This means that $h 'points' to -- or contains a reference to -- the
subroutine that was defined in newprint. It can be called later as,

    &$h( "Doody" );

which would print "Howdy, Doody!". 

The slightly magical thing about this is that $x was defined to be
"Howdy" while the anonymous subroutine was being defined, and the
anonymous subroutine always uses the value "Howdy" for $x, no matter
what $x is when the subroutine is actually called. $y on the other
hand,  is scoped *within* the anonymous subroutine, and so its value
isn't known until the subroutine is called.

This allows parameters to be used when defining a subroutine, as well as
when calling it.

The anonymous subroutine is called a 'closure'. I just looked up
closures in the Camel (pp 253-4) and the example they give is exactly
the one you are working through, and it's all explained there. So ignore
what I wrote and read that :)

Mike.

-- 
Michael Iles, michaeli@dra.com                  PGP Fingerprint:
sub perl_mind { for ( <LIFE> ) { breathe; } }    CB 51 3B 92 A7 25 FB 74
      Ceci n'est pas une .sig                    68 5A 2D 37 34 D5 39 5B


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

Date: Tue, 27 May 1997 14:24:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: [Q:] Comma use in Unix Review Col 09
Message-Id: <EAuG1n.494@nonexistent.com>

On Mon, 26 May 1997 18:49:26 -0700, Tom Phoenix (rootbeer@teleport.com)
wrote in comp.lang.perl.misc
<URL: news:Pine.GSO.3.96.970526184207.18627F-100000@kelly.teleport.com>:
++ On Mon, 26 May 1997, Brian Lavender wrote:
++ 
++ > I am looking at Randal Schwartz's Unix Review column 9 located at
++ > http://www.stonehenge.com/merlyn/UnixReview/col09.html
++ > 
++ > On line 01 how does the comma work? 
++ 
++ > [01]        $names++, shift if $ARGV[0] eq "-l";
++ 
++ It's the scalar comma operator, which Perl stole^W borrowed from C. It
++ evaluates the arguments on both sides, discards the left one and returns
++ the right one. So, if the first argument is not '-l', that statement will
++ do nothing. If it is '-l', that statement will increment $names (from
++ undef to 1) and will strip that first argument off of @ARGV.
++ 
++ You could re-write that line like this...
++ 
++     if ($ARGV[0] eq '-l) {
++         $names++;		# Set $names flag
++         shift;			# Discard the argument
++     }
++ 
++ ...or you could use a module to handle arguments. Since Randal has limited
++ space for those columns, he probably needed to keep it short to allow all
++ of the other cool stuff he included. Hope this helps!


Personally, I would write it as: do {$names ++; shift} if $ARGV[0] eq "-l";
Takes just a little more space, and it's (IMO) clearer what happens.

But that's just OMWTDOI.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: Tue, 27 May 1997 06:26:19 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: ANNOUNCE: Perl 5 Pattern Matching for Java
Message-Id: <rcgem5.9h.ln@localhost>

Daniel F. Savarese (dfs@oroinc.com) wrote:
: I didn't post this to comp.lang.perl.announce because I think that's
: actually only for stuff written in Perl.  I decided to go ahead and
: post to comp.lang.perl.misc because I keep on running into Perl
: programmers like myself who have to write Java code and sorely miss
: reliable/robust/fully compatible/and FREE Perl 5 regular expressions.


There is also perl5 pattern matching in Java at:

http://www.win.net/~stevesoft/pat/welcome.html


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 27 May 1997 22:49:27 +0800
From: ccm <biceps@hkstar.com>
Subject: any editor for perl?
Message-Id: <338AF477.FE11738D@hkstar.com>

I am a new user in Perl.
I found that those .pl files edited under Win95/Dos Editor will not work
properly.
But if I edit them in the unix shell with pico, they works fine.
is out there any editor which workable with perl under Win95/Dos
Environment?

Pls help.

--

                 -=- BLACK DRaGON -=-           [dRacuLa CCM]
                   EMAIL: mailto:cat33@iname.com
                 WeBSiTE: http://www.hk.linkage.net/~ccm/
      SubSpace SquadSite: http://www.blackdragon.org/
          The HACKER BBS: (852)2614-0170



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

Date: Tue, 27 May 1997 08:40:51 -0400
From: EScrubb@worldnet.att.net (Cornelius Griffin)
Subject: Re: CGI in Perl for WinNT
Message-Id: <MPG.df4a05edd377768989691@netnews.worldnet.att.net>

In article <Pine.ULT.3.92.970527001504.10575A-
100000@impala.ir.miami.edu>, gbrewer@impala.ir.miami.edu says...
> 
> I am having trouble porting cgi scripts I had written in perl to handle
> forms (get method) from unix to the latest version of Windows NT
> 
	www.activeware.com has alot of good links for perl for win32. 

Cornelius


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

Date: 27 May 1997 12:45:54 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Change or Delete a line in a FILE
Message-Id: <5mel22$a3b$1@dartvax.dartmouth.edu>

In article <5m09c3$8m6$1@news.netusa.net>
Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:

> How about lines with phone numbers on them?
> 
> m:\b([(1]*(888|900|800|809)[-\s\)/\.]+\d{3}[-\s/\.]*\d{4}|
> 011[\s.\/+-]*(\()?\d{3}(\))?[\s.\/+-]*\d{2,}[\s.\/+-]*\d+)\b:x
> 
> Any obvious variations (besides different area codes) that I missed?

How about 1-800-000-0000, with a dash between the 1 and the area code?

Chipmunk


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

Date: 27 May 1997 12:36:14 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: getting next line in while
Message-Id: <5mekfu$8mc$1@dartvax.dartmouth.edu>

In article <5mc3fh$11i@guardian.cba.ua.edu>
jrobert1@guardian.cba.ua.edu (Jeff Robertson) writes:

> In article <5mb4fe$lrf$1@dartvax.dartmouth.edu>,
> Chipmunk <Ronald.J.Kimball@dartmouth.edu> wrote:
> >In article <5m3p7q$g8i@guardian.cba.ua.edu>
> >jrobert1@guardian.cba.ua.edu (Jeff Robertson) writes:
> >
> >> In article <5m0i8b$3nr$1@dartvax.dartmouth.edu>,
> >> Chipmunk <Ronald.J.Kimball@dartmouth.edu> wrote:
> >> >In article <5lsoe1$569$1@mark.ucdavis.edu>
> >> >etfinley@ece.ucdavis.edu (Eric Finley) writes:
> >> >
> >> >> How can I get the next line of the file while in the while loop without going through the
> >> >> next iteration of the while.  My code looks like:
> >> >> 
> >> >> while (<FILE>) {
> >> >>     if (/foo/) {
> >> >>         print;
> >> >>     }
> >> >>     if (/bar/) {
> >> >>         print;
> >> >>         get next line;
> >> >>         print next line;
> >> >
> >> >print scalar(<FILE>);
> >> 
> >> But what if he also wants to check to see if that next line
> >> contains /bar/ ? Maybe something like:
> >
> >Oh yeah?  What if he also wants to check to see if that next line
> >contains /foo/ ?  What will you do then, smart guy?
> >
> >Chipmunk
> 
> Oops, I did make a mistake in my code, but a different one
> from that! I forgot to print the FIRST line containing /bar/. 
> My corrected code:
> 
> while (<FILE>) {
>         if (/foo|bar/) {
>                 print;
>         }
>         BAR: if (/bar/) {
>                 $_ = <FILE>;
>                 print;
>                 redo BAR;
>         }
> }
> 
> As for the question about the next line containing /foo/,
> I assume you were being sarcastic. If the next line contains
> /foo/, it will still be printed. The reason one should check
> for /bar/ again is so that something like the following will
> be parsed correctly:
> 
> foo
> bar
> bar
> baz
> quux
> 
> My code would print:
> 
> foo
> bar
> bar
> baz
> 
> Yours, however, would print:
> 
> foo
> bar
> bar
> 
> This leaves out the "baz", which ought to be printed because
> it does indeed occur on a line after one containing /bar/.

Why do you assume yours is correct?

The original poster never said what he he wanted to print every line
after a /bar/.  He just wanted to know how to get a line from the file
inside the while loop.  And that is what I told him to do.  In fact, my
code does exactly what his pseudo-code would do, whereas yours does
something else.

If you want to play games trying to guess what the poster wanted, go
ahead, but don't imply that my suggestion is wrong when it isn't.

Chipmunk

P.S.  This is what I get when I run your program on your input:
foo
bar
bar
Label not found for "redo BAR" at temp line 8, <> chunk 3.

I think you meant to write:
while (<>) {
        if (/foo|bar/) {
                print;
        }
        BAR: {
            if (/bar/) {
                $_ = <>;
                print;
                redo BAR;
            }
        }
}


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

Date: Tue, 27 May 1997 13:23:29 +0300
From: Gaspard Gendreau <Gaspard@valhall.esrin.esa.it>
Subject: How to Send e-mail attachments?
Message-Id: <338AB60C.6A3C@valhall.esrin.esa.it>

I need to send e-mail with attached binary files. All modules I have
looked around in CPAN do not seem to have this feature ready, and I
don't know how to format the body of an e-mail to contain attachment.

Can anyone point me to a module which handles attached files?

If none exists, how shall I build the body of my e-mail to separate the
text with the attachment? Shall I use Base64?

Thanks.
 
Gaspard


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

Date: Tue, 27 May 1997 13:39:55 +0200
From: Andrew Filip <news@alf.impaq.com.pl>
To: Gaspard@valhall.esrin.esa.it
Subject: Re: How to Send e-mail attachments?
Message-Id: <338AC80B.FBCD727F@alf.impaq.com.pl>

Gaspard Gendreau wrote:
> I need to send e-mail with attached binary files. All modules I have
> looked around in CPAN do not seem to have this feature ready, and I
> don't know how to format the body of an e-mail to contain attachment.
> Can anyone point me to a module which handles attached files?
> If none exists, how shall I build the body of my e-mail to separate
> the text with the attachment? Shall I use Base64?

You may use uuencode.

It takes any file and translates it into uuencodeded version.
You put output of uuencode directly into body of your mail
 - no changes to mail header are needed.


-- 
common sense is uncommon


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

Date: 27 May 1997 13:38:21 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to Send e-mail attachments?
Message-Id: <5meo4d$ks9@fridge-nf0.shore.net>

Gaspard Gendreau (Gaspard@valhall.esrin.esa.it) wrote:
: I need to send e-mail with attached binary files. All modules I have
: looked around in CPAN do not seem to have this feature ready, and I
: don't know how to format the body of an e-mail to contain attachment.

Really?  You mustn't have heard of MIME, then, because you missed the
MIME modules.  :-)

http://www.perl.com/CPAN/modules/by-module/MIME

: Can anyone point me to a module which handles attached files?

Get the MIME-Lite module.

: If none exists, how shall I build the body of my e-mail to separate the
: text with the attachment? Shall I use Base64?

Yes, you will be using Base64.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 27 May 1997 15:12:00 GMT
From: "Richard" <RJOWork@postoffice.worldnet.att.net>
Subject: Is it possible to access Microsoft SQL databases with perl?
Message-Id: <01bc6aaf$972f1ec0$e525a8c0@cube444a>

Hello,

      I am trying to find a way to access a Microsoft SQL database using
perl,  can this be done?   Does anyone know if their is any sample scripts
out their that do this, I have looked all over the Net and have found
nothing.  I also found no information at various bookstores.  Any input or
help would be great.

Richard


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

Date: 27 May 1997 14:47:32 GMT
From: furnerner@aol.com (FURNERNER)
Subject: Losing STDOUT and STDERR
Message-Id: <19970527144701.KAA07855@ladder01.news.aol.com>

Background:     O/S:  Win-NT 4.0
                       Perl:   Version 5.001 build 109  (July '96)

While performing a system call such as:
    "system("copy", "file1", "file2", "> NUL", "2>NUL");"
with redirection of STDOUT and STDERR, I am losing the connects of file1
in the process.  More specifically the statement is producing a "0" byte
file called "file2".  I do not see this occur all the time, it is a
mystery to me at this point.  If I remove the redirection of STDOUT and
STDERR, the command executes correctly.  My question is: Is there a bug in
PERL in handling FileHandles?
I can run the above statement on Perl Version 5.001 beta ('95) and it
won't fail.
I can not go back to the "beta" version due to other problems encountered
with that version.  I have downloaded the most recent version of PERL
Version 5.003 build 306 and have found the above command to fail also.  
Thanks in advance!
     


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

Date: Tue, 27 May 1997 06:35:22 -0400
From: isupport@ilesa.com (Mal Paine)
Subject: Need Help, Will Pay!!!
Message-Id: <isupport-ya02408000R2705970635220001@news.earthlink.net>

Jim Sims and I have begun work on Personal Distributor (Help me think of a
better name!), a freeware program that will automate shareware
distribution.Mac and Windows 95 versions will be released. www.ilesa.com
will also be hosting an online database of places to distribute software
(Email addresses and FTP sites). This online database will be downloadable
and importable into Personal Distributor. I am going to need someone on
this list to write a CGI script, in Perl, that will do the following: On
the first page, there are two radio buttons: Email Address or FTP Site. At
the bottom of the page, there's a button named "Continue ->". When the user
clicks continue, the name of the radio button is placed in an invisible
field on a new html page. If the radio button selected was "FTP Site" then
three fields are written to this html page (URL, FTP site name, and Email
address, if neccessary). If "Email Address" was the radio button chosen,
then two fields are shown: Email Address and Name of
Company/Person/Magazine. At the bottom of either page, there is a button
named "Add Entry". When clicked, it writes the contents of the invisible
field, a carriage return, and then the contents of each of the fields, each
followed by a carriage return. Sound complicated? I think it is. Anyway, I
cannot write this, so I am asking for your help. I will definitely put a
link to your site from mine, give you credit in the about box of PD, and
add a hyperlink in PD to your web page (Like in Anarchie for Macs).

Thanks, and ANY help is appreciated!
Mal
---
Mal Paine - 9th Grade Programmer at Ilesa Software
<http://www.ilesa.com>

Recreational 4WD Offroad RCer, Mountain Bike X-Country Racer
---
Mal Paine - 9th Grade Programmer at Ilesa Software
<http://www.ilesa.com>

Recreational 4WD Offroad RCer, Mountain Bike X-Country Racer


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

Date: Tue, 27 May 1997 14:39:04 +0200 (MET DST)
From: pbouige@pasteur.fr (Philippe  Bouige)
Subject: None
Message-Id: <199705271239.OAA03399@cleopatre.pasteur.fr>

subscribe



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

Date: Tue, 27 May 1997 15:10:19 +0200 (MET DST)
From: pbouige@pasteur.fr (Philippe  Bouige)
Subject: None
Message-Id: <199705271310.PAA25986@cleopatre.pasteur.fr>

help



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

Date: Tue, 27 May 1997 09:12:53 -0700
From: Dean Kier <Dean.H.Kier@mro01.usace.army.mil>
Subject: ODBC.pm and Parameter Queries
Message-Id: <338B0805.1CA5@mro01.usace.army.mil>

I just started using Perl for Win32 and ODBC.pm.  I know SQL and don't 
mind using it, but some of my databases(MSAccess) parameter queries and I 
would like to be able to use them.  Is there a way to do this?  Thanks.

Dean
Dean.H.Kier@mro01.usace.army.mil


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

Date: 27 May 1997 11:34:41 GMT
From: "Miran Sepic" <miran.sepic4@mss.tel.hr>
Subject: Open and print HTML file insside CGI script
Message-Id: <01bc69ea$c2d25800$7a000047@pc_miran>

I have a following problem:

>From inside Perl script I try to open a HTML file, and print it back.
This part of script looks like that:

$login_page = "/user/download.html";
open (FILE, "$login_page");
@filein = <FILE>;
print "Content-type: text/html\n\n";
print @filein;

The response is:

Internet explorer cannot open the Internet site .....
The operation completed successfully.

When I put HTML directly inside script,  everything is OK.




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

Date: 27 May 1997 11:34:37 GMT
From: "Miran Sepic" <miran.sepic4@mss.tel.hr>
Subject: Perl & database
Message-Id: <01bc69a7$a33b03e0$7a000047@pc_miran>

I need a help for a following topic:
I have to make a list which will contain usernames and dates of expiration
of their maintenance agreement:

username1:date1
username2:date2
 ........................
username(x):date(x)

How can I open such file, use split function (split /:/ - something like
that), and compare date(x) with today's date?

Thanks, Miran


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

Date: 27 May 1997 11:07:48 GMT
From: "Neil S Hamilton" <neil@charis.co.uk>
Subject: Perl 5 Database
Message-Id: <01bc6a8d$541c3900$322af7c2@proskuneo.charis.net>

Hi there... please forgive what is probably an obvious question.

I am needing to write a simple database (flat-file) and I though I'd try
some of Perl 5's database features. Unfortunately, I've got the old version
of "Programming Perl" which only goes up to Perl 4.

Can anyone either

a) give me a brief run-down of the functions to do with db manipulation,

or

b) point me to a URL which does??

Thanks!

-- 
Neil S Hamilton (neil@charis.co.uk)
Operations Manager,
Charis Internet Services Ltd. (http://www.charis.co.uk)
Tel: 0121 446 6100 Fax: 0121 446 6172


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

Date: Tue, 27 May 1997 14:35:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl online manuals/tutorials
Message-Id: <EAuGIn.4oM@nonexistent.com>

On Sun, 25 May 1997 18:29:39 +0200, Ighon (ighon@infostrada.it) wrote in
comp.lang.perl.misc
<URL: news:338868F2.24B2@infostrada.it>:
++ Where I can find Perl online manuals/tutorials ?

http://www.perl.org/
http://www.perl.com/perl/

++ I would learn this language.

The language itself comes with tons of documentation.

du -k /usr/local/lib/perl5/man/man?
2163    /usr/local/lib/perl5/man/man1
327     /usr/local/lib/perl5/man/man2
2087    /usr/local/lib/perl5/man/man3
561     /usr/local/lib/perl5/man/mann


That's almost 5 Mb of manuals for perl and the extra modules I've
installed on the system.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 27 May 1997 02:17:01 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: print \@ slices
Message-Id: <5mdg6t$lsg$1@dartvax.dartmouth.edu>

In article <338905DC.4148@bender.com>
alex <alex.t.silverstein@bender.com> writes:

> I can't seem to find the documentation
> on how to print, say, the 0th thru 3rd
> elements of a ref to an array. This is
> as far as I got, but it only prints one 
> element. Is the answer in one 
> of the texts (I own a few)?
> 
> #!/usr/local/gnu/bin/perl -w
> @refarrr= (130, 150, 2, 1); 
> $refar = \@refarrr;
> print "$refar->[2]\n";

How about:
print "@{$refar}[1..2]\n";

Chipmunk


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

Date: Tue, 27 May 1997 14:21:35 +0200
From: Nachtergale Veronique <postmaster@aspen.namur.be>
Subject: Problem with Carp.pm in NT environnement
Message-Id: <338AD1CF.7084@aspen.namur.be>

Hello everybody,


Could someone help me ? 

In the first time, I have a lot of Perl scripts that run on an Netscape
Server on Windows NT.
I use the libraries: CGI.pm and Carp.pm.

Now, I have installed IIS 3.0 and PerlIs on Windows NT 4.0 Server. Then,
I runs my Perl script
on the IIS 3.0 Server on NT 4.0, with Perl for Win32 version 5.003_07
build 306.
I also use PerlIS.
The execution of Perl scripts is right if executed with perl.exe. But
they don't execute 
correctly with PerlIS.

BUT the problem appears with Carp.pm, when using PerlIS:
--------------------------------------------------------
When I attempt to use carp.pm, all is wrong. The Perl scripts doesn't
execute correctly. The problem seems to be in the following instruction
in
the Carp.pm:
    open(SAVEERR, ">&STDERR");
    open(STDERR, ">&$no") or 
	( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );

Does someone have ideas about this ?

To verify this, I write the following little test 
(OK, the script could by written in a more effective manner, 
but.... it is a simple test, and it exists only to test the execution of
the "open" instruction).
When executed without the "open" instruction, the script executes
correctly. 
But, with the "open" instruction, the script displays the first two
lines and then stops.
I don't undestand why...
So, could someone help me ? Any idea about this ? 

------------------------------------------------------------
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<HR>";
print "<H4>Hello World </H4>\n";
print "<P>\n";
print "Beginning of the test: <BR>\n";
print "<BR>";

open (TEST, ">&STDOUT");

print "Open successfull.... <BR>\n";
print "<BR>";
print "<H4>Have a nice day</H4>\n";
print "<HR>";
print "</BODY>\n";
print "</HTML>\n";
-------------------------------------------------------------


Thanks in advance for your help.

                              Veronique Nachtergaele


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

Date: 27 May 1997 11:32:24 GMT
From: "William Evans" <williame@leisureplan.com>
Subject: Re: problem with perl, ODBC.pm  and CGI.pm
Message-Id: <01bc6a92$4577a650$43c019c4@bwele>

Get the latest version of perl (306), and use OLE and DAO, then you don't
even need the ODBC perl module.  I have tried it, and it is very easy.

William
-- 
William Evans
e-mail: williame@leisureplan.com
http://www.leisureplan.com



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

Date: 27 May 1997 10:30:45 GMT
From: "Alexander Petrosyan" <paf@fbit.msk.su>
Subject: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <01bc69cf$8ab9a420$32c8c8c8@paf>

I'm looking for a PURE PERL library of manipulating GIF images.
Perl, Perl and only Perl.
Without patching perl sources / attaching external C language libraries.

Wanna write count.pl, which outputs "content-type: image/gif".
For now, I only found
http://www.eecs.ukans.edu/~skang/programs/ksl-count.txt counter which
outputs image/x-xbitmap.

That's good in that aspect, that it's kind I'm looking for - PURE PERL.
But I want multicolored image, which is impossible with x-xitmap content
type.

It is POSSIBLE to convert GIFLib for example into Perl but, I'm sure,
somewhere there ALREADY ARE such a thing.

Thanks in advance.
-- 
Alexander Petrosyan, Moscow.
email: paf@fbit.msk.su
phone: +7(095)535-2222


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

Date: 27 May 1997 13:43:16 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <5meodk$ks9@fridge-nf0.shore.net>

Alexander Petrosyan (paf@fbit.msk.su) wrote:
: I'm looking for a PURE PERL library of manipulating GIF images.
: Perl, Perl and only Perl.
: Without patching perl sources / attaching external C language libraries.

Okay.  So I guess you're looking for something which uses Perl, then?
Well, I don't know of any existing GIF / image creation and/or manipulation
modules which don't use dynamic, C libraries, but the two I use regularly
are:

(1) GD
(2) ImageMagick / PerlMagick

Then again, I don't see why you don't / wouldn't want to use something
that doesn't use dynamic libs?  After all, the toughest part for many
people seems to be the build, and even if you're not root on a Unix
system (or system where Perl's MakeMaker is complete), you can install
the dynamic libs locally.  The API for both of the packages mentioned
above is well-documented.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Tue, 27 May 1997 13:25:01 +0200
From: John Marelius <john@xray.bmc.uu.se>
Subject: Reading binary files: OK under DEC UNIX, error under Win32
Message-Id: <338AC48D.6769@xray.bmc.uu.se>

Two of my PERL program that read data from binary files (FORTRAN
unformatted files) work fine with PERL 5.002 under DEC UNIX (2.0 and up)
but fails under PERL 5.003_07 for Win32 (NT 4.0/Alpha).
The calls to the read function work normally the first 100-200 bytes but
after that read fails to read any more.

Has anyone else experience this kind of problem (and found a solution)?

John Marelius

excerpt from code:
while(...) {

        if($bytesread = read(REIN, $indata, $reclen) != $reclen) {
            &outerr("loadrestart: read ERROR at atom $i:$bytesread\n");
            close REIN;
            return;
        }
        ($x, $y, $z) = unpack("ddd", $indata);
	...
}
This fails after reading like 100 or 200 bytes from a 150000 byte file


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

Date: Tue, 27 May 1997 15:30:52 GMT
From: codyd@cc.sdstate.edu (Daniel Cody)
Subject: Search Pattern Help????
Message-Id: <338afd15.2664027@news.sdstate.edu>


We have been using a REXX script to search our email database for the
past few years.  I would like to change this to a perl script for
obvious reasons.  The way the REXX script was written, we added a '>'
before every name, as that is what the script would look for before a
name.  The email address was right below, so it looked something like
this: 
>Cody, Daniel
Email: codyd@cc.sdstate.edu

Is there anyone that could point me in somewhat of the right direction
on this one?  I am just starting to learn perl and am still trying to
understand some of its quirks.  Any help would be appreciated :)

Dan
-webmaster-
http://www.sdstate.edu


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

Date: 27 May 1997 14:05:38 +0200
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: subroutine call as lvalue (was: Re: questions about chop)
Message-Id: <njzk9klqfvx.fsf_-_@jpmorgan.com>

Randal Schwartz <merlyn@stonehenge.com> writes:

> substr(), pos(), and keys() are weird in that they hardwired in the
> syntax to be either an rvalue (what mortals call "value") or lvalue
> (something that can be put on the left side of an assignment, and
> other special places).
> 
> The Perl development team (aka, the P5P) have been looking into making
> it possible to write user subroutines that can perform similarly.
> Such a feature did not make it into 5.004, but perhaps 5.005 or 5.006
> will include such capability.
> 

This feature looks like syntactic sugar for subroutines to me. People
from the P5P will tell if I'm wrong and it's not just that simple.

Anyway, I'd put it in the wish-list if not there already.

BTW, is there another language where this mechanism exists ?
Prolog maybe ???

Regards,

Olivier Dehon.


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

Date: Tue, 27 May 1997 15:11:50 +0100
From: Brian Ewins <Brian.Ewins@gssec.bt.co.uk>
Subject: Re: Using perl and rlogin
Message-Id: <338AEBA6.30A@gssec.bt.co.uk>

Paul Vermette [NiD/BiM] wrote:
> 
> Kyzer (junkmail@sysc.abdn.ac.uk) wrote:
> : Paul Vermette [NiD/BiM], while smelling of fish, wrote:
> : : I have been trying to send the password to rlogin through perl
> 
> : Why? If I wanted to rlogin, I would use rlogin, not a perl script, because
> : that's insecure. If I was writing a program that logged into another computer,
> : I would use Net::Telnet or similar package.
[snip]
> : Tried reading the source of rlogin?
> 
> I am not using the password anymore because I found out about the .rhosts
> file.. which makes things somewhat more secure.. the big problem now is
> still waiting to see when the forked process can start taking commands..
[snip]

Try looking up 'rsh' it seems more like what you're after. Of course,
this assumes that what you're after isn't running a perl script on
a machine which doesn't have perl installed/mounted from the network.
'expect', based on tcl, is very good at this stuff (reading from
and writing to a command).

	Brian.


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

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

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