[19549] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1744 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 14 03:09:21 2001

Date: Fri, 14 Sep 2001 00:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1000451109-v10-i1744@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 14 Sep 2001     Volume: 10 Number: 1744

Today's topics:
        ANNOUNCE: Getopt::Declare 1.09 (Damian Conway)
    Re: file output <gnarinn@hotmail.com>
        Help needed using "CDONTS.NewMail" in Perl scripts (wit <batormaster666@hotmail.com>
        How to comment C++  code using a Perl Script (Sajith Satheesan)
    Re: mod_perl or PHP for database drive site? (Chris Fedde)
    Re: mod_perl or PHP for database drive site? <Thomas@Baetzler.de>
    Re: O Reilly online books <zkent@adelphia.net>
    Re: Perl (slurping) is TOO much fun <zkent@adelphia.net>
    Re: Perl (slurping) is TOO much fun <goldbb2@earthlink.net>
    Re: Perl (slurping) is TOO much fun <wyzelli@yahoo.com>
    Re: Perl (slurping) is TOO much fun <uri@sysarch.com>
    Re: Perl (slurping) is TOO much fun (Damian James)
    Re: Problems with format (perlform) and carriage return (Martien Verbruggen)
    Re: Problems with format (perlform) and carriage return (Martien Verbruggen)
    Re: recognize MS Windows with perl <zkent@adelphia.net>
    Re: Recommendations for a PERL editor (Tim Hammerquist)
    Re: Running perl scripts (katan8472)
    Re: Running perl scripts (Martien Verbruggen)
    Re: Source Code Bracket Matching Utility Needed (Martien Verbruggen)
    Re: Source Code Bracket Matching Utility Needed (Ralph Freshour)
    Re: Source Code Bracket Matching Utility Needed (Ralph Freshour)
    Re: Source Code Bracket Matching Utility Needed (Damian James)
    Re: Why the client still waits for input? (Villy Kruse)
        xml parser (tantu)
    Re: xml parser (Chris Fedde)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 14 Sep 2001 06:35:40 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Getopt::Declare 1.09
Message-Id: <9ns8fs$dhq$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release

==============================================================================
                  Release of version 1.09 of Getopt::Declare
==============================================================================


Getopt::Declare is *yet another* command-line argument parser, one which
is specifically designed to be powerful but exceptionally easy to use.

To parse the command-line in `@ARGV', one simply creates a
Getopt::Declare object, by passing `Getopt::Declare::new()' a
specification of the various parameters that may be encountered:

    $args = new Getopt::Declare($specification);

The specification is a single string such as this:

    $specification = q(

	    -a              Process all data

	    -b <N:n>        Set mean byte length threshold to <N>
				    { bytelen = $N; }

	    +c <FILE>       Create new file <FILE>

	    --del           Delete old file
				    { delold() }

	    delete          [ditto]

	    e <H:i>x<W:i>   Expand image to height <H> and width <W>
				    { expand($H,$W); }

	    -F <file>...    Process named file(s)
				    { defer {for (@file) {process()}} }

	    =getrand [<N>]  Get a random number
			    (or, optionally, <N> of them)
				    { $N = 1 unless defined $N; }

	    --              Traditionally indicates end of arguments
				    { finish }
    );

in which the syntax of each parameter is declared, along with a
description and (optionally) one or more actions to be performed when
the parameter is encountered. The specification string may also include
other usage formatting information (such as group headings or
separators) as well as standard Perl comments (which are ignored).

Calling Getopt::Delare::new() parses the contents of the array
@ARGV, extracting any arguments which match the parameters defined in
the specification string, and storing the parsed values as hash elements
within the new Getopt::Declare object being created.

Other features of the Getopt::Declare package include:

        * The use of full Perl regular expressions to constrain
          matching of parameter components.

        * Automatic generation of error, usage and version information.

        * Optional conditional execution of embedded actions (i.e. only
          on successful parsing of the entire command-line)

        * Strict or non-strict parsing (unrecognized command-line
          elements may either trigger an error or may simply be left in
          @ARGV)

        * Declarative specification of various inter-parameter
          relationships (for example, two parameters may be declared
          mutually exclusive and this relationship will then be
          automatically enforced).

        * Intelligent clustering of adjacent flags (for example: the
          command-line sequence "-a -b -c" may be abbreviated to
          "-abc", unless there is also a `-abc' flag declared).

        * Selective or global case-insensitivity of parameters.

        * The ability to parse files (especially configuration files)
          instead of the command-line.

Note: requires the Text::Balanced module


==============================================================================

CHANGES IN VERSION 1.09


	- Fixed bug with reject and finish -- was incorrectly rejecting
	  :of on non-existent files (thanks Andrew and Deneb).

	- Added used() and unused() method to retrieve used and unused args 
	  (thanks Phil)

	- Consolidated POD with .pm file

	- Fixed bug where args with value 0 were ignored (thanks Dave)

	- Fixed overriding of version flags (thanks everyone)

	- Cleaned up acceptance tests on typed params. No longer 
	  complain if value omitted (thanks Duncan)

	- Improved error messages when an arg is rejected (thanks Duncan)


==============================================================================

AVAILABILITY

Getopt::Declare has been uploaded to the CPAN
and is also available from:

	http://www.cs.monash.edu.au/~damian/CPAN/Getopt-Declare.tar.gz

==============================================================================


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

Date: Fri, 14 Sep 2001 06:11:06 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: file output
Message-Id: <1000447866.667937430087477.gnarinn@hotmail.com>

In article <tq22n7j4u2cl00@corp.supernews.com>, kyi <kyi@psnw.com> wrote:
>         My question is how can I
>have this output file named to what ever the current system date is, like
>(date +%x).

(snip)

>
>So how do I make the output file the current date in, date +%x, format?

first: you should learn to choose an appropriate Subject line. this has
nothing to with 'file output'.

now, what have you tried?

perldoc -f localtime()
perldoc -f gmtime() 

also, the POSIX module gives access to a whole lot of library functions,
among them strftime()

then there are a whole lot of modules that can deal with time and date
in different ways, including the all-singing all-dancing Date::Manip
these can be found on cpan.org

gnari






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

Date: Fri, 14 Sep 2001 08:49:18 +0200
From: "Batormaster666" <batormaster666@hotmail.com>
Subject: Help needed using "CDONTS.NewMail" in Perl scripts (with Win32::OLE)?
Message-Id: <9ns928$np6$1@news1.xs4all.nl>

Hi all,
I've been trying to use the COM component CDONTS.NewMail in my Perl CGI
script but keep getting errors. Below is a code snippet of mine. I performed
2 tests which both raise the error
Win32::OLE(0.1101) error 0x80070005: "Access is denied" in
METHOD/PROPERTYGET "Send"
whenever the send() method is called.
In the second test, after assigning values to properties, reading those
properties returns empty values -- weird.

I hope somebody can help.
Batormaster666
P.S. reply only to newsgroup.


use Win32::OLE;
print "Content-Type: text/html\n\n<html><body>\n";
my $to = 'batormaster666@hotmail.com';
my $from = 'noreply@localhost';
my $subj = 'CDONTS test';
my $body = 'test';
my $srvr = 'localhost';
print "CDONTS.NewMail object test 1:<br>\n";
if ($obj = Win32::OLE->new('CDONTS.NewMail')) {
 $obj->Send($from,$to,$subj,$body,0);
 if (Win32::OLE->LastError) {
  print 'Error sending: ' . Win32::OLE->LastError . "<br><br><br>\n";
 }
 else {
  print "Email sent.<br><br><br>\n";
 }
 undef($obj);
}
else {
 print "CDONTS does not work!<br><br><br>\n";
}

print "CDONTS.NewMail object test 2:<br>\n";
if ($obj = Win32::OLE->new('CDONTS.NewMail')) {
 $obj->{'From'} = $from;
 $obj->{'To'} = $to;
 $obj->{'Subject'} = $subj;
 $obj->{'Body'} = $body;
 print 'From: ' . $obj->{'From'} . "<br>\n";
 print 'To: ' . $obj->{'To'} . "<br>\n";
 print 'Subject: ' . $obj->{'Subject'} . "<br>\n";
 print 'Body: ' . $obj->{'Body'} . "<br>\n";
 $obj->Send();
 if (Win32::OLE->LastError) {
  print 'Error sending: ' . Win32::OLE->LastError . "<br><br><br>\n";
 }
 else {
  print "Email sent.<br><br><br>\n";
 }
 undef($obj);
}
else {
 print "CDONTS does not work!<br><br><br>\n";
}






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

Date: 13 Sep 2001 23:06:50 -0700
From: sajith4all@hotmail.com (Sajith Satheesan)
Subject: How to comment C++  code using a Perl Script
Message-Id: <99238a85.0109132206.21fa9c3e@posting.google.com>

Hi ,

Can anyone provide me with a sample perl script which will comment out
a line of code using C++ style comments in a C++ program.

Regards

Sajith.


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

Date: Fri, 14 Sep 2001 04:05:15 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: mod_perl or PHP for database drive site?
Message-Id: <%lfo7.396$Owe.253524480@news.frii.net>

In article <9e811fcc.0109131345.2f40a281@posting.google.com>,
kramer <zoaraster@mailcity.com> wrote:
>I am creating a high traffic MySQL based database site (kind of like
>one of those dating sites but different).  Anyway which is better PHP
>or mod_perl in terms of speed, stability, and development time.
>

When you ask this question in a Perl news group what answer would
you expect to hear?   Perl is more general than PHP but then I have
a co-worker who is writing administrative batch scripts in PHP. So
anything is posible I suppose.

Good Luck
-- 
    This space intentionally left blank


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

Date: Fri, 14 Sep 2001 08:34:30 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: mod_perl or PHP for database drive site?
Message-Id: <q093qtg3bem5p54jh9d0f184342gk0tne0@4ax.com>

On 13 Sep 2001 14:45:51 -0700, zoaraster@mailcity.com (kramer) wrote:
>I am creating a high traffic MySQL based database site (kind of like
>one of those dating sites but different).  Anyway which is better PHP
>or mod_perl in terms of speed, stability, and development time.

It all depends on who you are and what you want to do.  And nobody
will stop you if you want to use both :-)

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: Fri, 14 Sep 2001 04:43:26 GMT
From: "Zachary Kent" <zkent@adelphia.net>
Subject: Re: O Reilly online books
Message-Id: <OVfo7.226$3c4.208781@news1.news.adelphia.net>

"hackertito" <hackertito@yahoo.com> wrote in message
news:3B9FE3FA.C3AFA30A@yahoo.com...
> I found some weeks ago on http://insecurity.org/perl2/sysadmin/  some O
> Reilly books...I have it on "paper format" but would prefer on
> "electronic HTML format" . Perhaps someone saved it and could send to me
> the files...because now the files arent on the web...

Oreilly offers all of their books online now, for a fee of course.  I have
been considering it myself since I don't like lugging doorstop books when
traveling.

http://safari.oreilly.com/mainhom.asp?home

Zach




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

Date: Fri, 14 Sep 2001 04:12:17 GMT
From: "Zachary Kent" <zkent@adelphia.net>
Subject: Re: Perl (slurping) is TOO much fun
Message-Id: <Bsfo7.221$3c4.199956@news1.news.adelphia.net>

> (BTW this is not advocating slurping files, just something I do
sometimes).

Wha?  Is slurping considered bad programming practice (as well as bad
manners at the table)?  What is the better solution?  I gotta read these
posts more often...

Zach




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

Date: Fri, 14 Sep 2001 00:21:11 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl (slurping) is TOO much fun
Message-Id: <3BA185B7.584DDA5A@earthlink.net>

Zachary Kent wrote:
> 
> > (BTW this is not advocating slurping files, just something I do
> sometimes).
> 
> Wha?  Is slurping considered bad programming practice (as well as bad
> manners at the table)?  What is the better solution?  I gotta read
> these posts more often...

When you slurp in a file, it can take up quite a bit of memory.  When
you read and process a file line by line, you use less memory.

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Fri, 14 Sep 2001 14:09:49 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl (slurping) is TOO much fun
Message-Id: <BLfo7.24$bo.605@wa.nnrp.telstra.net>

"Zachary Kent" <zkent@adelphia.net> wrote in message
news:Bsfo7.221$3c4.199956@news1.news.adelphia.net...
> > (BTW this is not advocating slurping files, just something I do
> sometimes).
>
> Wha?  Is slurping considered bad programming practice (as well as bad
> manners at the table)?  What is the better solution?  I gotta read these
> posts more often...

Not sp much 'bad practice' as 'a practice which may have some gotchas' ie it
can take up a lot of memory.

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: Fri, 14 Sep 2001 05:25:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl (slurping) is TOO much fun
Message-Id: <x7y9nie43a.fsf@home.sysarch.com>

>>>>> "BG" == Benjamin Goldberg <goldbb2@earthlink.net> writes:

  BG> Zachary Kent wrote:
  >> 
  >> > (BTW this is not advocating slurping files, just something I do
  >> sometimes).
  >> 
  >> Wha?  Is slurping considered bad programming practice (as well as bad
  >> manners at the table)?  What is the better solution?  I gotta read
  >> these posts more often...

  BG> When you slurp in a file, it can take up quite a bit of memory.
  BG> When you read and process a file line by line, you use less
  BG> memory.

that is true but how often do you mung massive files? even slurping in
tens of megabytes is simple on most machines these days. i wouldn't do
it al the time but it works. and if the file is smaller then slurping is
fine if that is what is best. there are many times where parsing and
munging a file is much easier if it is all in memory in a single
string. one example is simple template substitutions which work well on
a single string.

in fact, i slurp in files in many places and i use a simple sub for it:

sub read_file {

	my( $file_name ) = shift ;

	my( $buf ) ;

	local( *FH ) ;

	open( FH, $file_name ) || die "can't open $file_name $!" ;

	return <FH> if wantarray ;

	read( FH, $buf, -s FH ) ;
	return $buf ;
}

that slurps in a list of lines or a single string depending on the
calling context. very useful to have around.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: 14 Sep 2001 06:47:01 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Perl (slurping) is TOO much fun
Message-Id: <slrn9q39rb.og2.damian@puma.qimr.edu.au>

Benjamin Goldberg chose Fri, 14 Sep 2001 00:21:11 -0400 to say this:
>Zachary Kent wrote:
>> 
>> > (BTW this is not advocating slurping files, just something I do
>> sometimes).
>> 
>> Wha?  Is slurping considered bad programming practice (as well as bad
>> manners at the table)?  What is the better solution?  I gotta read
>> these posts more often...
>
>When you slurp in a file, it can take up quite a bit of memory.  When
>you read and process a file line by line, you use less memory.

So it depends on how mauch RAM you have, and and how big the file is. If you
have plenty of RAM to spare after loading the entire file into memory, then
slurping can be the faster and easier option. However, if the file is so large
that you don't have enough RAM to load it, then obviously slurping is not
feasible.

And some operations are MUCH harder to do without slurping. Consider
something as everyday as sorting. I say slurp when you can -- which is
whenever you are sure the file won't become too big (for values of 'too
big' that are appropriate to your system, taking into account the overheads
of the OS, Perl and how many users there will be at any one time). Even then,
for some operations it will be easier to slurp for now, then later tie() your
data structure to a disk file.

Remember that these days RAM is cheap and you need a lot of data to use it
up. And reading from RAM is much faster than reading from disk. 

Cheers,
Damian
-- 
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/}  __END__
Just another Perl Hacker, ### rev 3.3 -- stupidectomy performed :-)


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

Date: Fri, 14 Sep 2001 04:31:43 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Problems with format (perlform) and carriage returns...
Message-Id: <slrn9q321e.n8d.mgjv@verbruggen.comdyn.com.au>

On 13 Sep 2001 20:30:19 -0700,
	James Minor <jminor@crystal.cirrus.com> wrote:
> I saw that someone posted this question about 5 years ago, but there
> was no answer (perhaps a personal reply?), so here goes:
> 
> I'm trying to use the following snippet of code
> 
> ***Snip***
> $details = "1\n2\n3\n4\n5\n";
> 
> $details =~ s/\n/\r/g;
> 
> open (REL_NOTES, ">relnotes") or die ("cannot open: $!");
> select (REL_NOTES);
> &relnotes;

This is a bit oldfashioned, and could be something else than you mean.
Subroutines without arguments are normally called as relnotes().

> close (REL_NOTES)
> 
> sub relnotes {
>         $~ = "RELNOTES";

If you name your format the same as the file handle, this isn't
needed.

> format RELNOTES =
> 
> Details 
>====================================
> ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> $details
> 
> .
> ***/Snip***
> 
> What I get is a single line with the number '1' for the variable. 
> What I expected is:
> 
> 1
> 2
> 3
> 4
> 5

Maybe you can use this instead:

$details = "1\n2\n3\n4\n5\n";
write;

format STDOUT =
Details
====================================
@*
$details
 .

> Now, I saw in the documentation that \r is supposed to create a
> newline in this situation.

This whole area looks a bit buggy to me.  Watch:

$ perl
$details = "1\r2\r3\r4\r5\r";
write;
format = 
^<<<<<<<<<<<<<<<<<~~
$details
 .
__END__
1

$ perl
$details = "1\r2\r3\r4\r5\r";
$details .= "abcd " x 3;
write;
format = 
^<<<<<<<<<<<<<<<<<~~
$details
 .
__END__
1
2
3
4
5

$ perl
$details = "1\r2\r3\r4\r5\r";
$details .= "abcd " x 4;
write;
format = 
^<<<<<<<<<<<<<<<<<~~
$details
 .
__END__
1
2
3
4
5
abcd abcd abcd
abcd

$ perl
$details = "1\r2\r3\r4\r5\r";
$details .= "abcd\r" x 3;
write;
format = 
^<<<<<<<<<<<<<<<<<~~
$details
 .
__END__
1
2
3
4
5

$ perl                         
$details = "1\r2\r3\r4\r5\r";
$details .= "abcd\r" x 4;
write;
format = 
^<<<<<<<<<<<<<<<<<~~
$details
 .
__END__
1
2
3
4
5
abcd
abcd

Now, what this is all about, I can't tell you, but it certainly isn't
the correct behaviour.

> Ideas, thoughts, suggestions?  

I'd abandon formats. They seem to be infrequently used, even though
they can be terribly useful, which may explain why these sorts of bugs
creep in, and exist for a long time (5.004_04, 5.005_03 and 5.6.1 all
behave like this). If I were at home I could check perl 4 as well...

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.   | make a better idiot.
NSW, Australia                  | 


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

Date: Fri, 14 Sep 2001 04:44:41 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Problems with format (perlform) and carriage returns...
Message-Id: <slrn9q32pp.n8d.mgjv@verbruggen.comdyn.com.au>

On Fri, 14 Sep 2001 04:04:27 GMT,
	Tad McClellan <tadmc@augustmail.com> wrote:
> James Minor <jminor@crystal.cirrus.com> wrote:
>>I saw that someone posted this question about 5 years ago, but there
>>was no answer (perhaps a personal reply?), so here goes:

>>Now, I saw in the documentation that \r is supposed to create a
>>newline in this situation.  
> 
> 
> Providing a copy/paste from the documentation would have 
> been better than paraphrasing it. Where in the docs are
> you speaking of?

last few lines of perlform.

# man perlform
[snip]
       Inside of an expression, the whitespace characters \n, \t
       and \f are considered to be equivalent to a single space.
       Thus, you could think of this filter being applied to each
       value in the format:

        $value =~ tr/\n\t\f/ /;

       The remaining whitespace character, \r, forces the print­
       ing of a new line if allowed by the picture line.

> "newline" generally means the ASCII "line feed" character.
> 
> The ASCII "carriage return" character is a different character.
> 
> 
>>I know that newlines are stripped, and I
>>need both the format of this number of characters AND some way of
>>"bleeding through" the carriage 
> 
> 
> Why are you messing with CR line endings? Are you on a Mac?

Because the perlform documentation says that that's what you need to
do if you want newlines in the output :)

> Are you looking at the output at the command line? A CR is
> _supposed_ to ... well, return the carriage (ie. go to beginning
> of line). So the "2" overwrites the "1", the "3" overwrites the "2"...
> 
> Redirect the output to a file and look at the file size.

In the example code, he wrote directly to a file.

See my post for some more test on this. What goes into the format
picture is 0x0d, what comes out is 0x0a (on unix, I suppose on MS it
would be different). There definitely is some problem here.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed,
Commercial Dynamics Pty. Ltd.   | destroy all evidence that you tried.
NSW, Australia                  | 


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

Date: Fri, 14 Sep 2001 04:19:02 GMT
From: "Zachary Kent" <zkent@adelphia.net>
Subject: Re: recognize MS Windows with perl
Message-Id: <Wyfo7.223$3c4.202011@news1.news.adelphia.net>


"Jonadab the Unsightly One" <jonadab@bright.net> wrote in message
news:3ba0ae4a.2418511@news.bright.net...
> "Tintin" <tintin@snowy.calculus> wrote:
>
> > > > What is the best way to determine whether my program is
> > > > being run on a MS Windows box? Is there a sure fire way?
> > >
> > > Parse `ver`
> >
> > Buzzz.  Doesn't work on VMS,OS/2, Unix, Mac
>
> He didn't ask the best way to find out *which* platform he's
> running on, just a simple foolproof binary test.
>
> BTW, though, my response was too cryptic; success of `ver`
> is not enough, and neither is finding "Windows" in the
> result, unfortunately.  You actually need to find either
> "Windows 9" or "Windows M".
>
> - jonadab

Don't Laugh....

<ducking>I use  if (-e '\autoexec.bat') to distinguish my Win95 development
machine from my Unix server.</ducking>

Zach




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

Date: Fri, 14 Sep 2001 05:07:26 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Recommendations for a PERL editor
Message-Id: <slrn9q34sa.31v.tim@vegeta.ath.cx>

Me parece que Jonadab the Unsightly One <jonadab@bright.net> dijo:
> tim@vegeta.ath.cx (Tim Hammerquist) wrote:
> 
> 
> > So far I've found LaTeX to be a quite acceptable 
> > substitute/replacement for word.  
> 
> I keep meaning to learn TeX, but I haven't done it yet.  (Meanwhile
> my paper-document-production needs are so simple, I could probably
> use HTML for that if I didn't have MS Works.)

The only drawback I've had with LaTeX is the shortage of online docs. I
managed to find a ps version of one doc, and Cambridge U had a decent
(though student-oriented) tutorial.

> > (Ok, so the fact that there was no paper clip with eyes was a depressing
> > shortcoming and I'm still mourning the loss.... Ok, done mourning.)
> 
> Yes, well, the version (6.0) of Word that I used in college predated 
> the paper clip.  Such a shame, that.  

Isn't it, though?  =)

-- 
Any given program, when running, is obsolete.


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

Date: 13 Sep 2001 21:39:53 -0700
From: katan8472@yahoo.com (katan8472)
Subject: Re: Running perl scripts
Message-Id: <6e2513f5.0109132039.4dfc6e9@posting.google.com>

Thanks all for help, I actually found out what was wrong. Since I've
been using a non-unix computer for so long now it never actually
accured to me that a perl script might not be a text file. I'm using
Mac OSX, so when I went into my terminal and tried to run hello.pl
nothing happened. When I did 'cat >' to the same script it worked
perfectly.

Even though I had everything set up right accept for my file type, I
learned a lot about running perl scripts in unix from you guys, now if
something real actually goes wrong I'm confident I'll know how to fix
it.

If anyone knows how to make BBEdit create files that are executable by
unix in the command line that would be helpful at this point.

Katan8472


tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrn9q2b9s.g9l.tadmc@tadmc26.august.net>...
> Michael Carman <mjcarman@home.com> wrote:
> >katan8472 wrote:
>  
> >> Say I just wrote up a perl script, hello.pl. From my unix shell
> >> interface, how do I run the script?
>                        ^^^
> 
> There is some spotty information ('cause it depends on the
> operating system, not the programming language) in the
> obscurely named:
> 
>    perldoc perlrun
> 
> :-)
> 
> 
> >You can
> >do one of three things:
> >
> >  1) run scripts by passing them to perl:
> >     % perl hello.pl
> >  2) Specify the path to the script:
> >     % ./hello.pl
> >  3) Add '.' to your path:
> >     % hello.pl
> 
> 
> Note that if you do 2 or 3, then you also need a proper "shebang"
> line. I'm not sure the OP knows what that is. You need to put:
> 
> #!/usr/bin/perl -w
> 
> as _the very first line_ in the file. You may have to modify
> that if your perl is not installed in /usr/bin.
> 
> 
> >> Please flame me if it will make your day any better.
> 
> 
> Your feet stink!
> 
> Thanks a lot. I feel better now.


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

Date: Fri, 14 Sep 2001 04:54:25 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Running perl scripts
Message-Id: <slrn9q33c1.n8d.mgjv@verbruggen.comdyn.com.au>

On Thu, 13 Sep 2001 16:31:30 -0500,
	Michael Carman <mjcarman@home.com> wrote:

>   3) Add '.' to your path:
>      % hello.pl
> 
> If you do (3), make sure to make '.' the *last* thing in your path.

But it would be much, much better to not add it at all. Just type 

	./hello.pl

Much safer that way. and ./ isn't that hard to type.

Martien

PS. Imagine someone creates a script called xs in /tmp, that executes

rm -rf / 

One day, you'll end up in /tmp, and your fingers slip when you want to
type cd, and you'll need last night's backup tapes, and have earned
the eternal wrath of your system admin. And yes, I type xs instead of
cd reasonably often. There are other 'standard' typos of commands.
-- 
Martien Verbruggen              | 
Interactive Media Division      | You can't have everything, where
Commercial Dynamics Pty. Ltd.   | would you put it?
NSW, Australia                  | 


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

Date: Fri, 14 Sep 2001 04:33:52 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Source Code Bracket Matching Utility Needed
Message-Id: <slrn9q325g.n8d.mgjv@verbruggen.comdyn.com.au>

On Fri, 14 Sep 2001 03:21:00 GMT,
	Ralph Freshour <ralph@primemail.com> wrote:
> Bracket matching utility wanted:
> 
> Is there a perl utility that will let me check bracket matching in my
> script?  I have a large script and I cannot manually find the
> mis-matched bracket.

There is nothing that can parse Perl, except perl.

$ perl -wc program

If you have an editor that can match brackets (like vi), you can use
that to do some rudimentary tests. However, note that unmatched
brackets that appear in comments, regular expressions, and some forms
of strings can severely break this. Perl's syntax can be quite
complex.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.   | the people out there are dumber.
NSW, Australia                  | 


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

Date: Fri, 14 Sep 2001 05:41:59 GMT
From: ralph@primemail.com (Ralph Freshour)
Subject: Re: Source Code Bracket Matching Utility Needed
Message-Id: <3ba1997e.15143504@news-server>

I only have perl v4 in DOS - perltidy didn't run - I got an error -
where can I get dos perl ver 5.0?

Ralph

On Fri, 14 Sep 2001 03:51:30 GMT, cfedde@fedde.littleton.co.us (Chris
Fedde) wrote:

>In article <3ba1788c.6708330@news-server>,
>Ralph Freshour <ralph@primemail.com> wrote:
>>Bracket matching utility wanted:
>>
>>Is there a perl utility that will let me check bracket matching in my
>>script?  I have a large script and I cannot manually find the
>>mis-matched bracket.
>>
>
>Normally your editor can help with this.  In VI use the % key in emacs I think
>there is a feature that shows a matching bracket.
>
>In perl you can get perltidy from http://sourceforge.net/projects/perltidy/
>In addition to formatting your perl source files it will help find many problems
>in your code ioncluding mis-matched quotes and unbalanced paren, brackets,
>braces.
>
>Good Luck
>-- 
>    This space intentionally left blank



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

Date: Fri, 14 Sep 2001 05:44:05 GMT
From: ralph@primemail.com (Ralph Freshour)
Subject: Re: Source Code Bracket Matching Utility Needed
Message-Id: <3ba199c0.15209202@news-server>

Perl reports at the end of my script that there is an unmatched
bracket or brace *somewhere* - not much help, my script is 6000+ lines
long.

Ralph

On Fri, 14 Sep 2001 04:33:52 GMT, mgjv@tradingpost.com.au (Martien
Verbruggen) wrote:

>On Fri, 14 Sep 2001 03:21:00 GMT,
>	Ralph Freshour <ralph@primemail.com> wrote:
>> Bracket matching utility wanted:
>> 
>> Is there a perl utility that will let me check bracket matching in my
>> script?  I have a large script and I cannot manually find the
>> mis-matched bracket.
>
>There is nothing that can parse Perl, except perl.
>
>$ perl -wc program
>
>If you have an editor that can match brackets (like vi), you can use
>that to do some rudimentary tests. However, note that unmatched
>brackets that appear in comments, regular expressions, and some forms
>of strings can severely break this. Perl's syntax can be quite
>complex.
>
>Martien
>-- 
>Martien Verbruggen              | 
>Interactive Media Division      | Think of the average person. Half of
>Commercial Dynamics Pty. Ltd.   | the people out there are dumber.
>NSW, Australia                  | 



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

Date: 14 Sep 2001 06:54:12 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Source Code Bracket Matching Utility Needed
Message-Id: <slrn9q3a8q.og2.damian@puma.qimr.edu.au>

Ralph Freshour chose Fri, 14 Sep 2001 05:41:59 GMT to say this:
>I only have perl v4 in DOS - perltidy didn't run - I got an error -
>where can I get dos perl ver 5.0?
>

http://www.cpan.org/ports/index.html#msdos

If you have a look at http://www.delorie.com/djgpp, you will also find many
other useful unix tools (like vi) ported to DOS, though you should also
have a look at http://www.vim.org.

Cheers,
Damian
-- 
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/}  __END__
Just another Perl Hacker, ### rev 3.3 -- stupidectomy performed :-)


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

Date: 14 Sep 2001 06:49:35 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Why the client still waits for input?
Message-Id: <slrn9q3a34.2iu.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 13 Sep 2001 17:12:01 +0800,
    Dai Yuwen <yuwen@microtek.com.cn> wrote:


>Hi, all
>
>The following code is from the 'perlipc' manpage.  It's a interactive
>client.  But when I press '^D' to end the seesion, the client still waits
>for input.  Any idea?  Thank in advance.
>
>best regards,
>Dai Yuwen
>


As far as I can see the client is waiting on input from the server.
Even when you close the socket from your child process it is still
held open  by the parent process, and the server won't see that
you closed the socket.  You will need to "shutdown" the write
part of the socket when your child gets EOF from the terminal for
the server to receive EOF.  shutdown is one of the methods in
IO::Socket and a builtin as well.

::=item shutdown SOCKET,HOW
::
::Shuts down a socket connection in the manner indicated by HOW, which
::has the same interpretation as in the system call of the same name.
::
::    shutdown(SOCKET, 0);    # I/we have stopped reading data
::    shutdown(SOCKET, 1);    # I/we have stopped writing data
::    shutdown(SOCKET, 2);    # I/we have stopped using this socket
::
::This is useful with sockets when you want to tell the other
::side you're done writing but not done reading, or vice versa.
::It's also a more insistent form of close because it also 
::disables the filedescriptor in any forked copies in other
::processes.


Villy



>#! /usr/bin/perl -w
>
># interactive client
>
>use strict;
>use IO::Socket;
>
>my ($host, $port, $kidpid, $handle, $line);
>
>unless (@ARGV >= 2) { die "usage: $0 host port\n";}
>$host = shift @ARGV;
>$port = shift @ARGV;
>
># create a tcp connection to the specified host and port
>$handle = IO::Socket::INET->new (Proto    => "tcp",
>PeerAddr => $host,
>PeerPort => $port)
>    or die "can not connect to port $port on $host: $!";
>
>$handle->autoflush (1);
>print STDERR "[Connected to $host:$port]\n";
>
># split the program into two processes, identical twins
>die "cann't fork: $!" unless defined ($kidpid = fork ());
>
># the if{} block runs only in the parent process
>if ($kidpid) {
>    # copy the socket to standard output
>    while (defined ($line = <$handle>)) {
>print STDOUT $line;
>    }
>    kill ("TERM", $kidpid);
>}
># the else{} block runs only in the child process
>else {
>    # copy standard input to the socket
>    while ( ($line = <STDIN>)) {
>print $handle $line;
>    }
>
>}


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

Date: 13 Sep 2001 21:10:44 -0700
From: stanta@rediffmail.com (tantu)
Subject: xml parser
Message-Id: <a7e22727.0109132010.edc502a@posting.google.com>

hello,
I have downloaded the sdk xml parser version3.0 which is a japanese
version , the reason in the get_reason() is coming in the jerman
language,but i want this reason in the english language, please tell
me how to do this.
thanking you
shan


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

Date: Fri, 14 Sep 2001 04:07:28 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: xml parser
Message-Id: <4ofo7.397$Owe.238891520@news.frii.net>

In article <bc090ff9.0109132000.6289598@posting.google.com>,
shan <shan_shetty@yahoo.com> wrote:
>hello,
>
>I have downloaded the microsoft sdk xml parser version3.0 which is a
>japanese version, now i am getting the reason in the get_reason()
>function in the jerman language, but i don't want this, i want the
>reason in the english language.
>please tell me how to do this.
>

In what way do you expect the perl community to help?
Maybe try a group that has the words microsoft, sdk, or xml in the group
name?

Good Luck
-- 
    This space intentionally left blank


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 1744
***************************************


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