[10445] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4038 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 21 17:03:32 1998

Date: Wed, 21 Oct 98 14:00:26 -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           Wed, 21 Oct 1998     Volume: 8 Number: 4038

Today's topics:
        anyone need a regex to validate a 24 hour input? <avitala@macs.biu.ac.il>
    Re: anyone need a regex to validate a 24 hour input? <uri@fastengines.com>
        automatic garbage collection and memory leak <gulriz@cs.uchicago.edu>
    Re: automatic garbage collection and memory leak <rootbeer@teleport.com>
    Re: Boston.pm will be Quiz Kings [was] Randal's Big Day droby@copyright.com
        Can't Compile Perl 5.00502 on OSF1 box jdtrudel@my-dejanews.com
        DBI install problem hooni26@my-dejanews.com
    Re: Example Threads <sugalskd@netserve.ous.edu>
        Forks and other Utensils <jconley@pharmacy.com>
    Re: How to link Perl script (cgi) with ready-made Windo ullrich@math.okstate.edu
        How to view lexical variables in the Perl Debugger? terry@eecs.tulane.edu
    Re: How to view lexical variables in the Perl Debugger? <rootbeer@teleport.com>
    Re: I have a few elementary Perl problems (r j huntington)
    Re: Pattern Matching: Escaping Period Character <aqumsieh@matrox.com>
    Re: Perl & Y2K - booby trap code (Matt Knecht)
    Re: Perl and regular expressions - revisited <aqumsieh@matrox.com>
    Re: Perl and regular expressions - revisited <avitala@macs.biu.ac.il>
    Re: Perl Cookbook - is this the best perl book? <tmcgee@bondmarkets.com>
    Re: Prevent Export of Names <rootbeer@teleport.com>
    Re: Prevent Export of Names (David Alan Black)
    Re: Problem with perl scripts... (Daniel Beckham)
    Re: Scotch drinkers Unite! [was] Re: Raleigh.pm (Raleig <showie@uoguelph.ca>
        Script error:"did not produce a valid header", but runs shawn_paige@hotmail.com
    Re: Script error:"did not produce a valid header", but  <rootbeer@teleport.com>
    Re: strange qwirk with READ <rootbeer@teleport.com>
    Re: Strict and Global Variables <noel.sant@which.net>
    Re: Strict and Global Variables <rootbeer@teleport.com>
    Re: Testing a date (I R A Aggie)
    Re: Testing a date (Richard S. Holmes)
    Re: Tilde delimited parsing helllp@my-dejanews.com
    Re: Tilde delimited parsing (Tye McQueen)
        where download nmake.exe ? hooni26@my-dejanews.com
        Windows NT and Perl - File Structure - opendir & readdi (momus)
    Re: Windows NT and Perl - File Structure - opendir & re (Daniel Beckham)
    Re: Windows NT and Perl - File Structure - opendir & re <tmcgee@bondmarkets.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 21 Oct 1998 21:13:35 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: anyone need a regex to validate a 24 hour input?
Message-Id: <70lbsh$fjq$1@cnn.cc.biu.ac.il>

this Boolean sub verifies if an hour is a valid one (on a 24 hour system).
it accepts any plausible form:
e.g:
7
12
345
2:00
20-00
0000
etc.

##begin:
sub valid_hour {
 if ($_[0] =~ m/
     ^\s*
      \d      # case 1
       \s*$
      |
     ^\s*
      \d([:-]?[0-5]\d)?   # case 2
          \s*$
      |
     ^\s*
      0\d([:-]?[0-5]\d)?   # case 3
          \s*$
      |
     ^\s*
      1\d([:-]?[0-5]\d)?   # case 4
          \s*$
      |
     ^\s*
      2[0-3]([:-]?[0-5]\d)?  # case 5
          \s*$
      |
     ^\s*
      24([:-]00)?    # case 6
        \s*$
           /x
            ) {
  1;
 } else {
  0;
 }
}

Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il





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

Date: 21 Oct 1998 15:46:29 -0400
From: Uri Guttman <uri@fastengines.com>
Subject: Re: anyone need a regex to validate a 24 hour input?
Message-Id: <sarems1n1ey.fsf@camel.fastserv.com>

>>>>> "AA" == Avshi Avital <avitala@macs.biu.ac.il> writes:

in general it has been shown that separate regexes linked with boolean
logic is a simpler and better method than alternation. this would be far
easier to read (and probably faster) with something like this:

sub valid_hour {


	return 1 if $_[0] =~ m/^\s*\d\s*$/ ; # case 1

	return 1 if $_[0] =~ m/^\s*\d([:-]?[0-5]\d)?\s*$/ ; # case 2

etc.

	return 0 ;	# failure
}

also you should use non-grabbing groups with (?:) since you don't use any
of the groups later.


  AA> ##begin:
  AA> sub valid_hour {
  AA>  if ($_[0] =~ m/
  AA>      ^\s*
  AA>       \d      # case 1
  AA>        \s*$
  AA>       |

<snip>

  AA>      ^\s*
  AA>       24([:-]00)?    # case 6
  AA>         \s*$
  AA>            /x
  AA>             ) {
  AA>   1;
  AA>  } else {
  AA>   0;
  AA>  }
  AA> }


-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Wed, 21 Oct 1998 19:17:08 GMT
From: Gulriz Aytekin Kurban <gulriz@cs.uchicago.edu>
Subject: automatic garbage collection and memory leak
Message-Id: <ljd87lsp1n.fsf@gargoyle.cs.uchicago.edu>



Hi,

I recently started programming in Perl. One of the programs I wrote
uses up 1Mb memory at every cycle of a while loop. But, since all my
variables are lexically scoped within the innermost block possible,
Perl is supposed to reclaim the space(garbage collection), then
reallocate it. I use OOP. It looks like Perl is not throughly cleaning
up the space no longer used. I dynamically allocate arrays within
objects, and if this was C++, I had to explicitely "delete" all such
arrays. But, Perl claims to do this automatically as long as I do not
have circular references, and I don't. Yet, it is quite obvious that
it is not doing it.

Could you please suggest another possible reason that would explain
the memory leak? I ruled out most of the possible programming
mistakes. I checked, for instance, if Perl attempts to destroy the
objects created when they are supposed to be out of scope by using the
DESTROY subroutine. It does attept to destroy them, but somehow can't
reclaim all of the memory  objects used up. 

My OOP experience with Perl has been rather a dissappointment. Could you
please give me some suggestions on how to go about programming with
object in Perl?

Gulriz



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

Date: Wed, 21 Oct 1998 20:35:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: automatic garbage collection and memory leak
Message-Id: <Pine.GSO.4.02A.9810211332290.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998, Gulriz Aytekin Kurban wrote:

> One of the programs I wrote uses up 1Mb memory at every cycle of a
> while loop. But, since all my variables are lexically scoped within
> the innermost block possible, Perl is supposed to reclaim the
> space(garbage collection), then reallocate it.

Yes, so long as you aren't leaving circular references.

> Could you please suggest another possible reason that would explain
> the memory leak? 

A leak in your system routines, or a leak in Perl. Are you using an old
version of Perl? Many leaks were plugged in the 5.004 release.

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 21 Oct 1998 18:45:14 GMT
From: droby@copyright.com
Subject: Re: Boston.pm will be Quiz Kings [was] Randal's Big Day in Big D
Message-Id: <70la3q$faf$1@nnrp1.dejanews.com>

In article <362CFFA0.5BDD9460@min.net>,
  John Porter <jdporter@min.net> wrote:
> Adam Turoff wrote:
> >
> > The world can be divided into two equal parts -
> > New York and Greater New York.  Youse gotta problem wit dat?
>
> Everyone seems to be forgetting that all of North America
> should properly by called Virginia.  At least, according to some
> (rather old) maps I have.  :-)
>

