[8095] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1714 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 23 16:17:19 1998

Date: Fri, 23 Jan 98 13:00:26 -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, 23 Jan 1998     Volume: 8 Number: 1714

Today's topics:
        /x regex mystery (John M. Klassa)
    Re: @ == @, comparing arrays <Jan@ChipNET.cz>
        Buffered IO <jp@dkstat.com>
    Re: CGI downloads (Richard Bellavance)
    Re: chown -h (Jonathan Stowe)
    Re: CPAN packages and makefiles for 5.004 on 95/NT (Gurusamy Sarathy)
        finding file name from partial information <Robert.Lopez@abq.sc.philips.com>
    Re: Get the yesterday date ? (Mark-Jason Dominus)
        Help with Stripping charactes from strings based upon p (Russell S. Virgilio)
        Help! How do I call a C function from Perl? cathy_chiang@hotmail.com
    Re: hi (brian d foy)
    Re: hi (Mike Stok)
    Re: How do I get the hostname? <jefpin@bergen.org>
    Re: How does perl do "tail -n" ? (Earl Hood)
    Re: How does perl do "tail -n" ? (Craig Berry)
    Re: HOw to check for file existence in each home direct <ajohnson@gpu.srv.ualberta.ca>
    Re: HOw to check for file existence in each home direct (Clay Irving)
        IIS4.0 and PERL5 helphelp! <zeropage@computek.net>
        Need formatted print utility for perl <akarima@bnr.ca>
    Re: Need formatted print utility for perl (Clay Irving)
        Need perl customization for cpost <akarima@bnr.ca>
    Re: None (Earl Hood)
    Re: None (Faust Gertz)
        NOTICE:  Fix for Net::LDAPapi-1.40 (bad free & core dum <qa1049@ilms04.cig.mot.com>
        Perl and ORACLE problem  for win95 <mzelmanov@qquest.com>
    Re: perl and windows NT registry. <Jan@ChipNET.cz>
    Re: perl auto update: (Jonathan Stowe)
    Re: perl auto update: (Andrew M. Langmead)
    Re: POSIX (?) under perl for Win95 (Gurusamy Sarathy)
    Re: References to parent objects (Dan Sumption)
    Re: sysread vs <> and others (Andrew M. Langmead)
    Re: UNIX to %$$@! Win: Script Won't Go (Andrew M. Langmead)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 23 Jan 1998 20:08:16 GMT
From: klassa@aursgh.aur.alcatel.com (John M. Klassa)
Subject: /x regex mystery
Message-Id: <6aatbg$q0$1@aurwww.aur.alcatel.com>

Can somebody explain why this happens?

	% ./testing-2
	yes
	no

The script is:

	#!/usr/local/bin/perl -w

	$string = 'Tom Christiansen < tchrist@mox.perl.com >';

	print (($string =~ /Tom Christiansen.*perl.*com/)
	      ? "yes\n" : "no\n");

	print (($string =~ /Tom Christiansen .* perl .* com/x)
	      ? "yes\n" : "no\n");

Shouldn't the /x just make the spaces around ".*" go away, effectively?
Perl is "5.004_03" running on Solaris 5.5.1, FWIW.

Thanks,
John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><


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

Date: Fri, 23 Jan 1998 19:35:11 -0800
From: Jan Krynicky <Jan@ChipNET.cz>
Subject: Re: @ == @, comparing arrays
Message-Id: <34C9616F.95D@ChipNET.cz>

> In article <34C792B6.21A7@wco.com>, Steven Smith  <steves@wco.com> wrote:
>I had assumed that @a1 == @a2 would compare two arrays and
>tell me if they were the same.  It doesn't and that makes
>sense to me -- we're taking the arrays into scalar context
>and comparing the number of elements in each group, right?
>
>Is there an easy way to tell if all elements of the array
>are the same short of a short subroutine?

@a=(1,3,5);
@b=(1,3,5);


if (@a == @b) {
 $i=$#a;
 1 while ($a[$i] == $b[$i] and $i--);
 if ($i == -1)
 {
  print '(',join(', ',@a),' == ',join(', ',@b),")\n";
 } else {
  print "NO (they differ in the $i-th field)\n";
 }
}

Jenda


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

Date: Fri, 23 Jan 1998 11:46:22 -0800
From: Jean-Paul Cozzatti <jp@dkstat.com>
Subject: Buffered IO
Message-Id: <34C8F38E.483DAA78@dkstat.com>

Hi friends:

Are there any modules or  references regarding buffered I/O in perl.
Is there a "funky" variable I can set that will allow me to set the
block size?

Thank You,
Jean-Paul Cozzatti
Drogin, Kakigi & Associates





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

Date: 23 Jan 1998 12:50:04 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: CGI downloads
Message-Id: <6aal8c$9l9@stratus.CAM.ORG>

In article <885573898.754.0.nnrp-04.c246a73e@news.demon.co.uk>,
David Fisher <dfisher@adc.metrica.co.uk> wrote:
>I have a site which allows users to download compressed files successfully
                                              ^^^^^^^^^^^^^^^^
>by Internet explorer on the Windows system, but using Netscape on the UNIX,
>all that happens is the print-out. I can see the problem arises with the
>latter part of my code (below), but don't really know how do correct this.
>Any ideas (bearing in mind security issues etc)?
>
    [snip]

>print "Content-Disposition: form-data; name=$thing; filename=$thing;\n";
>print "Content-Type: text/plain\n\n";
                      ^^^^^^^^^^

Either you're lying to the browser, or to us...  Anyway, this is a CGI
problem, and will very likely be better answered in comp.infosystems.www.cgi

[Hint: try using "application/octet-stream" as the content-type]

Good luck,
Richard, wondering if a bug report should be sent to M$...  Naah!
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: 23 Jan 1998 19:56:45 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: chown -h
Message-Id: <6aaslt$q7d$5@plutonium.btinternet.com>

In article <sdjyb07yzc2.fsf@medtronic.com>, mark.moe@medtronic.com says...
>
>
>  (like the -h option to the unix chown)
>

Only some unices do that, I have a chown that would certainly refuse -h
I think its an SVR4 thing....

/J\



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

Date: 23 Jan 1998 17:14:11 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: CPAN packages and makefiles for 5.004 on 95/NT
Message-Id: <6aaj53$p00@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <34bbc49d.3234300@news.demon.co.uk>,
Chris Searle <chris_ns@searle1.demon.co.uk> wrote:
>On 13 Jan 1998 17:56:53 GMT, gsar@engin.umich.edu (Gurusamy Sarathy)
>wrote:
>>This is fixed in the DosGlob that comes with 5.004_04.
>
>OK. Leads me to ask if/where the FAQ/known bug list is for this?

perlwin32.pod contains notes.  The Changes file contains short
descriptions of bugfixes.  As for known bugs, you'll currently
need to look in a perl5-porters archive (dejanews has it).

I have heard there is a perl bug-tracking system in development,
so maybe something happy will emerge soon.

 - Sarathy.
   gsar@umich.edu





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

Date: 23 Jan 1998 09:58:40 -0700
From: Robert Lopez <Robert.Lopez@abq.sc.philips.com>
Subject: finding file name from partial information
Message-Id: <jc6btx3f7pb.fsf@abqn07.ato.sca.philips.com>


I need to find the complete name of a file when I only
know some of the characters of the file name.

I have failed at two approaches. 

First I tried to use
   $longerfilename = `ls $knowncharacters*`;
where * was a series of patterns that seem to fail
because the implementation of ls looks for them
literally and I could not find a way to have the
expression interpreted. I could get a correct answer
by using
   $longerfilename = `ls "$thedir" | egrep "$anexpression"`;
but that does not seem too portable.

Second I tried to read the directory. I am able to open
it and read it into an array. The file name I am
trying to isolate is in the array. I have not found
the right regular expression and code to pick it out.

I have data files that are named
   <pattern1>.ext
some examples of which are
   S725601.kdf
   S726302.kdf
   S727301.kdf
   S728601.kdf
   S731301.kdf

these files are processed by a program I have not
control of or access to and it creates names that are
named
   <pattern1>_<other>_<other>.pp
some examples of which are
   S725601_R6238a_2396q2.pp
   S726302_R6238bdf_2398q2.pp
   S727301_R6238_2396q2.pp
   S728601_Q13845a_2397tmt.pp
   S731301_S244523c_2396tmt.pp

Any help will be appreciated. I direct email would be
very much appreciated as my news server looses a lot
of news.

-- 
Robert.Lopez@abq.sc.philips.com



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

Date: 23 Jan 1998 15:44:56 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Get the yesterday date ?
Message-Id: <6aavg8$fi1$1@monet.op.net>

Clay's suggestion of using Date::Manip is good, but if you want a
smaller footprint solution to the same problem:

In article <6aafte$1d23@news.cie-bancaire.fr>,
Laurent HADOT <lhadot@cie-bancaire.fr> wrote:
>I search a little source in Perl to get the date of the las day 

use this:

my $time_yesterday = time() - 24*60*60;
my ($day, $month, $year) = (localtime($time_yesterday))[3,4,5];

This might fail under certain bizarre daylight savings time
conditions.


>the comparaison of the first date of a month and the last date of the
>precedent month, ...

This I don't follow.  But if the month and year are $month and $year,
then the first day of the month is `1', and you can compute the last
day of the previous month by using the method above:

	my $first_day_of_month = timelocal(0,0,12,1,$month,$year);
	my $last_day_of_previous_month = $first_day_of_month-24*60*60;
	my ($prev_day, $prev_month, $prev_year) = 
               (localtime($last_day_of_previous_month))[3,4,5];

For example, if $month is 2 (March) and $year is 96, this sets
	$prev_day	29
	$prev_month	1	(February)
	$prev_year	96

Caution: `localtime' and `timelocal' represent January as `0' and
December as `11', and represent the year 1997 as `97' and the year
2002 as `102'.



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

Date: 23 Jan 1998 19:17:44 GMT
From: ccastrv@acmex.gatech.edu (Russell S. Virgilio)
Subject: Help with Stripping charactes from strings based upon patterns
Message-Id: <6aaqco$oc8@catapult.gatech.edu>

I have this string that looks like this, and I want to pull out everything
after the .edu and also just the hm30_ leaving just the alias.  I am
having trouble finding good documentation and would appreciate any help
you gurus can dish out :)  Thanks in advance, here is a sample line

hme0  johnson.university.edu 255.255.255.255    07:00:20:8e:ef:5f

thanks again.

Russ

--
Everyone now knows how to find the meaning of life within himself.

 	- Kurt Vonnegut Jr.  "The Sirens of Titan"


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

Date: Fri, 23 Jan 1998 11:37:29 -0600
From: cathy_chiang@hotmail.com
To: cathy_chiang@hotmail.com
Subject: Help! How do I call a C function from Perl?
Message-Id: <885521732.394002433@dejanews.com>

I am having trouble figuring out how to call C functions from Perl.  I
have read through the perlstut man page.  Following are my questions
regarding the approach outlined in perlstut:

1) I was following example 1 in the man page.  When I run "perl
Makefile.pl", I get the following error message - "Undefined subroutine
&main::WriteMakefile called at Makefile.PL"  In the Makefile.PL, the
first line is "use ExtUtils::MakeMaker;" And I checked that I do have
that directory in the lib directory.  Have I forgot to include something?

2) In the Makefile.pl, how do I know what I need to fill in for 'LIB',
'DEFINE', and 'INC'

3) What is Mytest.pm?  What is its role in the integration?

4) Do I need to add code that is not C code in the definition of my C
function? (it looks like the case in Mytest.xs with MODULE=Mytest and
PACKAGE=Mytest)  Or is it enough to modify the Make file.  The ideal
situation would be that my C function as well as my perl call would not
have to have code at all for the Perl / C integration.	And the only
modification is all in the makefile.


I also looked briefly into SWIG from univerity of Utah.  How does this
tool help to simplify the process described in perlxstut man page?  Or
are they (the perlxstut man page & SWIG) two completely separate concepts
and approaches.

Thanks for all the help!  Your input is very very appreciated.

In addition to posting the answer, please email me as well.

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


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

Date: Fri, 23 Jan 1998 14:24:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: hi
Message-Id: <comdog-2301981424020001@news.panix.com>
Keywords: just another new york perl hacker

In article <34C846CE.D200BABB@ica.net>, Alexander Kovalenko <luckycom@ica.net> posted:

> hey guyz any idea how i can chmod file from my script ?

   perldoc -f chmod

-- 
brian d foy                                 <http://computerdog.com>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
some guyz are guys, and some aren't, and some that aren't are.


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

Date: 23 Jan 1998 15:01:04 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: hi
Message-Id: <6aasu0$1h3$1@stok.co.uk>

In article <34C846CE.D200BABB@ica.net>,
Alexander Kovalenko  <luckycom@ica.net> wrote:
>hey guyz any idea how i can chmod file from my script ?
>'cause it seems that just
>system ("chmod","660 test.dat");
>does not work out... so any ideaz would be appreciated!

perl has a builtin function called chmod.  If you have a recent perl
installation then perldoc -f <funcname> should get you documentation e.g.

[mike@stok mike]$ perldoc -f chmod
=item chmod LIST

Changes the permissions of a list of files.  The first element of the
list must be the numerical mode, which should probably be an octal
number, and which definitely should I<not> a string of octal digits:
C<0644> is okay, C<'0644'> is not.  Returns the number of files
successfully changed.  See also L</oct>, if all you have is a string.

    $cnt = chmod 0755, 'foo', 'bar';
    chmod 0755, @executables;
    $mode = '0644'; chmod $mode, 'foo';      # !!! sets mode to --w----r-T
    $mode = '0644'; chmod oct($mode), 'foo'; # this is better
    $mode = 0644;   chmod $mode, 'foo';      # this is best

The I<> and C<> are pod (plain old documentation markup)

Many of the routines in perl have names which are based on C library
calls, so if you know the name of the routine you'd use from C you can see
if perl has a similarly named function.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 23 Jan 1998 14:14:07 -0500
From: Watch your step <jefpin@bergen.org>
Subject: Re: How do I get the hostname?
Message-Id: <Pine.SGI.3.95.980123141034.25626A-100000@vangogh.bergen.org>

># What's the best way to get the hostname of the system I'm running on with perl?
># 
># Thanks,
># Mike
>
>$_= `hostname`;

I don't think that's very secure, not to mention it keeps a newline in the
variable... if you REALLY want to do that, at least do:
chop($hostname = `hostname`);

----------------
| "You care... but I don't care."
| 	- Ken Mayers
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
techmaster@mindless.com | jpinyan@sdf.lonestar.org
techie@continuum.eu.org | too many addresses!!!
** I can be found on #perl on irc.ais.net as jpinyan **

- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y? 



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

Date: 23 Jan 1998 17:56:03 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: How does perl do "tail -n" ?
Message-Id: <6aaljj$ahq@news.service.uci.edu>

In article <6aa9dr$sp0$1@news.ml.com>,
Michael Wang <mwang@alhena.ibk.ml.com> wrote:
>Do you have to read the entire file into memory? What happens if it is a
>10MB file? Thanks. 

How about (untested):

    my $n = 10;
    if ($ARGV[0] =~ /^-(\d+)$/) {
	$n = $1;
	shift @ARGV;
    }
     
    my @lines = ();
    while (<>) {
	push @lines, $_;
	shift @lines  if (@lines > $n);
    }   
    print @lines;

--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: 23 Jan 1998 18:59:33 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How does perl do "tail -n" ?
Message-Id: <6aapal$bkn$1@marina.cinenet.net>

Earl Hood (ehood@medusa.acs.uci.edu) wrote:
: In article <6aa9dr$sp0$1@news.ml.com>,
: Michael Wang <mwang@alhena.ibk.ml.com> wrote:
: >Do you have to read the entire file into memory? What happens if it is a
: >10MB file? Thanks. 
: 
: How about (untested):
: 
:     my $n = 10;
:     if ($ARGV[0] =~ /^-(\d+)$/) {
: 	$n = $1;
: 	shift @ARGV;
:     }
:      
:     my @lines = ();
:     while (<>) {
: 	push @lines, $_;
: 	shift @lines  if (@lines > $n);
:     }   
:     print @lines;

That should work.  My version runs faster, but would choke on a huge file;
Earl's is slower (thanks to maintaining that 'last n lines read' buffer),
but can handle arbitrarily large files.  Which one you use depends on how
big your files are and how much virtual memory you have to work with. 

---------------------------------------------------------------------
   |   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: Fri, 23 Jan 1998 10:49:33 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: HOw to check for file existence in each home directory of Unix users
Message-Id: <34C8CA1D.2323E8A8@gpu.srv.ualberta.ca>

Clay Irving wrote:
!
! 
! In <34C7CA56.198FA24F@bms.com> Dan Roberts <roberts_d@bms.com> writes:
! 
! >What I need to do is check for the existence of a .forward file in each
! >of my users homme directories.
! >Then, if there is no .forward file in the users hoem dir I would get
! >that users loginid
! >printed to a file.
! 
! Something like:
!   
! #!/usr/local/bin/perl -w
! 
! # open the password file
! open PWD, "/etc/passwd" or die "Can't open password file: $!\n";
! while (<PWD>) {
!   chomp;
! 
! # split on ":"
!   @contents = split /\:/;
! 
! # get the userid and home directory -- 1st and 6th elements of the array
!   ($userid,$home_dir) = @contents[0,5];
! 
! # if the home directory exists
!   if (-d $home_dir) {

[start-mark]

! # open the home directory and read it into an array
!     opendir HOME, "$home_dir" or die "Can't open $home_dir: $!\n";
!     @files = readdir HOME;
! 
! # grep the array for ".forward"
!     @found = grep(/^\.forward$/, @files);
! 
! # if ".foward" is found print "userid has a .forward file"
! # if you want to print this to a file, open a file for writing before
! # the while statement and print to it.
! # Example: print FH "** $userid has a $found[0] file **\n";
!     if ($#found >= 0) {
!       print "** $userid has a $found[0] file **\n";
!     }

[end-mark]
 
! # If the user's home directory wasn't found, print a warning
!   } else {
!     print "$userid has no home directory.\n";
!   }
! }
! 
! # close the password file
! close PWD;

couldn't you avoid some extra work and replace the code between the
[mark]'s above to just test for the .forward file directly rather
than reading in each users HOME directory and grepping for
 .forward files:

if (-f "$home_dir/.forward") {
    print "** $userid has a .forward file **\n";
}


regards
andrew


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

Date: 23 Jan 1998 14:57:35 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: HOw to check for file existence in each home directory of Unix users
Message-Id: <6aasnf$ke@panix.com>

In <34C8CA1D.2323E8A8@gpu.srv.ualberta.ca> Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

>Clay Irving wrote:
>!
>! 
>! In <34C7CA56.198FA24F@bms.com> Dan Roberts <roberts_d@bms.com> writes:
>! 
>! >What I need to do is check for the existence of a .forward file in each
>! >of my users homme directories.
>! >Then, if there is no .forward file in the users hoem dir I would get
>! >that users loginid
>! >printed to a file.
>! 
>! Something like:
>!   
>! #!/usr/local/bin/perl -w
>! 
>! # open the password file
>! open PWD, "/etc/passwd" or die "Can't open password file: $!\n";
>! while (<PWD>) {
>!   chomp;
>! 
>! # split on ":"
>!   @contents = split /\:/;
>! 
>! # get the userid and home directory -- 1st and 6th elements of the array
>!   ($userid,$home_dir) = @contents[0,5];
>! 
>! # if the home directory exists
>!   if (-d $home_dir) {

>[start-mark]

>! # open the home directory and read it into an array
>!     opendir HOME, "$home_dir" or die "Can't open $home_dir: $!\n";
>!     @files = readdir HOME;
>! 
>! # grep the array for ".forward"
>!     @found = grep(/^\.forward$/, @files);
>! 
>! # if ".foward" is found print "userid has a .forward file"
>! # if you want to print this to a file, open a file for writing before
>! # the while statement and print to it.
>! # Example: print FH "** $userid has a $found[0] file **\n";
>!     if ($#found >= 0) {
>!       print "** $userid has a $found[0] file **\n";
>!     }

>[end-mark]
> 
>! # If the user's home directory wasn't found, print a warning
>!   } else {
>!     print "$userid has no home directory.\n";
>!   }
>! }
>! 
>! # close the password file
>! close PWD;

>couldn't you avoid some extra work and replace the code between the
>[mark]'s above to just test for the .forward file directly rather
>than reading in each users HOME directory and grepping for
>.forward files:

>if (-f "$home_dir/.forward") {
>    print "** $userid has a .forward file **\n";
>}

Absoultely. My brain wasn't quite awake yet...

I could have also used getpwent instead of opening the password file and
parsing it...

It just goes to show -- "There's alway more than one way to do it..."

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Fri, 23 Jan 1998 14:09:17 -0600
From: Bryan Ingram <zeropage@computek.net>
Subject: IIS4.0 and PERL5 helphelp!
Message-Id: <34C8F8ED.BD4D24C5@computek.net>

I just installed IIS4.0, and now I am trying to get Perl 5 working with
it, to no avail.

First, when I use the registry to associte .pl with perl.exe, it
continously hangs, and sends the perl.exe spiraling out of control.

When I associate it with perlis.dll it seems to work better, but with
this strange glitch ...
when running a script with IE, it prints the content-header out at the
top of the page, when running with netscape, it asks the person if they
want to download the script!

I've looked at all the documentation and I think I'm doing everything
right!

Any comments would be VERY much appreciated!



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

Date: Fri, 23 Jan 1998 12:38:35 -0500
From: Karima Ashraf <akarima@bnr.ca>
Subject: Need formatted print utility for perl
Message-Id: <34C8D59B.2302@bnr.ca>

Hi,

If you know of any shareware / freeware to print
perl scripts with syntax formatting (like cpost)
then kindly reply to this posting or e-mail 
at akarima@nortel.ca

Thanks

Karima


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

Date: 23 Jan 1998 15:00:36 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Need formatted print utility for perl
Message-Id: <6aast4$101@panix.com>

In <34C8D59B.2302@bnr.ca> Karima Ashraf <akarima@bnr.ca> writes:

[ posted and mailed ]

>If you know of any shareware / freeware to print
>perl scripts with syntax formatting (like cpost)
>then kindly reply to this posting or e-mail 
>at akarima@nortel.ca

How about:

  pb -- Freeware 
  http://www.arachnoid.com/lutusp/ftp/cgi/pb.txt
  Perl Beautifier -- This script processes Perl scripts, cleans up 
  and indents, like cb does for C 

Perl Reference: style guides
http://reference.perl.com/query.cgi?style

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Fri, 23 Jan 1998 12:35:28 -0500
From: Karima Ashraf <akarima@bnr.ca>
Subject: Need perl customization for cpost
Message-Id: <34C8D4E0.298B@bnr.ca>

Hello, 

I would like to print perl scripts
using cpost. If you have customized 
cpost to print perl scripts then 
kindly reply to this news posting or e-mail
at akarima@nortel.ca

Thanks,

Karima


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

Date: 23 Jan 1998 17:39:23 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: None
Message-Id: <6aakkb$a72@news.service.uci.edu>

In article <199801221958.NAA04438@Jupiter.Mcs.Net>,
Hal Wigoda                      <hwigoda@Mcs.Net> wrote:
>
>A associate of mine has a cgi form and script
>and he is getting the message "Document has no data".

If the program is written in Perl, the message usually implies
that a run-time error occured after the "Content-type: ..." and
other HTTP headers were sent.  Depending on your HTTP server
the error message may show up in the server log.

If not, you can wrap the main block of your program in an
eval { } statement.  After the eval, check $@, and if not
empty, you can print the message so it will show up in your
browser.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Fri, 23 Jan 1998 20:09:22 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: None
Message-Id: <34c9f530.2830078@news.wwa.com>

On Thu, 22 Jan 1998 13:58:54 -0600 (CST), hwigoda@Mcs.Net (Hal Wigoda
) wrote:

>A associate of mine has a cgi form and script
>and he is getting the message "Document has no data".

Good for your associate.  That sounds like a great script.  You should
share the code.  :-)

>The data aceepted by the form was not written to the flat file in his home 
>directory.

Was it suppose to?  Perhaps that's a feature and not a bug.  :-)

>Any help.

If you post the code to this group, we could look at it and see if it
is doing what you think it should be doing.  Yet, it is most likely
not a problem with Perl.  If you are using the Dr. Lincoln Stein's CGI
module
(http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html),
which I am sure you are, you can easily run the script from the shell
to make sure that the Perl part of the equation is doing what you
expect.  CGI.pm is a great way to save time by using code tested by
billions (give or take a couple) of folks. If the Perl part works,
then you need to take the your question to a place where folks deal
with non-Perl CGI questions.


HTH

Faust Gertz
Philosopher at Large


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

Date: Fri, 23 Jan 1998 11:25:30 -0600
From: Clayton Donley <qa1049@ilms04.cig.mot.com>
Subject: NOTICE:  Fix for Net::LDAPapi-1.40 (bad free & core dump)
Message-Id: <34C8D28A.4E715315@ilms04.cig.mot.com>

Hello,

If you are using the Net::LDAPapi 1.40 module, please note that when
using University of Michigan LDAP libraries, you may get bad free errors
or CORE dumps on some platforms.

Once I find out exactly which platforms are affected, I will release a
new patch.  The problem is related to the use of the 'ber_free' command
to free memory used by ldap_first_attribute and ldap_next_attribute.

The workaround is to make the following changes:

LDAPapi.pm:
Comment out or Delete line 637

LDAPapi.xs:
Comment out or Delete Lines 1098-1099

Then send mail to 'donley@cig.mot.com' with your Platform and API so
that I can ensure that this call is not made in the next version for
your environment.

Thank you and sorry for the inconvenience,

Clayton


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

Date: 23 Jan 1998 19:30:44 GMT
From: "Mikhail Zelmanov" <mzelmanov@qquest.com>
Subject: Perl and ORACLE problem  for win95
Message-Id: <01bd2834$56972b80$1a2bcbd0@mzelmanov.qquest.com>

Hi.

After I installed DBI 0.90 and DBD 47 for win95 test is not working.
How can I fix this problem?

Thanks. 
mailto:MZELMANOV@qquest.com

This is test output
-------------------------
C:\perl\DBI-0.90>perl -MTest::Harness -e "&Test::Harness::runtests();"
FAILED--no tests were run for some reason.

C:\perl\DBI-0.90>perl -MTest::Harness -e "$Test::Harness::verbose=1;
&Test::Harn
ess::runtests();"
FAILED--no tests were run for some reason.

C:\perl\DBI-0.90>perl -V

Summary of my perl5 (5.0 patchlevel 4 subversion 02) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    bincompat3=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='bcc32', optimize='-O', gccversion=
    cppflags='-DWIN32'
    ccflags ='-D_RTLDLL -DWIN32'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=n, randbits=15
  Linker and Libraries:
    ld='tlink32', ldflags =''
    libpth=c:\bc5\lib
    libs=import32.lib cw32mti.lib odbc32.lib odbccp32.lib
    libc=cw32mti.lib, so=dll
    useshrplib=undef, libperl=undef
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='', lddlflags='-Tpd'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING
  Built under MSWin32
  Compiled at Aug  9 1997 21:42:37
  @INC:
    C:\PERL\lib\site
    C:\PERL\lib
    c:\perl\lib
    c:\perl\lib\site
    c:\perl\lib\site
    .



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

Date: Fri, 23 Jan 1998 20:02:30 -0800
From: Jan Krynicky <Jan@ChipNET.cz>
Subject: Re: perl and windows NT registry.
Message-Id: <34C967D6.4B29@ChipNET.cz>

FELIPE wrote:
> 
> Someone could tell me how to create a key and a value in the windows NT
> registry.
>        Thanks.
 Depending on what port of Perl do you have you either have or need to
get
module Win32::Registry;

It is included in the ActveState/ActiveWare/Hip Communications Perl.
I think it is also in the Gerusamy Sarathy's port.

Try

#!/perl
use Win32::Registry;

$HKEY_LOCAL_MACHINE->Open('Software\Microsoft',$reg);

$reg->GetKeys(\@keys);

print "HKEY_LOCAL_MACHINE\\Software\\Microsoft\n";
foreach (@keys) {
 print "\t$_\n";
}

__END__

If you get "Cannot find Win32/Registry.pm ..." you have to check CPAN
for it.

Otherwise read the docs.

ActiveState -> c:\perl\docs\Perl-Win32\perlmod.htm or something

You may want to check Win32::Registry2.pm at
http://www.fmi.cz/private/Jenda .
(needs Win32::Registry, tested only on AS port.)
    better docs, added functionality, etc.

Jenda


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

Date: 23 Jan 1998 19:27:58 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: perl auto update:
Message-Id: <6aaqvu$q7d$1@plutonium.btinternet.com>

In article <34C86547.1D2DE812@xarch.tu-graz.ac.at>, 
jahnel@xarch.tu-graz.ac.at says...
>
>is it possible to reload a perl script every 10 seconds to put out new
>datas?
>Klaus
>
I suppose you could use the schedule service on NT or cron on unix but 
probably not with that granularity;-}

Or if this refers to a web page /CGI then you wnat to use the expiry time in 
your header but that isnt a perl question either.

/J\



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

Date: Fri, 23 Jan 1998 19:59:58 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: perl auto update:
Message-Id: <En967z.Ioy@world.std.com>

Jahnel Klaus <jahnel@xarch.tu-graz.ac.at> writes:

>is it possible to reload a perl script every 10 seconds to put out new
>datas?

You can get perl to output new data every ten seconds.

#!/usr/bin/perl -w
# count.pl - counts from 1 to ten
$|=1;
for $sec ( 1 .. 10) {
  print "$sec\n";
  sleep 10;
}

If something else is then interpreting the output of perl, whether you
see it or not depends on what that something else does. If you say:

   perl count.pl | sort -nr

You won't see the result the result until sort has collected all of
the lines of the perl script and processed them.

You can also run a perl script every 10 seconds, if the process
calling the perl script has some way of looping and some way of
pausing for a period of time. The script will reload and run each
time. For example from a shell prompt:

    for sec in 1 2 3 4 5 6 7 8 9 10; do perl script.pl;sleep 10;done

Now some people are probably thinking that I'm being a jerk because I
should have automatically assumed that you were referring to an action
initiated by a web browser, which contacted a HTTP server, which ran
your perl script to collect its output to feed back to the
browser. The issues are the same, however (from the point of view of
perl.) You either need to determine some way to get the HTTP server to
send partial information back to the browser. (which I'm not sure is
possible, check in the appropriate comp.infosystems.www.servers.*
newsgroup) or find some way for you to tell the browser to
programatically wait then reload your perl script (which for most
common browsers would involve some sort of javascript.)

-- 
Andrew Langmead


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

Date: 23 Jan 1998 17:22:18 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: POSIX (?) under perl for Win95
Message-Id: <6aajka$pfs@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <6a8j8q$bid$2@comdyn.comdyn.com.au>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>You will most likely need a newer version of perl. You can find
>Gurusamy Sarathy's version of perl 5.004 at
>
>http://www.perl.com/latest.html
>
>This one should have the POSIX stuff with it.

Unfortunately, no.  Win32 is not POSIX compliant and that perl is a
*Win32* port.  MS claims Windows NT is POSIX capable, but the POSIX
subsystem can't access the Win32 subsystem and vice versa, so it is
not much good.

 - Sarathy.
   gsar@umich.edu





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

Date: Fri, 23 Jan 1998 18:05:21 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Re: References to parent objects
Message-Id: <34c8da22.2589673@news.demon.co.uk>

On 22 Jan 1998 23:11:07 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:
>In article <34c77225.31485503@news.demon.co.uk>,
>	dan@gulch.demon.co.uk (Dan Sumption) writes:
>
>> I have hit a point where I have an object which needs to reference
>> some of its parent's properties, and although I can't see any problems
>
>object, parent.. Are you talking about blessed references and
>inheritance here?  You're using some of the terminology, but in the
>code you submitted you're not really using the methodology.

Sorry, getting my terminology in a twist again. Yes, they are blessed
objects, but I am using the term 'parent' wrongly. What I meant was
one blessed object (in my example, the page object) contains as one of
its properties a reference to another totally unrelated blessed object
(the file object in my example).

I guess what I called the 'child' object might more accurately be
called the 'member' object and the 'parent' is perhaps better
described as the 'container'. Or maybe that would be more
terminological abuse(!)

Anyway, my reasoning in thinking that this procedure is OK runs thus:
When destroying an object (the container), all of that object's
properties must first be destroyed. I imagine that this happens
automatically as part of the destruction process, before the container
goes out of scope completely. As part of this procedure, the member
object (which, if you remember, contains a reference to the container)
is destroyed. Hence, as there are no longer any references to the
container other than the container itself, it can now be safely (and
automatically) destroyed.

If I am right, the automated cleanup process will do all of the
destruction for me, because it ought to proceed in such a way that
there are never any loose references left flapping around. But I have
a niggly feeling that I'm missing something. Anyone care to enlighten
me?

Dan Sumption
http://www.hardnet.co.uk/dan/


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

Date: Fri, 23 Jan 1998 16:56:54 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: sysread vs <> and others
Message-Id: <En8xqv.7qD@world.std.com>

ml@gondwanaland.com (Mike Linksvayer) writes:

>In article <En6zCw.KK8@world.std.com>, Andrew M. Langmead <aml@world.std.com> wrote:
>>For regular disk files, sysread will turn into a huge performance
>>killer if the blocks you are reading are not multiples of the
>>filesystems blocksize.

>Are you saying that if my blocksize is 512 bytes and I do

>$offset = 0;
>$bytes = 2000;
>while (sysread(F,$buf,$bytes,$offset)) {
>   $offset += $bytes;
>}

>I would be better off using read?

That too. What I was thinking of was when you read small amounts of
data at a time. For example a file that has some sort of header
information, or blocks of data of some application appropriate length.

read(BMP, $buffer, 14) == 14 or die;
($magic, $size, $offset) = unpack "vVxxxxV",$buffer;
read(BMP, $buffer, 38) == 38 or die;
($headersize,$width,$height,$planes,$bpp,$compress_method,$bitmapsize,
$Hres,$Vres,$numcolors,$numsigcolors) = unpack "vVVvvVVVVVV", $buffer;
-- 
Andrew Langmead


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

Date: Fri, 23 Jan 1998 17:23:12 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: UNIX to %$$@! Win: Script Won't Go
Message-Id: <En8yyo.47z@world.std.com>

nmcnelly@bu.edu (N.A.F. McNelly) writes:

>Is there anyone who knows perl for Windows who can tell me what's
>going wrong here?

>His error messsage is:

>Can't open first gif. at C:\perl\datef\test.pl
>line 9, <stdin> chunk 1.

[code deleted]
>open (GIF,"start.gif") || die ("can't open first gif");

OK, you're emitting the error message "Can't open first gif" on line 9
when open fails. So that means that the open() must be failing. When
open fails, it also set the variable $! to give greater detail of why
it is failing.

If the error message says: "No such file or directory" then ensure.

1. That you have a file named "start.gif" in the current working
directory. 

2. That the current working directory when you run the program is
where you you think it is.

use Cwd;

print "Program started from ",cwd(),"\n";

If the program is running in a directory other than were the files
are, either run the program where the files are, or change the program
to specify to perl where to find them.

$path = 'c:/bitmaps/gifs';
open (GIF,"$path/start.gif") || die ("can't open first gif: $!");
-- 
Andrew Langmead


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

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

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