[18836] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1004 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 28 14:10:39 2001

Date: Mon, 28 May 2001 11:10:15 -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: <991073415-v10-i1004@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 28 May 2001     Volume: 10 Number: 1004

Today's topics:
    Re: HELP with IPC (Anno Siegel)
    Re: How to create a text file in Windows/DOS with PERL? <jcook@strobedata.com>
    Re: How would have solved this problem? (Martien Verbruggen)
    Re: How would have solved this problem? <steffi@shell8.ba.best.com>
    Re: NET::SMTP <Jenda@Krynicky.cz>
    Re: PDF Files (Steven)
        Perl and Unix out to a Web page <vprasad@americasm01.nt.com>
    Re: Perl and Unix out to a Web page <bart.lateur@skynet.be>
    Re: Perl CGI <gmoll@anakena.dcc.uchile.cl>
    Re: Perl CGI (E.Chang)
    Re: Perl CGI (Anno Siegel)
    Re: Perl CGI <bart.lateur@skynet.be>
    Re: Perl CGI (Michel Dalle)
    Re: Perl Compilers <jcook@strobedata.com>
        Premature end of script headers wont go away! <nabeels786@worldnet.att.net>
    Re: Search and Replace <davidaslanian@hotmail.com>
    Re: Searching Flat Text File <buggs@geekmail.de>
    Re: simple question <nobody@dev.null>
    Re: simple question (Helgi Briem)
        simple reg exp problem <davidaslanian@hotmail.com>
    Re: simple reg exp problem <bart.lateur@skynet.be>
    Re: simple reg exp problem (E.Chang)
    Re: simple reg exp problem (E.Chang)
    Re: sounder (Helgi Briem)
        Threads vs. ActiveState Threads <mnemotronic@mind\no-spam/spring.com>
    Re: Threads vs. ActiveState Threads <dan@tuatha.sidhe.org>
    Re: Threads vs. ActiveState Threads <Jenda@Krynicky.cz>
    Re: Too late for "-T" option at comment_form.cgi line 1 <webmaster@webdragon.unmunge.net>
    Re: typeglobs (again) (Bernard El-Hagin)
    Re: typeglobs (again) (Anno Siegel)
    Re: typeglobs (again) <bart.lateur@skynet.be>
    Re: typeglobs (again) (Grod)
    Re: typeglobs (again) <bart.lateur@skynet.be>
    Re: typeglobs (again) <joe+usenet@sunstarsys.com>
    Re: url parsing <godzilla@stomp.stomp.tokyo>
        windows 98 can't use cgi (rasheed)
    Re: windows 98 can't use cgi <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 May 2001 13:11:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP with IPC
Message-Id: <9etiqj$j6p$1@mamenchi.zrz.TU-Berlin.DE>

According to Dennis Kowalski <dennis.kowalsk@daytonoh.ncr.com>:
> 
> I am trying to develope two scripts. One that creates an IPC queue and
> receives off of it and the other script send message to the IPC queue.
> 
> So far I have been able to create the queue OK but when I try to send to it
> I get an error of Invalid argument.
> 
> I have tried msgsnd and the SysV $msg->snd methods and both fail.
> 
> Can anyone see the error?
> 
> Here is the msgsnd version
> 
>       eval 'sub IPC_RMID {0}' unless defined &IPC_RMID;
>       eval 'sub IPC_NOWAIT {0004000}' unless defined &IPC_NOWAIT;
> 
>       $key = 999;
>      $queue = msgget($key, 0);

Without looking any further, the value of 0 for the flags argument
won't allow creation of a message queue.  You'll need to specify
IPC_CREAT for that.  You will also have to or in some reasonable
permissions for the queue or you won't be able to use it later.

Anno


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

Date: 28 May 2001 13:31:33 GMT
From: Jim Cook <jcook@strobedata.com>
Subject: Re: How to create a text file in Windows/DOS with PERL?
Message-Id: <3B125335.ACADDDB5@strobedata.com>

> open(FILEHANDLE,">temp.txt") || die "cannot open file.";

Question of style:

I've taken to writing these types of lines as:
open (HANDLE, $_ = ">temp.txt") || die "Cannot open file $_: $!";

Does that seem like a good way to give sufficient information? Also, I
remember seeing something about precedence and using "or" instead of
"||" but can't locate it right now. 'perldoc -f open' shows both in the
example. Could somebody please point me to the faq / documentation for
that again so I am sure to use the right one in the future?

--
jcook@strobedata.com  Live Honourably  4/1 - 4/3 + 4/5 - 4/7 + . . .
2001 Wed: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Mon, 28 May 2001 23:07:34 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How would have solved this problem?
Message-Id: <slrn9h4jcm.c3r.mgjv@martien.heliotrope.home>