And here I thought I lived in Vinland.  ;-)

And the natives might have older maps yet, if they made maps.

--
Don Roby
droby@copyright.com

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


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

Date: Wed, 21 Oct 1998 20:20:35 GMT
From: jdtrudel@my-dejanews.com
Subject: Can't Compile Perl 5.00502 on OSF1 box
Message-Id: <70lfmj$nj0$1@nnrp1.dejanews.com>

I have a problem compiling Perl 5.00502 on my Alpha Server.

I run "sh Configure" and I accept all defaults, but when it starts on the make
dependencies, I get a lot of the following output:

make depend MAKEDEPEND=
sh ./makedepend MAKE=make
make depend MAKEDEPEND=
sh ./makedepend MAKE=make


[repeated almost ad infinitum]

until...

task_create() failed for pid 437: maxuprc 9=2560 exceeded for uid 6671.
task_create() failed for pid 437: maxuprc 9=2560 exceeded for uid 6671.

[also ad infinitum]

Obviously, the make depend is respawning until I can't start any processes.

What can I do to correct this problem?

Thanks!

Jon Trudel

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


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

Date: Wed, 21 Oct 1998 20:26:26 GMT
From: hooni26@my-dejanews.com
Subject: DBI install problem
Message-Id: <70lg1h$o28$1@nnrp1.dejanews.com>

os : window98

DBI(oracle) install problem



perl makefile.pl    <enter>

*** Warning:
    The optional pRPC-modules (RPC::pClient etc) are not installed.
    The DBD::Proxy driver and DBI::ProxyServer won't work without them.
    (Note that the Storable module is also needed.)
    You can install them after installing the DBI.
    You do not need these modules for basic DBI usage.

Optional modules are available from any CPAN mirror, in particular
    http://www.perl.com/CPAN/modules/by-module
    http://www.perl.org/CPAN/modules/by-module
    ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module

Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
[-nolinenumb ers] [-s pattern] [-typemap typemap]... file.xs Writing Makefile
for DBI

    Remember to actually *read* the README file!
    Build, TEST and INSTALL Perl 5 first.
    Do NOT build the DBI under the Perl source tree.
    Use 'make test' to execute self tests.
    Use 'make install' to install the DBI and then delete this working
    directory before unpacking and building any DBD::* drivers.






dmake   <enter>

DMAKE.EXE:  makefile:  line 843:  Error -- Expecting macro or rule defn,
found n either


what problem ????????

i don't know






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


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

Date: 21 Oct 1998 20:04:56 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Example Threads
Message-Id: <70lep8$bls$1@news.NERO.NET>

Jonkers <snif.nospamplease@xs4all.nl> wrote:
: Steve Wells wrote in message <362CBE49.EF62C1C1@cedarnet.org>...
:>If anyone would be so kind as to point me to an
:>example program using threads in PERL I'd really
:>appreciate it.  I have never programmed using
:>threads and would very much like to try my hand
:>at them...

: Have a look at the most The Perl Journal, order via www.tpj.com

Second most recent, actually. Issue #10. #11 is the current, for some
reasonably loose version of current.

					Dan


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

Date: Wed, 21 Oct 1998 15:29:39 -0400
From: Jordan Conley <jconley@pharmacy.com>
Subject: Forks and other Utensils
Message-Id: <362E3623.D9799806@pharmacy.com>

Hey all- I have justed finished developing a timeclock system in Perl
that contacts the timeclocks, gets the punches from them and inserts
these punches into out database after some manipulation. Here is my
situation- I will ghave 500 clocks which I need to contact every
night(each clock taking approximately 3-5 minutes), so I have decided
that I must fork off several sub-processes inorder to accomplish this in
my time window (approximately 30 minutes) because it takes a signifigan
amount of time to add the 6000 punches I am expecting each night into
the data base after analyzing them for things like missed and doubled
punches. My questions are this:

How many forks are safe?? THis will be running on an AIX box with 4 64
bit processors(not really necessary but the box is used for other things
and I might as well use it eh??) so, resources are not really an issue.
but is there a limit I should observe?? The clocks are Ethernet
based(IP) so do I need to worry about netowrk resource overload??? 

Also, what is the best way to implemeent these forks- I would like to be
able to call a fork to a subroutine, but i don't have much experience
with IPC. the only thing I really care about though is the exit signal,
because if it fails I just need to run it again(it will pick up with the
next punch stored on the clock) 

Ok, well I hope that someone can help me...I appreciate it.

Jordan
 
-- 
Jordan Conley
RoTech Medical
407-839-8588 ext. 206


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

Date: Wed, 21 Oct 1998 18:24:03 GMT
From: ullrich@math.okstate.edu
Subject: Re: How to link Perl script (cgi) with ready-made Windows application ?
Message-Id: <70l8s3$dc2$1@nnrp1.dejanews.com>

In article <362CDEAC.17A5@usa.net>,
  dariusz@usa.net wrote:
> Hi,
> how can I transfer parameters from CGI-Perl application (input from web
> page) into ready-made MS WIN application (search engine), running on PC,
> having no source code, no description do DLL files.
> Any chance to make such a data-link ?
> regards,

        This seems like more of a Windows question. There are various
things that _might_ work - without some documentation on the ready-made
search engine there's no way to say.

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


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

Date: Wed, 21 Oct 1998 19:20:48 GMT
From: terry@eecs.tulane.edu
Subject: How to view lexical variables in the Perl Debugger?
Message-Id: <70lc6f$i22$1@nnrp1.dejanews.com>

Hello,

How can I view the value of a lexical variable (my $foo) in the perl
debugger. I am familiar with the V[pkg[vars]] and X[vars] commands but can
only make them work for global variables.