On Mon, 28 May 2001 00:02:21 GMT,
	Robert Nicholson <steffi@shell8.ba.best.com> wrote:
> I managed to get done what I wanted but I'm very interested to learn
> about other ways to solve this problem. The problem was to pass some
> html and create nested data structure which will be used later.

You're the person who was asking about WML before, right? I just
noticed, because I just posted a response to that post, and this one
seemed to display a familiar style.

When you 'follow up' on one of your earlier posts, or refer to it, you
should not assume that everyone here knows who you are, or has read your
previous posts. This groups gets quite a bit of traffic per day, and
you, amongst all that traffic, are unlikely to be more noticeable than
all the other posts.

> Now I decided on using HTML::TokeParser and there's one aspect of this
> I do not understand. 
> 
> In my code I look for a opening table tag and I wanted parsing to finish
> when I find a closing table tag and I would find this in two places in my
> code and if I found it first I'd want to unget it to that the other place
> would find it and terminate.

Ok, I stopped reading. Just read this sentence yourself, and try to see
it through someone else's eyes.

It's unparseable. Ungrokkable.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | This matter is best disposed of from
Commercial Dynamics Pty. Ltd.   | a great height, over water.
NSW, Australia                  | 


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

Date: Mon, 28 May 2001 16:54:05 GMT
From: Robert Nicholson <steffi@shell8.ba.best.com>
Subject: Re: How would have solved this problem?
Message-Id: <yl3bsode7o4.fsf@shell8.ba.best.com>

Fair enough point...

The point I wanted to make about TokeParser was that if I read
a token and then put it back ie. unget it and read the next
token from the parser. It's not the one I just put back.

To understand my problem you have to see how the HTML is structured and
follow my code.

mgjv@tradingpost.com.au (Martien Verbruggen) writes:

> On Mon, 28 May 2001 00:02:21 GMT,
> 	Robert Nicholson <steffi@shell8.ba.best.com> wrote:
> > I managed to get done what I wanted but I'm very interested to learn
> > about other ways to solve this problem. The problem was to pass some
> > html and create nested data structure which will be used later.
> 
> You're the person who was asking about WML before, right? I just
> noticed, because I just posted a response to that post, and this one
> seemed to display a familiar style.
> 
> When you 'follow up' on one of your earlier posts, or refer to it, you
> should not assume that everyone here knows who you are, or has read your
> previous posts. This groups gets quite a bit of traffic per day, and
> you, amongst all that traffic, are unlikely to be more noticeable than
> all the other posts.
> 
> > Now I decided on using HTML::TokeParser and there's one aspect of this
> > I do not understand. 
> > 
> > In my code I look for a opening table tag and I wanted parsing to finish
> > when I find a closing table tag and I would find this in two places in my
> > code and if I found it first I'd want to unget it to that the other place
> > would find it and terminate.
> 
> Ok, I stopped reading. Just read this sentence yourself, and try to see
> it through someone else's eyes.
> 
> It's unparseable. Ungrokkable.
> 
> Martien
> -- 
> Martien Verbruggen              | 
> Interactive Media Division      | This matter is best disposed of from
> Commercial Dynamics Pty. Ltd.   | a great height, over water.
> NSW, Australia                  | 


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

Date: Mon, 28 May 2001 15:16:54 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: Re: NET::SMTP
Message-Id: <1108_991063014@JENDA>

On Sat, 26 May 2001 16:15:06 +0200, Peter Ruester <Peter.Ruester@t-online.de> wrote:
> Hi,
> 
> I would like to send a Email with an attached file.
> Is it possible with the module NET::SMTP
> A sample is very welcome.
> 
> Thanks for all suggestions in advance,
> Peter