Thanks,
--
Nicole Deflaux Terry
Department of EECS
Tulane University
http://www.eecs.tulane.edu/Terry

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


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

Date: Wed, 21 Oct 1998 20:36:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to view lexical variables in the Perl Debugger?
Message-Id: <Pine.GSO.4.02A.9810211336150.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998 terry@eecs.tulane.edu wrote:

> Subject: How to view lexical variables in the Perl Debugger?

    x $lexical
    x \%hash
    x \@array

Have you tried the debugger's help command, h? Have fun with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 21 Oct 1998 19:19:03 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Re: I have a few elementary Perl problems
Message-Id: <70lc37$i8g$1@news.monmouth.com>

:  What I really want is:
:  
:  system ("remsh $_ command" > /home/ilya/web/sysinfo/$_/test.$_)

I'm pretty sure what you really want is:

system ("remsh $_ command \">\" /home/ilya/web/sysinfo/$_/test.$_");

You must quote the redirection operator in order to have the output
redirected locally. And note the quotes around the entire command line.

Did you try this?	-rh-



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

Date: 21 Oct 1998 14:43:12 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Pattern Matching: Escaping Period Character
Message-Id: <x3yogr5dadb.fsf@tigre.matrox.com>


Chi Yu <chi@cybie.com> writes:

> 
> Greetings,
> 
> Can some kind soul please tell me how to match on a period (the
> character period) in a regular expression? A bare period in the regular

Escape it (as you mentioned!) .. As far as I know, there is one and
ONLY one escape character which is the backslash (\) .

>    nn.nn where n is a digit

/\d{2}\.\d{2}/

> 
> Thanks,
> Chi Yu

Hope this helps,
-- 
Ala Qumsieh               email: aqumsieh@matrox.com
ASIC Design Engineer      phone: (514) 822-6000 x7581
Matrox Graphics Inc.      (old) webpage :
Montreal, Quebec          http://www.cim.mcgill.ca/~qumsieh


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

Date: Wed, 21 Oct 1998 19:46:21 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <hSqX1.68$6J3.1149167@news2.voicenet.com>

Gisle Aas <aas@sn.no> wrote:
>
>We never see these Y2K threads in comp.lang.python.  I conclude that
>something must be wrong with Perl.  I really wished Larry had decided
>to fix the struct values like Gudio did.

Fix?  Fix how people read the docs?

Why is this a century bug, and blamed on Perl|C|Java|COBOL (Of course,
substitute proper syntax for the language concerned), and not the
programmer?

perl -we 'print "The year is 19", (localtime)[5], "\n"'


But this next line of code, which is wrong for the *same* *exact*
*reason*, isn't considered the fault of Perl, but a lazy programmer:

perl -we 'print "The date is ", localtime, "\n"'


In fact, the second example isn't even really wrong!  It just prints the
correct date out in a hard to read format.  Why don't we see articles
that lament code like this:

#include <time.h>
#include <sys/types.h>
int main (int argc, char **argv)
{
    printf("The date is: %s\n", localtime(time(0)));
    exit 0;
}

It's wrong for the same *exact* reasons as the other code examples.

If you're unsure what that reason is, it's because the programmer
didn't read the docs.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 21 Oct 1998 15:17:29 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl and regular expressions - revisited
Message-Id: <x3yn26pd8s6.fsf@tigre.matrox.com>

"Jason Puyleart" <puyleart@netconcepts.com> writes:

>     I need to evaluate a variable in a regular expression:
> 
> $foo = 'Hello (World'
> 
> if ($bar =~ /$foo/)
> 
>     The problem is that the interpreter thinks that 'Hello (World' is
> missing a left parenthese (indeed it is if I wanted to evaluate it that
> way), but I want to evaluate the string in the variable.
> 
> Is there anything I can do to prevent this from happening?

You can switch off your computer :)
Alternatively, you can use the \Q and \E options in regexps

if ($bar =~ /\Q$foo/)

Have another look at perlre for more information.

-- 
Ala Qumsieh               email: aqumsieh@matrox.com
ASIC Design Engineer      phone: (514) 822-6000 x7581
Matrox Graphics Inc.      (old) webpage :
Montreal, Quebec          http://www.cim.mcgill.ca/~qumsieh


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

Date: Wed, 21 Oct 1998 21:58:57 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: Re: Perl and regular expressions - revisited
Message-Id: <70lehj$lr8$1@cnn.cc.biu.ac.il>

>>     I need to evaluate a variable in a regular expression:
>>
>> $foo = 'Hello (World'
>>
>> if ($bar =~ /$foo/)
>>
>>     The problem is that the interpreter thinks that 'Hello (World' is
>> missing a left parenthese (indeed it is if I wanted to evaluate it that
>> way), but I want to evaluate the string in the variable.
>>
>> Is there anything I can do to prevent this from happening?


if ($bar =~ /\Q$foo\E/)

Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il






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

Date: Wed, 21 Oct 1998 16:00:29 -0400
From: Tom McGee <tmcgee@bondmarkets.com>
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <362E3D5D.4169@bondmarkets.com>

Me, I'm gratefully printing out the errata and I'll hand-correct my book
on the train tonight. Errors or not, it's already paid for itself.

Tom McGee

- - - - - - - - - - -

PM Jenkins wrote:
> 
> In article <70foh8$c13$1@nnrp1.dejanews.com>, paulwade@my-dejanews.com wrote:
> >In article <6vv8h6$799$1@nnrp1.dejanews.com>,
> >  lqyrms@nottingham.ac.uk wrote:
> >> Could anybody who has read the Perl Cookbook please tell me if this is the
> >> best perl book to get. There are a couple of reviews of this book at amazon
> >>  http://www.amazon.com/exec/obidos/ASIN/1565922433/bibs/  , but I would
> >> appreciate the views of the experts in this newsgroup too.
> >>
> >
> >Depends what you mean by 'best' and for what purpose. However, it is an
> >excellent book.
> 
> I suggest that people buy this book when the next
> release comes out.  There are SO MANY typos/bugs/... in this book
> (757 of them).  Probably you don't want to hand-fix them by marking
> over 757 spots. Nor do you want to attach/insert 27 pages of bug listing
> in the book.  My guess is that after authors typed in, they never looked it
> back until the book printed out.  Authors argue that 757 bugs are very
> small comparing the size (less than 1 bugs / page !).  Gees what an
> attitude !!  I think that they owe an apology to the buyers for publishing
> such a screwed-up error-ridden version.
> One question that I had was, how come authors ended up typing
> variables in all CAPS ?  Are they MS-DOS or VMS users ?
> 
> PM Jenkins


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

Date: Wed, 21 Oct 1998 20:20:30 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Prevent Export of Names
Message-Id: <Pine.GSO.4.02A.9810211317120.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998, Joachim Zobel wrote:

> I have modules where I only want to export a limmited set of
> functions. I have noticed that functions are exported even if I don't
> list them as EXPORT_OK. Is there a way to stop this?

The Exporter should export only functions which are listed within @EXPORT
or @EXPORT_OK.

> I am importing them into main by using require and calling them by
> their module::function names.

That's not exporting them! Read the docs for Exporter and call the module
and functions the right way.

If you _really_ want private functions, you can store a coderef in a my()
variable. But that's not a good use of such excessive paranoia.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 21 Oct 1998 16:23:03 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Prevent Export of Names
Message-Id: <70lfr7$els$1@pilot.njin.net>

Hello -

jzobel@my-dejanews.com (Joachim Zobel) writes:

>Hi.

>Heres another one from the C++ programmers road to perl. 

>I have modules where I only want to export a limmited set of
>functions. I have noticed that functions are exported even if I don't
>list them as EXPORT_OK. Is there a way to stop this?

>I am importing them into main by using require and calling them by
>their module::function names.


You can create a *really* private subroutine by assigning an anonymous
subroutine reference to a lexical variable:

my $hidden = sub { print "I ain't goin' nowhere\n" };

As far as I know, that's the only way to prevent peekage.


David Black
dblack@pilot.njin.net


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

Date: Wed, 21 Oct 1998 15:02:18 -0400
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: Problem with perl scripts...
Message-Id: <MPG.1097f9c0f470d56198969c@news.supernews.com>

Oh, I forgot this...  Two major errors here.  Variable substitution, etc. 
doesn't take place inside of '', so in order for you newlines to work, 
you should use double qotes.  e.g. "Hello World.\n\n";

Also, /n isn't a new line.  It should be \n

Regards,
Daniel Beckham

In article <70kq0i$p52$1@nnrp1.dejanews.com>, hyytiainen@edu.h4thol.fi 
says...

>  print 'Hello world./n/n';


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

Date: 21 Oct 1998 19:27:19 GMT
From: Steve Howie <showie@uoguelph.ca>
Subject: Re: Scotch drinkers Unite! [was] Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <70lcin$mp$2@testinfo.uoguelph.ca>