Heyyyy, nobody sugested my Mail::Sender. I feel like crying ..... :-(((

See http://jenda.krynicky.cz/#Mail::Sender
or CPAN

You may also use MIME::lite. You'll find it on CPAN as well.

Jenda




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

Date: 28 May 2001 08:18:04 -0700
From: steve.busiello@gs.com (Steven)
Subject: Re: PDF Files
Message-Id: <fa45b871.0105280718.d25e787@posting.google.com>

Hey Bernhard,
check out cpan for PDF::Create ... I have used it and it is very easy
to use. You are going to also need another module Data::Dumper. Just
get these off of cpan through them into your lib dir and try out the
simple.pl file that is included.

-Steven



"Bernhard Sept, BHS Schulungen" <b-sept@gmx.de> wrote in message news:<9eontk$a8b$02$1@news.t-online.com>...
> Hi there,
> I have to create pdf files on the Server side - I will / have to use PERL as
> language.
> Are there any tool out there to help me on that subject?
> 
> Have a nice day
> Bernd


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

Date: Mon, 28 May 2001 10:36:55 -0400
From: "Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com>
Subject: Perl and Unix out to a Web page
Message-Id: <3B126287.2D907841@americasm01.nt.com>

Hello,

I have a unix script that does a lot of stuff.  I want to use a perl
script to pass it parameters  - run the unix script - and spit out the
unix messages to the screen from within the PERL script?

ie.

#/usr/bin/perl

my $cgi = new CGI; 

print "Content-type: text/html\n\n";
print "<html>";          



foreach my $name (@param_names)
        {
        print "<br>$name: ", $cgi->param($name), "\n";
        }

$catalog=$cgi->param('catalog');
$dataset=$cgi->param('dataset');

if ($catalog && $dataset)
       {
       system("upd_catalog.sh -c $catalog -d $dataset");
        }

print "</html>";


This is not the whole script - for brevity sake.
But the unix script out puts messsages like what it is doing, what
number it has completed - and other stuff.  How do I get the output from
the Unix script to appear on a web page even though it is in a PERL
script?

Thanks,

V


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

Date: Mon, 28 May 2001 14:59:44 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl and Unix out to a Web page
Message-Id: <mvp4ht4miq7o81ic6hk1fo2cden0fii190@4ax.com>

Prasad, Victor [FITZ:K500:EXCH] wrote:

>I have a unix script that does a lot of stuff.  I want to use a perl
>script to pass it parameters  - run the unix script - and spit out the
>unix messages to the screen from within the PERL script?

Well...

	print "Content-type: text/plain\n\n";
	exec "script", @params;

Wouldn't this, roughly, do what is required?

-- 
	Bart.


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

Date: 28 May 2001 15:55:04 GMT
From: Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl>
Subject: Re: Perl CGI
Message-Id: <9etsco$ov1$1@sunsite.dcc.uchile.cl>

nobull@mail.com wrote:
> Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> writes:

>> Anyone knows how to "run" a CGI?
>> Where the CGI must be in?

> A web server.

Yeah, I knew that. I mean if the cgi script must be in a specific
directory, such as public_www/cgi-bin ?

> -- 
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\

-- 
saludos,
	Gabriel Moll Ibacache.-
	e-mail: gmoll@dcc.uchile.cl
	ICQ: 93278824


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

Date: Mon, 28 May 2001 16:25:39 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Perl CGI
Message-Id: <Xns90AF7EE0FB761echangnetstormnet@207.106.92.86>

Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> wrote in 
<9etsco$ov1$1@sunsite.dcc.uchile.cl>:

>nobull@mail.com wrote:
>> Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> writes:
>
>>> Anyone knows how to "run" a CGI?
>>> Where the CGI must be in?
>
>> A web server.
>
>Yeah, I knew that. I mean if the cgi script must be in a specific
>directory, such as public_www/cgi-bin ?
>

Yeah, I am fairly sure nobull knew you meant that too.  The point is, 
this is really a web server issue.  Different servers, different 
platforms, and different configurations, have different requirements - 
about directory, perms, extensions and such.  You'll need to find out 
what the requirements are for the specific one you are using.

-- 
EBC


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

Date: 28 May 2001 16:27:31 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl CGI
Message-Id: <9etu9j$q3k$3@mamenchi.zrz.TU-Berlin.DE>

According to Gabriel Angel Moll Ibacache  <gmoll@anakena.dcc.uchile.cl>:
> nobull@mail.com wrote:
> > Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> writes:
> 
> >> Anyone knows how to "run" a CGI?
> >> Where the CGI must be in?
> 
> > A web server.
> 
> Yeah, I knew that. I mean if the cgi script must be in a specific
> directory, such as public_www/cgi-bin ?

Well, if you knew that, wouldn't you think that the choice and
setup of your web server would enter the equation?

Anno


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

Date: Mon, 28 May 2001 16:35:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl CGI
Message-Id: <tfv4htg5jp93ntlt5niaskv83lkj666e9s@4ax.com>

Gabriel Angel Moll Ibacache wrote:

>>> Anyone knows how to "run" a CGI?
>>> Where the CGI must be in?
>
>> A web server.
>
>Yeah, I knew that. I mean if the cgi script must be in a specific
>directory, such as public_www/cgi-bin ?

That depends on the configuration of the server. Really. By default,
often only scripts in one particular directory are run, but you can
easily set it up so that scripts in any directory in web space get run.

If using Apache, look up "ScriptAlias" and "ExecCGI" in the
configuration files, and their docs.

-- 
	Bart.


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

Date: Mon, 28 May 2001 16:43:26 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Perl CGI
Message-Id: <9etvfo$40l$1@dackel.pdb.sbs.de>

In article <9etsco$ov1$1@sunsite.dcc.uchile.cl>, Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> wrote:
>nobull@mail.com wrote:
>> Gabriel Angel Moll Ibacache <gmoll@anakena.dcc.uchile.cl> writes:
>
>>> Anyone knows how to "run" a CGI?
>>> Where the CGI must be in?
>
>> A web server.
>
>Yeah, I knew that. I mean if the cgi script must be in a specific
>directory, such as public_www/cgi-bin ?

That would depend on how the webserver is configured, obviously.
No-one here can answer that question - you'll have to read the
FAQ of your webhosting company or ask the server admin.

BTW, there's a nice newsgroup dealing with CGI questions
at comp.infosystems.www.authoring.cgi. But they'll tell you
the same thing...

And for your future enlightment, CGI doesn't "run" anywhere,
it's a Common Gateway Interface between a webserver (or
something like that) and some external program like a Perl
script, a VB application, a C program, etc.

Good luck,

Michel.


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

Date: 28 May 2001 13:21:28 GMT
From: Jim Cook <jcook@strobedata.com>
Subject: Re: Perl Compilers
Message-Id: <3B1250D8.CEDDC7AA@strobedata.com>

> >Does anyone know of any decent FREEWARE compilers that will take a Perl
> >script and compile it into a standalone .exe? URLs would be good.
> 
> First of all, those are not compilers. They simply wrap a perl
> interpreter and the script into one EXE file. The only thing it's really
> good for, is hiding your code. And not too well.

I've used the perl 'compiler' perl2exe quite a bit for our make system.
What I normally had been doing is using the batch file wrapper, but I
ran into trouble having the errorlevels returned properly to the make
system. When I wrapped it into an EXE file, it worked just fine.

And, to actually answer the OP, _I_ don't know of any freeware
wrappers/compilers. I do have use for such a thing, and did look for it,
and did eventually buy one.

--
jcook@strobedata.com  Live Honourably  4/1 - 4/3 + 4/5 - 4/7 + . . .
2001 Wed: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Mon, 28 May 2001 18:00:32 GMT
From: "Khalid Shahzad" <nabeels786@worldnet.att.net>
Subject: Premature end of script headers wont go away!
Message-Id: <4nwQ6.3917$kh4.348863@bgtnsc04-news.ops.worldnet.att.net>

hey everyone,

i wrote a script that would take a message and write it to a .js file, which
is being embedded by an html file. the error log gives these errors:

syntax error at /data/esrclan/cgi-bin/headline.pl line 38, near "sub
PrintError "
syntax error at /data/esrclan/cgi-bin/headline.pl line 44, near "}"
Execution of /data/esrclan/cgi-bin/headline.pl aborted due to compilation
errors.
[Mon May 28 11:13:05 2001] [error] [client 12.78.224.90] Premature end of
script headers: /data/esrclan/cgi-bin/headline.pl
[Mon May 28 11:13:05 2001] [error] [client 12.78.224.90] MOD_VR9: Error 500
occured while processing : /data/esrclan/cgi-bin/headline.pl

but i dont see anything wrong at line 38. heres the script:

#!/usr/bin/perl

&GetFormInput;

print "Content-type: text/html\n\n";

$headline = $field{'headline'} ;
$password = $field{'password'} ;
$Submit = $field{'Submit'} ;
$Submit2 = $field{'Submit2'} ;

$message = "" ;
$found_err = "" ;

$errmsg = "<p>The password you entered is not valid.</p>\n" ;

if ($password ne "lemmein") {
 $message = $message.$errmsg ;
 $found_err = 1 ; }

if ($found_err) {
 &PrintError; }

open (LOGFILE, "> ../scripts/announce.js") ;
    flock(LOGFILE, 2) ;
    seek(LOGFILE, 0, 2) ;
        print LOGFILE "//Script by Nabeel Shahzad\n";
        print LOGFILE "//Automatically updates with a Perl Script\n";
        print LOGFILE "document.write('<marquee
scrollamount=4>$headline</marquee>')\n" ;
    flock(LOGFILE, 8) ;
close (LOGFILE) ;

print "Changes have been made\n"
#print << "out";
#   <a href="http://esrclan.vr9.com">click here to go back to the site</a>
#out

sub PrintError {  #line 38
 print "Content-type: text/html\n\n";
 print $message;

 exit 0;
    return 1;
}

sub GetFormInput {

 (*fval) = @_ if @_ ;

 local ($buf);
 if ($ENV{'REQUEST_METHOD'} eq 'POST') {
  read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
 }
 else {
  $buf=$ENV{'QUERY_STRING'};
 }
 if ($buf eq "") {
   return 0 ;
  }
 else {
   @fval=split(/&/,$buf);
  foreach $i (0 .. $#fval){
   ($name,$val)=split (/=/,$fval[$i],2);
   $val=~tr/+/ /;
   $val=~ s/%(..)/pack("c",hex($1))/ge;
   $name=~tr/+/ /;
   $name=~ s/%(..)/pack("c",hex($1))/ge;

   if (!defined($field{$name})) {
    $field{$name}=$val;
   }
   else {
    $field{$name} .= ",$val";

    #if you want multi-selects to goto into an array change to:
    #$field{$name} .= "\0$val";
   }


     }
  }
return 1;
}


thanks for you help,

nabeel





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

Date: Mon, 28 May 2001 17:30:05 -0000
From: David Aslanian <davidaslanian@hotmail.com>
Subject: Re: Search and Replace
Message-Id: <th52othito91aa@corp.supernews.com>


> 2) I would like to run this program for all the files in a given
> directory, so that the search-replace operation can be done on all the
> .html files in a given directory
> 
to do this, you could:

while(defined($file = <*.html>)) {

       #do the "search and replace operation"        }

or you can also specify a dir (in dos or unix)

while(<c:\\*.html>) {       # double \\ are escaped backslashes

       #do the "search and replace operation"        }


    

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 28 May 2001 17:10:05 +0200
From: buggs <buggs@geekmail.de>
Subject: Re: Searching Flat Text File
Message-Id: <9etpma$8hi$06$1@news.t-online.com>

Bart Lateur wrote:

> RoadRunner wrote:
> 
>>I would like to search a text file for any occourances of $keyword. Now,
>>if a line contains $keyword, then just print it. The file is has 228,000
>>lines, so would it make more sense to put everything in a mySQL db?
> 
> I think not. In an SQL db, you need to use the "LIKE '%KEYWORD%'"
> construct, which won't be a speed demon, and is far less powerfull than
> regexes. For example, it would also match parts of a word.
> 


Some DB's have Word Indexes.
Some DB's have RegEx.

If you should use a DB or not
depends on your limits.
But some kind of Structuring your Data
before you perform your search may be
helpful.


Buggs 


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

Date: Mon, 28 May 2001 09:36:07 -0400
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: simple question
Message-Id: <3B125447.4000405@dev.null>



Richard Brown wrote:

> is there a way i can get a perl script to read the data in a url which is
> NOT on the server the script is installed on?

Yes.

In case you are wondering how, you should check out the LWP module. Also 
make sure you read lwpcook, the LWP Cookbook.



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

Date: Mon, 28 May 2001 15:25:11 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: simple question
Message-Id: <3b126cad.4146069863@news.isholf.is>

On Mon, 28 May 2001 12:15:50 +0100, "Richard Brown"
<anarch1st@yahoo.com> wrote:

>is there a way i can get a perl script to read the data in a url which is
>NOT on the server the script is installed on?
>
Use the LWP set of modules from CPAN ( search.cpan.org).
Thwey also come standard with the Activestate Perl 
distribution. 

Regards,
Helgi Briem


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

Date: Mon, 28 May 2001 16:30:14 -0000
From: David Aslanian <davidaslanian@hotmail.com>
Subject: simple reg exp problem
Message-Id: <th4v8mm37i7d50@corp.supernews.com>

hello everyone...

when i try to do this:

$test = "sometext <!--#INCLUDE file2.txt--> someothertext";
if($test =~ m/.*<!--#INCLUDE\s([A-Z1-10\.]+)-->.*/i) { 
         print "a match."; 
} else { print "not a match.";  }

if acts if it was not a match, and it seems like it should be!

any help greatly appreciated...

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 28 May 2001 16:41:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: simple reg exp problem
Message-Id: <8uv4ht8vq76n4gt0d80vk5ibnej03erjrv@4ax.com>

David Aslanian wrote:

>
>$test = "sometext <!--#INCLUDE file2.txt--> someothertext";
>if($test =~ m/.*<!--#INCLUDE\s([A-Z1-10\.]+)-->.*/i) { 
>         print "a match."; 
>} else { print "not a match.";  }
>
>if acts if it was not a match, and it seems like it should be!

No. You want [A-Z0-9\.] in your character class.

[1-10] is just the digits 1 (to 1) and 0.

-- 
	Bart.


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

Date: Mon, 28 May 2001 17:11:42 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: simple reg exp problem
Message-Id: <Xns90AF86AFC1231echangnetstormnet@207.106.92.86>

David Aslanian <davidaslanian@hotmail.com> wrote in 
<th4v8mm37i7d50@corp.supernews.com>:

> hello everyone...
> 
> when i try to do this:
> 
> $test = "sometext <!--#INCLUDE file2.txt--> someothertext";
> if($test =~ m/.*<!--#INCLUDE\s([A-Z1-10\.]+)-->.*/i) { 
>          print "a match."; 
> } else { print "not a match.";  }
> 
> if acts if it was not a match, and it seems like it should be!
> 
> any help greatly appreciated...

Try m/.*<!--#INCLUDE\s([A-Z0-9.]+)-->(.*)/i 

The digits are 0-9, not 0-10.  Also, you don't need to escape the . 
inside a character class, though it doesn't affect the outcome. 
(Question: Is there a style preference on this?)

-- 
EBC


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

Date: Mon, 28 May 2001 17:17:59 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: simple reg exp problem
Message-Id: <Xns90AF87C0F1FECechangnetstormnet@207.106.92.86>

echang@netstorm.net (E.Chang) wrote in 
<Xns90AF86AFC1231echangnetstormnet@207.106.92.86>:

>David Aslanian <davidaslanian@hotmail.com> wrote in 
><th4v8mm37i7d50@corp.supernews.com>:

[snip]

>Try m/.*<!--#INCLUDE\s([A-Z0-9.]+)-->(.*)/i 
>
>The digits are 0-9, not 0-10.  Also, you don't need to escape the . 
>inside a character class, though it doesn't affect the outcome. 
>(Question: Is there a style preference on this?)
>

Oops (as usual).  You can disregard the extra parens ().  

-- 
EBC


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

Date: Mon, 28 May 2001 15:26:57 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: sounder
Message-Id: <3b126de8.4146385306@news.isholf.is>

On Sat, 26 May 2001 09:26:44 -0400, Andras Malatinszky
<nobody@dev.null> wrote:

>Todd Smith wrote:
>
>>>> i COULD, but not without learning them first. I'm a perl guy.

>>> No, you're not.

>> What gives you the authority to say that?

>Article 72 of the Icelandic constitution. See 
>http://www.richmond.edu/~jpjones/confinder/Iceland2.htm#72.
>Your local jurisdiction probably has some sort of a similar stipulation; 
>that's why you can post questions without thinking about them first, 
>quote others without identifying them and expect others to do work you 
>are too lazy to do yourself.

Thanks, Andras.  That was very funny.  And accurate.

Regards,
Helgi Briem


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

Date: Mon, 28 May 2001 07:46:22 -0600
From: pt <mnemotronic@mind\no-spam/spring.com>
Subject: Threads vs. ActiveState Threads
Message-Id: <3B1256AE.A415C6B2@mindspring.com>

    I have a project looming that would benefit from Threads.  The
ActiveState (5.6.1) docs indicate that it uses something called
"IThreads".  Deja-Noogle searches of CLPM may indicate that these are
for system calls only .... not via "use Thread::whatEver ;"
    I can't find any docs on instantiation of iThread objects or use of
iThreads.  Attempting to use Threads (or Thread::Pool) causes my program
to unravel -- ActiveState definitely hasn't woven in support for Thread.

    Sew.... can anyone help me knit something together?




Remove the obvious anti-spam to reply.


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

Date: Mon, 28 May 2001 14:31:53 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Threads vs. ActiveState Threads
Message-Id: <tjtQ6.33041$v5.2766053@news1.rdc1.ct.home.com>

pt <mnemotronic@mind\no-spam/spring.com> wrote:
>     I have a project looming that would benefit from Threads.  The
> ActiveState (5.6.1) docs indicate that it uses something called
> "IThreads".  Deja-Noogle searches of CLPM may indicate that these are
> for system calls only .... not via "use Thread::whatEver ;"
>     I can't find any docs on instantiation of iThread objects or use of
> iThreads.  Attempting to use Threads (or Thread::Pool) causes my program
> to unravel -- ActiveState definitely hasn't woven in support for Thread.

>     Sew.... can anyone help me knit something together?

You'll have to build your own perl. There's no user-level interface to
IThreads at the moment, though that's being worked on. (You'll probably
need to upgrade once it's done, but that's off a bit in the distance)

					Dan


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

Date: Mon, 28 May 2001 15:25:15 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: Re: Threads vs. ActiveState Threads
Message-Id: <1109_991063515@JENDA>

On Mon, 28 May 2001 07:46:22 -0600, pt <mnemotronic@mind\no-spam/spring.com> wrote:
>     I have a project looming that would benefit from Threads.  The
> ActiveState (5.6.1) docs indicate that it uses something called
> "IThreads".  Deja-Noogle searches of CLPM may indicate that these are
> for system calls only .... not via "use Thread::whatEver ;"
>     I can't find any docs on instantiation of iThread objects or use of
> iThreads.  Attempting to use Threads (or Thread::Pool) causes my program
> to unravel -- ActiveState definitely hasn't woven in support for Thread.
> 
>     Sew.... can anyone help me knit something together?

You use fork() to create a thread in ActivePerl.

Read the perlfork.html you got when you installed ActivePerl

jenda




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

Date: 28 May 2001 16:57:20 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Too late for "-T" option at comment_form.cgi line 1.
Message-Id: <9eu01g$f6h$2@216.155.33.93>

In article <th1e1up1errqf0@corp.supernews.co.uk>,
 "David Soming" <davsoming@lineone.net> wrote:

 | Hi,
 | I got as far as line 1 before I stumbled! lol
 | 
 | Just testing this locally and got "Too late for "-T" option at
 | comment_form.cgi line 1."
 | What exactly is #!/usr/bin/perl -wT
 | 
 | If you want the script ill post it. Thanks David.

you've already seen Tad's reply, so I'll just add this: 

from the command line you can do syntax checking of a perl script that 
has the T switch internally on the shebang line like this:

%> perl -cT script-to-test.pl

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Mon, 28 May 2001 13:15:57 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: typeglobs (again)
Message-Id: <slrn9h4j8k.2s4.bernard.el-hagin@gdndev25.lido-tech>

On 28 May 2001 06:02:56 -0700, Grod <ggrothendieck@volcanomail.com> wrote:
>I have tried posting this a few times a but it got cut off each time. 
>Hopefully this time it works.
>
>The following program
>
>   *a = [1..5];
>   print join(" ",@a), "\n";
>   print "@a\n";
>
>correctly prints out 1 2 3 4 5 twice; however, if the two print 
>statements are simply reversed, Perl gives a syntax error on the 
>
>   print "@\n" 

Put 'use diagnostics;' near the top of your program and run it
again. You'll get a precise explanation for this behaviour.

Cheers,
Bernard


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

Date: 28 May 2001 14:04:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: typeglobs (again)
Message-Id: <9etlsm$lpu$1@mamenchi.zrz.TU-Berlin.DE>

According to Grod <ggrothendieck@volcanomail.com>:
> I have tried posting this a few times a but it got cut off each time. 
> Hopefully this time it works.
> 
> The following program
> 
>    *a = [1..5];
>    print join(" ",@a), "\n";
>    print "@a\n";
> 
> correctly prints out 1 2 3 4 5 twice; however, if the two print 
> statements are simply reversed, Perl gives a syntax error on the 
> 
>    print "@\n" 
> 
> statement.

Ah... this is probably the fifth copy of this posting I see, but
the first one to actually contain two print statements.  Swapping
them around doesn't lead to a syntax error, however.  I note that
when you mention 'print "@\n"' again there is no final semicolon.
If that was the case with your original code, swapping the statements
would indeed lead to a syntax error that doesn't happen in the
original arrangement.  (You can leave the ";" off after the last
statement, but not between statements.)

When you don't understand a Perl message, it is a good idea to
put "use diagnostics;" near the beginning of your file.  This
might have cleared up your problem a lot faster than posting
to Usenet.

Anno


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

Date: Mon, 28 May 2001 14:13:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: typeglobs (again)
Message-Id: <j7n4htkipcrd4hnvshuqkb2i4q30hb9p8n@4ax.com>

Grod wrote:

>   *a = [1..5];
>   print join(" ",@a), "\n";
>   print "@a\n";
>
>correctly prints out 1 2 3 4 5 twice; however, if the two print 
>statements are simply reversed, Perl gives a syntax error on the 
>
>   print "@\n" 

	print "@a\n";

>statement.
>
>Any ideas?

Yes. At the time the compiler hits this line, it finds a string
containing an array that perl doesn't know about yet. So it barfs.
Mentioning @a as an array before this line, makes it work. That's why it
works if you put them in the order as above.

-- 
	Bart.


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

Date: 28 May 2001 09:32:26 -0700
From: ggrothendieck@volcanomail.com (Grod)
Subject: Re: typeglobs (again)
Message-Id: <ffd662ea.0105280832.4fde5a27@posting.google.com>

Thanks for the help.  I have a follow on question.

The following program properly prints out <1 2 3 4 5> twice.

	@a = ();
	*a = [1..5];
	print "<@a>\n";
	print "<", join(" ",@a), ">\n";

It also works if I replace the first line with   
	local @a;   
or if I replace the first line with
	our @a;   

However, if I replace the first line with
	my @a = ();
or if I replace the first line with just
	my @a;
then in either of these cases it just prints out <> twice.

What is going on here?  Thanks.


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

Date: Mon, 28 May 2001 16:39:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: typeglobs (again)
Message-Id: <upv4htgk8lb3s6cdm1j1j16hb9c8g62058@4ax.com>

Grod wrote:

>However, if I replace the first line with
>	my @a = ();
>or if I replace the first line with just
>	my @a;
>then in either of these cases it just prints out <> twice.
>
>What is going on here?  Thanks.

Well:

>	*a = [1..5];

This only works on a global. "my" declares a lexical. So you're
assigning this ref to the global, but you're using the lexical
everywhere else in your code.

-- 
	Bart.


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

Date: 28 May 2001 13:34:40 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: typeglobs (again)
Message-Id: <m3u225pebz.fsf@mumonkan.sunstarsys.com>

ggrothendieck@volcanomail.com (Grod) writes:

> Thanks for the help.  I have a follow on question.
> 
> The following program properly prints out <1 2 3 4 5> twice.
> 
> 	@a = ();
> 	*a = [1..5];
> 	print "<@a>\n";
> 	print "<", join(" ",@a), ">\n";
> 
> It also works if I replace the first line with   
> 	local @a;   
> or if I replace the first line with
> 	our @a;   

Sure- @a remains a global array in those cases,
i.e. it refers to the ARRAY slot in the *main::a 
typeglob. 

> However, if I replace the first line with
> 	my @a = ();
> or if I replace the first line with just
> 	my @a;
> then in either of these cases it just prints out <> twice.

"my @a" makes @a lexical- it is not related to *a
anymore.

> What is going on here?  Thanks.

A typeglob is roughly like a sampler box of chocolates, with 
slots for various perl structures.  When perl sees a global 
@a, perl looks for its value in the ARRAY slot of *a:


                    *a
                +--------+
                | SCALAR |
  global @a --> | ARRAY  |  --> [1..5] (our, use vars)
                | HASH   |
                | HANDLE |                        
                | SUB    | 
                +--------+                  


OTOH, lexical variables are *not* associated with 
typeglobs- perl looks for lexical @a's in a "scratchpad".

 lexical @a --> { scratchpad } --> []  (my)    


To see this, try:

  % perl -wle 'my @a = qw/ foo bar /; *a=[1..5]; print "@a"'
  Name "main::a" used only once: possible typo at -e line 1.
  foo bar

  % perl -wle 'my @a; *a=[1..5]; print "@{*a{ARRAY}}"'
  1 2 3 4 5

See Conway's OOP chapter 2 for a nice discussion of
aliasing and typeglobs.

-- 
Joe Schaefer    "When the end of the world comes, I want to be in Cincinnati.
                          Everything happens ten years later there."
                                               --Mark Twain


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

Date: Mon, 28 May 2001 09:06:21 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: url parsing
Message-Id: <3B12777D.9AC12AB4@stomp.stomp.tokyo>

Ilmari Karonen wrote:
 
> John W. Krahn wrote:

(snipped)


(unnoted snippage by Krahn of Karonen's falsifying a quote)


> >The actual quote from RFC 2396 is:

> >   The following line is the regular expression for breaking-down a URI
> >   reference into its components.

> >      ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

> >So I guess Ilmari added the /s for some reason.
 
> I figured it was silly to allow newlines anywhere except in fragment
> identifiers, so I added the /s for consistency.
 

However, you do not think it silly to practice deliberate deceit
nor do you think it silly to incite hatred with each and every
post of yours.

Deceit and Hatred do often walk hand-in-hand, yes they do.

Godzilla!


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

Date: 28 May 2001 09:41:16 -0700
From: rasheed72@hotmail.com (rasheed)
Subject: windows 98 can't use cgi
Message-Id: <2a3f96b2.0105280841.3c90650c@posting.google.com>

I have activeperl for windows installed.  I am using tinyweb as a
server and I can test cgi scripts offline from my localhost.  I am
just learning perl and all I need perl installed for right now is to
test scripts offline.

However, if I put a use command into a perl script, the entire script
fails.  I tried Use Posix and Use CGI and both failed.

Should I look to change the path or what?  How does perl know where
these libraries are stored?

My installation went through with no errors and I can run programs
that don't have the use command.


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

Date: Mon, 28 May 2001 16:43:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: windows 98 can't use cgi
Message-Id: <0305htchgba2ipakhvc499eekosnk865s6@4ax.com>

rasheed wrote:

>However, if I put a use command into a perl script, the entire script
>fails.  I tried Use Posix and Use CGI and both failed.
>
>Should I look to change the path or what?  How does perl know where
>these libraries are stored?
>
>My installation went through with no errors and I can run programs
>that don't have the use command.

My guess is that indeed you used the word "Use". You should use "use"
instead. Perl is case sensitive.

-- 
	Bart.


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

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


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