Brad Murray <murrayb@vansel.alcatel.com> wrote:
: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:

:> Bowmore! I just bought a bottle last weekend! mmmmmm. Glenfarclas is
:> right up there Highland park is good too but I prefer a The Macallan 25
:> if I can :). Laphroig takes a special mood. A peaty one.

: Just have to put my bids in now---I found Bowmore quite dull, although
: there's a cask strength out there that's very tasty.  Recently we in
: Canada had the good fortune of receiving the big seven from United
: Distilleries, which has renewed my taste for the islands---Talisker and
: Lagavulin are both big favourites around our house now.  Highland Park
: is our staple.  I have heard people rave about the Macallan 25, but I
: was not terribly impressed.  I wasn't put off, either, I just found that
: it lacked distinction.

Isn't the unanimity in identifying the best malts amazing? :)

Scotty
-- 
Steve Howie					root@127.0.0.1
Netnews and Listserv Admin			519 824-4120 x2556
University of Guelph			
"If it's not Scottish it's CRRRRAAAAAAAPPPPPP!"


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

Date: Wed, 21 Oct 1998 18:48:47 GMT
From: shawn_paige@hotmail.com
Subject: Script error:"did not produce a valid header", but runs ok from command line
Message-Id: <70laaf$fki$1@nnrp1.dejanews.com>

I have written a script to submit remotely, an example of which follows. It
runs correctly from the command line, when I type "perl name.pl". However,
when it is called through a browser, the following error is reported on my
server:

[21/Oct/1998:14:38:11] failure: for host xxx.xxx.xxx.xxx trying to GET
/cgi-bin/name.pl, cgi-parse-output reports: the CGI
 program /server-path/cgi-bin/new2.pl did not produce a valid header (name
without value: got line "http/1.1 200 ok")

What can I do to fix this? Sample code which causes the above error follows.

#!/usr/sbin/perl

  use HTTP::Request::Common qw(POST);
  use LWP::UserAgent;
  $ua = new LWP::UserAgent;

  my $req = POST 'http://education.oracle.com/search/search.cgi',  [ search
=> 'windows', mode => 'concept', sp => 'sp', submit => 'Search' ];

  print $ua->request($req)->as_string;

Thanks for your time,
Shawn D. Paige

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


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

Date: Wed, 21 Oct 1998 20:30:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Script error:"did not produce a valid header", but runs ok from command line
Message-Id: <Pine.GSO.4.02A.9810211330040.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998 shawn_paige@hotmail.com wrote:

> Subject: Script error:"did not produce a valid header", but runs ok from

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 21 Oct 1998 20:23:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: strange qwirk with READ
Message-Id: <Pine.GSO.4.02A.9810211322450.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998, William Smith wrote:

> When run on NT I find that one particular dbase file will not read
> properly,

binmode? See perlfunc. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 21 Oct 1998 20:29:19 +0100
From: "Noel Sant" <noel.sant@which.net>
Subject: Re: Strict and Global Variables
Message-Id: <70lcrq$c7g$1@nclient1-gui.server.which.net>

Yes, but what's the solution if you've been told "use 'use strict' or know
why not", and you like to keep large subroutines in different files?
So far I've only found the idea of declaring a variable 'local $::var;" in
the top module (file), then using $::var throughout. Modules written by
other people are OK if they don't use 'use strict', I suppose you have to
amend them if they do.

But now I've seen "another reason not to use dynamically scoped variables"
(i.e. 'local'). So what the devil's a poor programmer to do?

Regards,

        Noel Sant

Ala Qumsieh wrote in message ...
>On 20 Oct 1998, Uri Guttman wrote:
>
>    >   AQ> Declaring your variables as lexical variables (using my()) will
>    >   AQ> localize them to your enclosing block. Thus, declaring my()
>    >   AQ> variables at the "outermost level of code" will make these
>    >   AQ> variables visible from everything within your program;
>    >                                                     ^^^^^^^
>    >   AQ> effectively, these variables becomes global to your program.
>    >                                                           ^^^^^^^
>    >
>    > these my variables are global to the file, not the program. if you
>    > included other perl code via use or require, that code would not see
>    > these my vars.
>    >
>    > your comment is only true if the program is a single file of perl
code
>    > with no outside code read in.
>
>That is correct .. I know that and I guess I should've been clearer with
>my reply. When I said "your program" I meant "your file" .. although, as
>you said, that is not generally true.
>
>Shall I slap myself again?
>
>--
>Ala Qumsieh               email: aqumsieh@matrox.com
>ASIC Design Engineer      phone: (514) 822-6000 x7581
>Matrox Graphics Inc.      (old) webpage :
>Montreal, Quebec          http://www.cim.mcgill.ca/~qumsieh
>




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

Date: Wed, 21 Oct 1998 20:38:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Strict and Global Variables
Message-Id: <Pine.GSO.4.02A.9810211337180.5534-100000@user2.teleport.com>

On Wed, 21 Oct 1998, Noel Sant wrote:

> Yes, but what's the solution if you've been told "use 'use strict' or
> know why not", and you like to keep large subroutines in different
> files?

I think you want package variables.

> So far I've only found the idea of declaring a variable 'local $::var;" in
> the top module (file), then using $::var throughout.

Naw, you don't want to do that. Instead of using variables from main, use
ones in your own package.

> Modules written by other people are OK if they don't use 'use strict',
> I suppose you have to amend them if they do.

I can't see why you would. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 21 Oct 1998 15:28:30 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Testing a date
Message-Id: <fl_aggie-2110981528300001@aggie.coaps.fsu.edu>

In article <xzck91t4vzi.fsf@rodan.syr.edu>, rsholmes@rodan.syr.edu
(Richard S. Holmes) wrote:

+ The problem is with the problem, which was ill-defined.  In what
+ context are we checking a date?

You're absolutely correct.

+ Does it need to understand the Jewish calendar?  The Chinese calendar?

Ah, what is a "date"? and who's? How about a Mayan calendar, and maybe one
from Summeria? just for grins.

+ Does it have to cope with the fact that Sweden (I think) once --
+ literally, *once* -- had a February 30?

Say it ain't so! Given that time/calendaring is one of my interests,
I'm interested in finding out more information on this!

+ Never solve a problem until the problem is clearly understood.

Tell that to my boss... ;)

James


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

Date: 21 Oct 1998 16:10:43 -0400
From: rsholmes@rodan.syr.edu (Richard S. Holmes)
Subject: Re: Testing a date
Message-Id: <xzchfwxoev0.fsf@rodan.syr.edu>

In article <fl_aggie-2110981528300001@aggie.coaps.fsu.edu> fl_aggie@thepentagon.com (I R A Aggie) writes:

>In article <xzck91t4vzi.fsf@rodan.syr.edu>, rsholmes@rodan.syr.edu
>(Richard S. Holmes) wrote:
>+ Does it have to cope with the fact that Sweden (I think) once --
>+ literally, *once* -- had a February 30?
>
>Say it ain't so! Given that time/calendaring is one of my interests,
>I'm interested in finding out more information on this!

Quoting from
<http://www.geocities.com/CapeCanaveral/Lab/7671/gregory.htm>: 

   Sweden has a curious history. Sweden decided to make a gradual change
   from the Julian to the Gregorian calendar. By dropping every leap year
   from 1700 through 1740 the eleven superfluous days would be omitted
   and from 1 Mar 1740 they would be in sync with the Gregorian
   calendar. (But in the meantime they would be in sync with nobody!)

   So 1700 (which should have been a leap year in the Julian calendar)
   was not a leap year in Sweden. However, by mistake 1704 and 1708
   became leap years. This left Sweden out of synchronisation with both
   the Julian and the Gregorian world, so they decided to go _back_
   to the Julian calendar. In order to do this, they inserted an extra
   day in 1712, making that year a double leap year! So in 1712, February
   had 30 days in Sweden.

   Later, in 1753, Sweden changed to the Gregorian calendar by dropping
   11 days like everyone else.

-- 
- Rich Holmes
  Syracuse, NY /             We have more important things to do...
  Newport News, VA           Censure and move on!  Sign the petition at
  rsholmes@mailbox.syr.edu   <http://www.moveon.org>


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

Date: Wed, 21 Oct 1998 19:05:45 GMT
From: helllp@my-dejanews.com
Subject: Re: Tilde delimited parsing
Message-Id: <70lba9$gt4$1@nnrp1.dejanews.com>

ParseRat (http://www.guysoftware.com/parserat.htm) will handle this and other
similar needs in a single pass. Just open the file, tell it that your file is
~ delimited. Select all of the fields from the "input" display to go into the
"output" display.  Tell that you want the output | delimited. Output as a new
file. ParseRat can also restructure, parse out components, convert formats
etc. if you need.

In article <362B74FA.28AF@idiom.com>,
  marx@idiom.com wrote:
> Hello, I'm trying to parse a tilde delimited text file into a pipe
> delimited text file.  It seems some of the fields contain no value but
> still need to be accounted for. I'm able to parse the tilde delmited
> text file but once the file is parsed(into the pipe delimited file) the
> spaces vanish.
>
> Example of tilde delimited text file:
> REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS
>
> Current result:
> REC HEAD|016967|19980728|SAMPLE INSTRUCTIONS
>
> Possible solution:
> REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS
>
> Can anyone help
> thanks
> marcus
>

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


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

Date: 21 Oct 1998 14:28:22 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: Tilde delimited parsing
Message-Id: <70lckm$hc2@fohnix.metronet.com>

Input> REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS
Output> REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS

Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> writes:
) 
) 2. if you need to parse it for whatever reasons:
) 
)     while (<DATA>) {
)         chomp;
)         my @fields = split /~/;
)         ... do something to @fields ...
)         print join('|', @fields), "\n";
)     }

You mean

	my @fields = split /~/, $_, -1

or you'll lose trailing empty fields.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Wed, 21 Oct 1998 19:38:38 GMT
From: hooni26@my-dejanews.com
Subject: where download nmake.exe ?
Message-Id: <70ld7v$jkl$1@nnrp1.dejanews.com>

ftp.microsoft.com is not access

where is nmake.exe ?

please ....

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


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

Date: 21 Oct 98 19:40:28 GMT
From: pedantry@your.disposal (momus)
Subject: Windows NT and Perl - File Structure - opendir & readdir
Message-Id: <pedantry-2110981536260001@ppp-5200-0136.mtl.total.net>

I'm moving a set of perl scripts I wrote on Mac, and originally ran on Mac
an UNIX, over to an NT server.
The problem, which has become the bane of my existence, is that the
functions 'readdir' and 'opendir' don't seem to function.  They don't
create errors, but they also don't open the directory, or read its
contents.
I've tried using absolute and relative addresses. 
I've also tried using colon, forward-slash, back-slash, and double
back-slash delimiters.
I also tried using the 'cat' function, which also doesn't seem to work.

Does NT implement these functions in its version of PERL?
My thanks in advance for any help that can be offered.

Adam
aswan@eudoramail.com


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

Date: Wed, 21 Oct 1998 16:18:41 -0400
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: Windows NT and Perl - File Structure - opendir & readdir
Message-Id: <MPG.10980bada881f57298969e@news.supernews.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

Yep, they work fine for me.  Maybe you are using them incorrectly... can 
you post a snippit of code so we can take a look at how you are using 
these functions?

Regards,

Daniel Beckham

In article <pedantry-2110981536260001@ppp-5200-0136.mtl.total.net>, 
pedantry@your.disposal says...
> I'm moving a set of perl scripts I wrote on Mac, and originally ran on Mac
> an UNIX, over to an NT server.
> The problem, which has become the bane of my existence, is that the
> functions 'readdir' and 'opendir' don't seem to function.  They don't
> create errors, but they also don't open the directory, or read its
> contents.
> I've tried using absolute and relative addresses. 
> I've also tried using colon, forward-slash, back-slash, and double
> back-slash delimiters.
> I also tried using the 'cat' function, which also doesn't seem to work.
> 
> Does NT implement these functions in its version of PERL?
> My thanks in advance for any help that can be offered.
> 
> Adam
> aswan@eudoramail.com
> 


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

Date: Wed, 21 Oct 1998 16:24:39 -0400
From: Tom McGee <tmcgee@bondmarkets.com>
Subject: Re: Windows NT and Perl - File Structure - opendir & readdir
Message-Id: <362E4307.3301@bondmarkets.com>

This works for me on NT:

opendir (DIR, $folder)||die "can't open $folder";

		while ($filename = readdir(DIR)){do something}

where $folder is an absolute path i.e., $folder = "c:\\dir\\subdir"

--Tom

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

> I'm moving a set of perl scripts I wrote on Mac, and originally ran on Mac
> an UNIX, over to an NT server.
> The problem, which has become the bane of my existence, is that the
> functions 'readdir' and 'opendir' don't seem to function.  They don't
> create errors, but they also don't open the directory, or read its
> contents.
> I've tried using absolute and relative addresses.
> I've also tried using colon, forward-slash, back-slash, and double
> back-slash delimiters.
> I also tried using the 'cat' function, which also doesn't seem to work.
> 
> Does NT implement these functions in its version of PERL?
> My thanks in advance for any help that can be offered.
> 
> Adam
> aswan@eudoramail.com


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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