[16460] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3872 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 1 14:10:34 2000

Date: Tue, 1 Aug 2000 11:10:21 -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: <965153421-v9-i3872@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 1 Aug 2000     Volume: 9 Number: 3872

Today's topics:
    Re: posting in newsgroup using perl script? <r.roosjen@koersagent.nl>
    Re: posting in newsgroup using perl script? <r.roosjen@koersagent.nl>
    Re: posting in newsgroup using perl script? (Logan Shaw)
    Re: posting in newsgroup using perl script? <bart.lateur@skynet.be>
    Re: qmail, good? bad? wheres the online tutorials? (Colin Keith)
    Re: Quotation question (Marcel Grunauer)
    Re: Quotation question <lauren_smith13@hotmail.com>
        Recursive File Processing <dominic01@hotmail.com>
    Re: Recursive File Processing (Greg Bacon)
    Re: Recursive File Processing nobull@mail.com
        Regex not matching ... character using OROMatcher <pl22andfu@yahoo.com>
        regular expression question.... arun_rajappa@my-deja.com
    Re: regular expression question.... (Greg Bacon)
    Re: regular expression question.... <godzilla@stomp.stomp.tokyo>
    Re: Regular expression <billy@arnis-bsl.com>
        relative to absolute Hyperlink-URL <greuer@gmx.de>
    Re: Removing newline chars (Logan Shaw)
    Re: Reserved word (Marcel Grunauer)
    Re: select/vec/pipes question <billy@arnis-bsl.com>
    Re: spliting on caps (newbie) <bart.lateur@skynet.be>
    Re: Substituting a string?! <bart.lateur@skynet.be>
    Re: Syntax Question <bardicstorm@my-deja.com>
    Re: Syntax Question michaeld@brown-cole.com
    Re: system or backticks mchampneys@my-deja.com
    Re: system or backticks mchampneys@my-deja.com
    Re: system or backticks <lauren_smith13@hotmail.com>
        Useragent in access secure web site <lliu00@my-deja.com>
        why open("fifo") hangs? <lukash@rbc.ru>
    Re: why open("fifo") hangs? <lukash@rbc.ru>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 01 Aug 2000 16:19:14 +0200
From: Ron <r.roosjen@koersagent.nl>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <3986DC61.109B146F@koersagent.nl>

Thanks for your example; I tried to run it, but I get an error:

"Can't find string terminator "EOMESS" anywhere before EOF at ./sendnews.cgi line

 10. "

I can't find out how to fix this; do you know how to fix this?

Ron


> Anyhow a minimal example :
>
> #!/usr/bin/perl -w
>
> use strict;
> use Net::NNTP;
>
> my $news = Net::NNTP->new('my.news.host') || die "Can't connect - " ;
>
> if ( $news->postok())
> {
>   my @message = split /\n/,<<`EOMESS`;
> From: Ron <r.roosjen@koersagent.nl>
> Subject: Test
> Newsgroups: misc.test
>
>     'What CAN you mean by talking in this way to ME!' thundered
>      Heathcliff with savage vehemence.  'How - how DARE you, under my
>      roof? - God! he's mad to speak so!'  And he struck his forehead
>      with rage.
>
> EOMESS
>
>   $news->post(@message) || die $news->message;
> }
> else
> {
>    die "Cant post to this host\n";
> }
>
> /J\
> --
> yapc::Europe in assocation with the Institute Of Contemporary Arts
>    <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>



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

Date: Tue, 01 Aug 2000 16:36:04 +0200
From: Ron <r.roosjen@koersagent.nl>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <3986E054.331FDD77@koersagent.nl>

I fixed the 'string terminator' thing by eliminating some spaces before EOMESS.

Now running it gives the following error:

"sh: 1: Syntax error: newline unexpected  "

and the program hangs for a while.

What can this be?




> Anyhow a minimal example :
>
> #!/usr/bin/perl -w
>
> use strict;
> use Net::NNTP;
>
> my $news = Net::NNTP->new('my.news.host') || die "Can't connect - " ;
>
> if ( $news->postok())
> {
>   my @message = split /\n/,<<`EOMESS`;
> From: Ron <r.roosjen@koersagent.nl>
> Subject: Test
> Newsgroups: misc.test
>
>     'What CAN you mean by talking in this way to ME!' thundered
>      Heathcliff with savage vehemence.  'How - how DARE you, under my
>      roof? - God! he's mad to speak so!'  And he struck his forehead
>      with rage.
>
> EOMESS
>
>   $news->post(@message) || die $news->message;
> }
> else
> {
>    die "Cant post to this host\n";
> }



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

Date: 1 Aug 2000 11:26:20 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: posting in newsgroup using perl script?
Message-Id: <8m6tnc$arj$1@provolone.cs.utexas.edu>

In article <3986E054.331FDD77@koersagent.nl>,
Ron  <r.roosjen@koersagent.nl> wrote:
>I fixed the 'string terminator' thing by eliminating some spaces before EOMESS.
>
>Now running it gives the following error:
>
>"sh: 1: Syntax error: newline unexpected  "
>
>and the program hangs for a while.

"sh" is the Bourne shell.  Probably what is happening is that the file
your are using doesn't have "#!" as its first two characters.  In that
case, it will be run by your shell instead of the perl interpreter.
I'm actually going to guess that what's happening specifically is that
you've got some spaces or other blank characters on the line before the
"#!" and that you need to delete those.

  - Logan


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

Date: Tue, 01 Aug 2000 17:05:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <dg0eos8h6c8jfsof6lbq48o9ipml7cmsca@4ax.com>

Ron wrote:

>Now running it gives the following error:
>
>"sh: 1: Syntax error: newline unexpected  "

Is your shebang line pointing to an existing perl executable (and the
correct one)? It's that first line starting with "#!".

-- 
	Bart.


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

Date: Tue, 01 Aug 2000 16:52:19 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: qmail, good? bad? wheres the online tutorials?
Message-Id: <7fDh5.69$DT4.2190663@nnrp2.clara.net>

In article <fSqh5.403074$MB.6329005@news6.giganews.com>, nitty28@excite.com wrote:
>01 Aug 2000 02:15:25 GMT, drdementor@my-deja.com <drdementor@my-deja.com>
> wrote:

>: does perl have such comand built in?
>No.  I think that you're confusing an MTA / MUA with Perl's core
>functionality.  Certainly one can write a MUA in Perl which is
>implemented with core functions but you won't find a qmail() or mail()
>in Perl.  :-)
<cheeky>

use Shell;
 . now you will :-)

</cheeky>

>: are mime modules built into perl?
>No.

See the information on using CPAN in perldoc CPAN, or just crack open a web 
browser and visit http://www.cpan.org/modules (or mirror sites) The 
documentation for most modules is embedded into the module, so once you 
install it you have documentation that is uptodate because its part of the 
same file. perldoc is yer pal.

>: can i send mail without special ad on moduals and stuff thats likely
>: not to be on the system already?
>Yes.

perlfaq9:
=head2 How do I send mail?
Use the C<sendmail> program directly:

Its roughly similar except you'll probably need to use the program 
"qmail-inject" instead of sendmail. (Though that will probably still be on 
there, even if its just a symlink to qmail)




---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Tue, 01 Aug 2000 17:10:08 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Quotation question
Message-Id: <slrn8oe1dk.bth.marcel@gandalf.local>

On Tue, 01 Aug 2000 17:11:59 GMT, Marcus Ouimet <mouimet@direct.ca> wrote:

>I need to use a double quotation " in an area that it will not allow me. Is
>there a way to comment or make perl not read it?


perldoc -f q
	(-> perldoc perlop)

and

perldoc -q 'here doc'


-- 
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Tue, 1 Aug 2000 10:31:10 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Quotation question
Message-Id: <8m71fh$69l$1@brokaw.wa.com>


Marcus Ouimet <mouimet@direct.ca> wrote in message
news:zxDh5.98391$8u4.963160@news1.rdc1.bc.home.com...
> I need to use a double quotation " in an area that it will not allow me.
Is
> there a way to comment or make perl not read it?

Um...  Do you want to do something like this?

print "This is my string.  \"This is a quote.  "; # This is the end of the
quote

because you can also do something like this:

print qq(This is my string.  "This is a quote.  );

Check out the perlop documentation.  There should be a lot of interesting
reading for you in there.

Lauren
--
print grep ord $_,map{y/a-z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print




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

Date: Tue, 01 Aug 2000 15:24:22 GMT
From: Dominic Prakash <dominic01@hotmail.com>
Subject: Recursive File Processing
Message-Id: <8m6q2v$uqu$1@nnrp1.deja.com>

Hello Group,

I need to open certain files recursively and process them. I dont find
any problem in doing this. But When I use "use strict" I am getting

Can't use string ("LIST1") as a symbol ref while "strict refs" in use
at sample.pl line 552, <IN> chunk 4.

How do I solve this. Presently I am using
$LevelCnt = 1;

$File = "aa.txt";
&ProcessFile( $File);

sub ProcessFile {
   my( $ff ) = @_;
   $Handle = "LIST$Handle = "LIST$LevelCnt";
   open ( $Handle, "<$ff") or die "Open Error: $!\n";
   while( <$Handle> ) {
      if( /Condition/ ) {
         $LevelCnt ++;
         $NewFile = "Form a new File";
         ProcessFile( $NewFile )
      }
   }
   close $Handle;
}

Thanks

Dominic


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 16:00:29 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Recursive File Processing
Message-Id: <sodt0tp8dbm113@corp.supernews.com>

In article <8m6q2v$uqu$1@nnrp1.deja.com>,
    Dominic Prakash  <dominic01@hotmail.com> wrote:

: sub ProcessFile {
:    my( $ff ) = @_;
:    $Handle = "LIST$Handle = "LIST$LevelCnt";
:    open ( $Handle, "<$ff") or die "Open Error: $!\n";
:    [...]
:    close $Handle;
: }

If you have version 5.6.0, you can say

    open my %fh, "<$ff" or die "$0: open <$ff: $!\n";

instead of fooling around with the symbol table.  If you still haven't
upgraded, you can localize your handle like

    sub ProcessFile {
        my($ff) = @_;

        local *FH;
        open FH, "<$ff" or die "$0: open <$ff: $!\n";
        ...;
        close FH;
    }

Either of these approaches will make use strict happy.

Greg
-- 
Sometimes nothing can be a pretty cool hand.
    -- Cool Hand Luke


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

Date: 01 Aug 2000 17:49:39 +0100
From: nobull@mail.com
Subject: Re: Recursive File Processing
Message-Id: <u9zomx7wpo.fsf@wcl-l.bham.ac.uk>

Dominic Prakash <dominic01@hotmail.com> writes:

> I need to open certain files recursively and process them. I dont find
> any problem in doing this. But When I use "use strict" I am getting
> 
> Can't use string ("LIST1") as a symbol ref while "strict refs" in use
> at sample.pl line 552, <IN> chunk 4.

You should use strict from the outset rather than try to retro-fit it.

> How do I solve this.

Don't use symbolic refs.

IO::File->new() creates hard references to dynamically allocated
filehandles (well typeglobs actually but who's counting).

Make sure to my() everything in site.

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


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

Date: Tue, 1 Aug 2000 14:02:23 -0400
From: "Peter Lyons" <pl22andfu@yahoo.com>
Subject: Regex not matching ... character using OROMatcher
Message-Id: <8m7398$rna$1@bob.news.rcn.net>

Hi,

  I am using Daniel Savarese's OROMatcher package
 http://www.savarese.org/oro/software/OROMatcher1.1.html ), which allows me
to use Perl5 regular expression in my Java programs.  I am using this regex:

(?:<[^>]+>|[^<]+)

to break a web page up into chunks that are either tags or hunks of content.
It is working well, but it stumbles on the ... character in a web page.  I
believe this is octal \205 or \xC9 (mac) or \x87 (pc) (not sure though).
Anyway, emacs shows it as \205 and windows NotePad shows a black square.  I
need [^<]+ to match this character, but it isn't.  The documentation for
OROMatcher says that all 8-bit ASCII characters will work in character
classes.  Can anyone offer workarounds, perhaps using ranges of hexadecimal
escapes or something?  If you run that regex in Perl5, will it match this
 ... character?

Thanks for any tips you might have for me,

Peter




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

Date: Tue, 01 Aug 2000 15:31:29 GMT
From: arun_rajappa@my-deja.com
Subject: regular expression question....
Message-Id: <8m6qgh$v1n$1@nnrp1.deja.com>

hi,

i have a simple question. i have a program that generates file names of
the format

20000801122801.deo

where the first 6 chars signify the date.

i would like to have a regular expression to verify that the input file
is of this format - however, i am new to perl and dont know how i can
do this.

i tried the following, but it has limitations (allows names like
20001939******.deo)

/2000[01][0-9][0123][0-9]\d\.deo/

can anyone help me by telling me a more accurate way of doing this ?
can it be done in a single regular expression ??

thanks in advance,
- arun


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 16:14:19 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: regular expression question....
Message-Id: <sodtqrp9dbm174@corp.supernews.com>

In article <8m6qgh$v1n$1@nnrp1.deja.com>,
     <arun_rajappa@my-deja.com> wrote:

: i have a simple question. i have a program that generates file names of
: the format
: 
: 20000801122801.deo
: 
: where the first 6 chars signify the date.

Do you mean the first eight characters?

: i would like to have a regular expression to verify that the input file
: is of this format - however, i am new to perl and dont know how i can
: do this.
: 
: i tried the following, but it has limitations (allows names like
: 20001939******.deo)
: 
: /2000[01][0-9][0123][0-9]\d\.deo/
: 
: can anyone help me by telling me a more accurate way of doing this ?
: can it be done in a single regular expression ??

How about this?

    use Date::Calc qw/ Days_in_Month /;

    my @month = qw(
        Jan Feb Mar Apr May Jun
        Jul Aug Sep Oct Nov Dec
    );

    if ($filename =~ /^(\d\d\d\d)(\d\d)(\d\d)\d+\.deo\z/s) {
        # verify month and date ranges
        if ($2 >= 1 && $2 <= 12) {
            if ( $3 >= 1 && $3 <= Days_in_Month($1, $2) ) {
                print "'$filename' is well-formed.\n";
            }
            else {
                die "$month[$2] does not have $3 days (file: '$filename')";
            }
        }
        else {
            die die "month $2 is out of range";
        }
    }
    else {
        die "malformed filename: '$filename'";
    }

Greg
-- 
One tequila, two tequila, three tequila, floor.
    -- George Carlin


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

Date: Tue, 01 Aug 2000 09:58:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: regular expression question....
Message-Id: <39870198.9AB8BEA2@stomp.stomp.tokyo>

arun_rajappa@my-deja.com wrote:


> i have a simple question.

No, you have a jumble of incoherent thoughts.


> i have a program that generates file names
> of the format

> 20000801122801.deo

 
> where the first 6 chars signify the date.

I count eight digits for your date.

 
> i would like to have a regular expression to verify
> that the input file is of this format -

What format? This format shown above or 
some other format?


> however, i am new to perl and dont know how
> i can do this.

If you are new to Perl, how is it you wrote a
program which formats a date string then creates
filenames using this date, creates and writes
a file and, later accesses theses file via an
independent process?

I am skeptical.


> i tried the following, but it has limitations 
> (allows names like 20001939******.deo)

Those asterisks, literal asterisks or do
those asterisks represent something unknown?
If unknown, what character set is represented
by your asterisks? My presumption is, based
on your example, your string does not always
begin with a date string. Does your string
always begin with a date or not? Why are
files with incorrect file names mixed in
with your program created files with
correct filenames? This doesn't make sense.

Why do you not have control of what string
is created by your program for your file name?
You indicate your program creates your file
names which directly creates and writes files.
You have indicated your program opens files.
This does not make sense. Seems to me, if you
have written a program which creates your
file names, your programming would create
this file name precisely in the right format.
Why would your program create an incorrect
filename?

You indicate your program opens files, why
would your program open an incorrect file
unless your program is selecting files at
random. This does not make sense.

So, logic dictates, based on your givens,
there are inconsistencies in your statements.


> /2000[01][0-9][0123][0-9]\d\.deo/
 
> can anyone help me by telling me a more 
> accurate way of doing this ?

Accurate way of doing what? You have not
stated a clear objective.


> can it be done in a single regular expression ??

I suppose "it" could be done if you precisely
and exactly delineate what you are trying to do
in a coherent and cohesive manner.

Anyone who responds to your article with an answer,
is only making a wild guess at what you are trying
to do. 


Godzilla! 

-- 
print "http://mailto:%63%61ll%67i%72l@3483852801/%7e%63%61ll%67i%72l";


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

Date: Tue, 01 Aug 2000 10:37:02 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Regular expression
Message-Id: <3986EE9E.48AF8E9E@arnis-bsl.com>

Chrys wrote:
> 
> Hello,
> I need help for extracting a regex from a line .
> 
> how to extract for instance:
> the # 61242194 from the line:
>  /usr/data/testing/sid61242194/dt.out
> 
> the pattern of the line is always the same.so i've tried to
> use boundary word but it doesnt work.
> I'm new to Perl and I need some guidance.

If you want to match only the patterns *exactly* as above
(and do not match anything else):

$s = q(/usr/data/testing/sid61242194/dt.out);

print "match: $1\n"   if $s =~ m#^/usr/data/testing/sid(\d+)/dt.out$#;


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

Date: Tue, 01 Aug 2000 20:03:56 +0200
From: Andreas Greuer <greuer@gmx.de>
Subject: relative to absolute Hyperlink-URL
Message-Id: <3987110C.58BBE0D4@gmx.de>

Hello,

Some weeks ago I asked this question. But the answers couldn't
help.
So I try again.

I want to exchange relative URLs in a HTML-Document into
absolute.

This means: I have a page like this:
<html><head></head><body>
<a href="http://www.irgendwo.de/seite.html"><img
SRC="bild.gif"></a>
<a href ="bild2.gif"><img SRC=bild.gif></a>
<a href=Seite.html>Seite</a>
<a href=/Seite2.html>Seite2</a>
<a href=http://www.irgendwo.de><img SRC =
http://www.irgendwo.de/bild.gif></a>
</body></html>

It should be transformed into a page like this:
<html><head></head><body>
<a href=http://www.irgendwo.de/seite.html><img
SRC=http://www.sonstwo.de/hier/bild.gif></a>
<a href =http://www.sonstwo.de/hier/bild2.gif><img
SRC=http://www.sonstwo.de/hier/bild.gif></a>
<a href=http://www.sonstwo.de/hier/Seite.html>Seite</a>
<a href=http://www.sonstwo.de/Seite2.html>Seite2</a>
<a href=http://www.irgendwo.de><img SRC =
http://www.irgendwo.de/bild.gif></a>
</body></html>

I asked now several times this.
-I know how to make a list of URLs in a document.
(HTML::LinkExtor)
-I know how to transform a relative URL into an absolute URL.
(URI)

But nobody was able to transform the URLs of a document.

I tried a lot. I tried to make a regular expression. I
installed
modules. But I have no idea how to make it.

Thanks to helpers
Andreas

I put 2 of my tries here. But they are both wrong. Perhaps
somebody
has a suggestion.
 ------------------------------
regular expression

sub absoluter_Pfad_in_href
{
        my $absoluterPfad=shift;
        my $HTMLText=shift;
        $HTMLText =~
s/(src|href)\s*=\s*(\"?)(?!(http:\/\/|mailto))(.*
?)>/\1=\2$absoluterPfad\4>/gi;
#       s       search
#       (src|href)      src or href
#       \s*     no or more space
#       =
#       \s*     no or more space
#       (\"?)   no or one "
#       (?!(http:\/\/|mailto))     if http:// oder mailto, no
change
#       (.*?)   
#       >       Tagend
        return $HTMLText;
}
-------------------------
with Perlmodul URI
use URI;

$doc="<!doctype html public \"-//w3c//dtd html 4.0
transitional//en\">
<html><head></head><body>
<a href=\"http://www.irgendwo.de/seite.html\">
<img SRC=\"bild.gif\"></a>
<a href=\"bild2.gif\">
<img SRC=bild.gif></a>
<a href=Seite.html>Seite</a>
<a href=/Seite2.html>Seite2</a>
<a href=http://www.irgendwo.de><img SRC =
http://www.irgendwo.de/bild.gif></a>
</body></html>
";

$ab="http://www.sonstwo.de/hier/";

$urls = '(' . join ('|', qw{
               http
               telnet
               gopher
               file
               wais
               ftp
           } )
       . ')';


$doc=~ s/(href|src)\s*=\s*\"*(.*?)\"*/$1 ."=".
&ersetze($2,$ab)/eig;
print $doc;

sub ersetze
{
 my $theurl=shift;
 my $Absurl=shift;
 print $theurl."\n";
 print $Absurl."\n";
 $uri = URI->new($theurl);
 return $uri->abs($Absurl);
}

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


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

Date: 1 Aug 2000 12:05:42 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Removing newline chars
Message-Id: <8m7016$b03$1@provolone.cs.utexas.edu>

In article <398676A3.62DCAF4F@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>> >Logan Shaw wrote:
>> >> A textarea doesn't return \r\n if the user is using lynx.
>> >> I just wrote a test script and found this out.
>
>Fascinating. To which internet server did you upload
>this script and what operating system is in use? Mind
>posting a link to this script?

Well, at first I just tested it on my machine at home, which is a
Solaris 8 (Intel) system that uses Apache 1.3.12, perl 5.6.0, and
CGI.pm 2.68.

Just now, I've uploaded it to my school account, which runs on Solaris
7 (SPARC) and also also uses Apache 1.3.12, perl 5.005_02, and CGI.pm
version 2.46.

It does the same thing on both servers and with both lynx 2.7.1 and
2.8.1rel.2.

Anyway, the URL is http://www.cs.utexas.edu/users/logan/linebreaks.cgi .

  - Logan


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

Date: Tue, 01 Aug 2000 16:05:01 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Reserved word
Message-Id: <slrn8odtip.a3o.marcel@gandalf.local>

On Thu, 27 Jul 2000 15:24:59 -0700, chuckw
<chuckwNOchSPAM@silverlink.net.invalid> wrote:

>>Excuse me? If you make a file 'scrubber.pm', "use scrubber;"
>>will work. There's nothing special about the capatalized file
>>names.
>
>Sorry Abagail, you are wrong.

I'd test, read and think twice before saying that.

Then I'd test again.

>
>package scrubber;
>
>sub new {
>   my $self;
>   bless ($self, scrubber);

This is line 6.

>Unquoted string "scrubber" may clash with future reserved word
>at scrubber.pm line 6.


-- 
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Tue, 01 Aug 2000 10:10:05 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: select/vec/pipes question
Message-Id: <3986E84D.2DA192A7@arnis-bsl.com>

Margit Meyer wrote:
> 
> We have a program which sends off child processes to issue commands or
> run scripts/programs on other AIX systems. When the program executes
> from the child process for example "lslpp -l" and then  sleep 20
> seconds, one line of output is displayed, then the sleep 20 seconds,
> then the rest of the output. Nothing should be returned until the child
> process has completed (after the sleep 20 seconds) . We think we have
> narrowed down where the escapee appears and seems to be caused by a
> select statement.  Can  someone help with this? The following is sample
> code where this ocurrs:
> 
> #Loop while at least one file handle is open
>   while ($num_fh > 0) {
> #Wait for outstanding I/O from stdout or stderr
>    $nready = select($rout = $rin, undef, undef, undef);
> 
>    last if ($nready == 0);
> 
> #Data from stdout
>    if (vec($rout, fileno($ofh), 1)) {
>        $_ = <$ofh>;
>        if (length($_)) {
>            print STDOUT "$hostn: $_";
>        } else {#EOF has been reached
>           vec($rin,fileno($ofh),1)=0;
>           $num_fh-;

            You mean $num_fh-- ?

>        }
>    }
> }
> 

Sorry, I really cannot understand what process is the parent,
what is the child, who is supposed to sleep (and when) and who 
is supposed to print (or to return ?) something.

If you could specify you goals more hm-m... precise,
I could try to help you.

Good luck.
Ilja.


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

Date: Tue, 01 Aug 2000 15:50:05 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: spliting on caps (newbie)
Message-Id: <r8sdos016odfef4p7gpupdruioft5st3pv@4ax.com>

Jason Goodrow wrote:

>Hey - I'm trying to split words on caps
>
>@a = split '([A-Z])', $ARGV[0];
>
>foreach $spl (@a) {
>print "$spl\n";}

>> ./w2 SplitAllTheseWords

You may be after:

	@a = split /(?=[A-Z])/, $ARGV[0];
-->
	Split
	All
	These
	Words

-- 
	Bart.


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

Date: Tue, 01 Aug 2000 16:02:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Substituting a string?!
Message-Id: <ofsdoskkj0elcju58brs66s8jambgvos91@4ax.com>

<acfernandes@netc.pt> wrote:

>old:
>p=12,as=43,w=8;
>p=2,as=1344,y=9;
>
>new:
>p=12,w=8;
>p=2,y=9;
>
>I need to remove the mentioning of as=... in
>all lines and save to a new file.

Several ways.

A]

	s/(?<![^,])as=[^,;\n]+,?//;

B]

	s/;\s*$//;
	$_ = join ',', grep { !/^as=/ } split /,/;
	$_ .= ";\n";

C]
	s/;\s*$//;
	%hash = map { split /=/, $_, 2 } split /,/, $_;
	delete $hash{as};
	$_ = join ',', map { "$_=$hash{$_}" } keys %hash;
	$_ .= ";\n";

Although it's very likely that the order of the "variables" will change;
plus it won't allow duplicate names.

-- 
	Bart.


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

Date: Tue, 01 Aug 2000 16:53:48 GMT
From: BardicStorm <bardicstorm@my-deja.com>
Subject: Re: Syntax Question
Message-Id: <8m6vaq$2v3$1@nnrp1.deja.com>


> Did you notice the flags you can pass to perldoc? Namely
>
> perldoc -f <function> -- search for help on <function>
> perldoc -q <keyword>  -- search the FAQ for help on <keyword>
>
> Trying 'perldoc -q read' pulls up a number of entries, including "How
> can I read in a file by paragraph?" which is similar to what you're
> trying to do and points you toward $/.
>
> -mjc

Oh, wow..  no I didn't know you could do that..  that will make life
alot easier.. my thanks again.. you've been most helpful..


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 17:38:32 GMT
From: michaeld@brown-cole.com
Subject: Re: Syntax Question
Message-Id: <8m71un$59b$1@nnrp1.deja.com>

In article <3985E76F.9EE93860@home.com>,
  Michael Carman <mjcarman@home.com> wrote:
> Then please do yourself (and all of us) a favor by familiarizing
> yourself with the resources available to you. The first is a utility
> called 'perldoc' that came as part of your Perl distribution. Go to a
> command line and type the following:
>
> perldoc perldoc
> perldoc perl
> perldoc perltoc
>
> Those should get you started. Perldoc contains all the standard
> documentation, FAQs, and even a couple tutorials. It should be the
first
> place you turn with questions. Why? Because most of the questions you
> (as a newbie) are likely to come up with have been asked and answered
a
> thousand times. The docs contain quick, handy, and *correct* answers.
> Posts to Usenet are slower and more error-prone.
>
> Next, if you've RTFM (Read The F*ing Manual) and checked the FAQ, and
> you still can't find an answer, post here. There are some general
> conventions on posting. Following them will improve your results and
> save you the cost of asbestos pants:
>
> * Have a meaningful subject. Things like "Help!" and "Perl question"
>   are not meaningful and will largely be ignored.
> * If possible, include a short snippet of code which exhibits the
>   problem you're having.
> * When responding to a post, place your comments *after* quoted text,
>   and quote only the things you're responding to.
>
> In your case "Sytax Question" is a little vague. "How do I slurp a
> file?" would be clearest to the locals here, but if you're not
familiar
> with that lingo, something like "How do I read an entire file into a
> string?" would work just fine.
>
> Enjoy...
>
> -mjc

If I could, I'd like to humbly add a few of my observations regarding
the FAQ's and new posters.  I'm not going to disagree with anyone in
this group regarding the FAQ's and documentation.  I'd like to add,
however, that I had a hard time comprehending some of the language in
the docs and faqs.  What helped my was lurking in this newsgroup for a
*long* time.  I've been lurking clpm for about two years, and when I
was first starting out with perl I believe I got more out of perl from
lurking and reading archived posts than I did with the documentation.
This also instilled in me the importance of checking available docs and
archive posts before posting my problem.  I just wanted to mention that
you can avoid a lot of usenet-iquette faux pas and solve a lot of
problems by reading usenet archives in addition to the documentation.
I also found the documentation archive at www.perl.com a little more
serviceable to the way I work than the command-line perldoc.

--
--------------------------
michaeld_at_brown-cole.com
binky_at_bingo-lan.org


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 16:00:14 GMT
From: mchampneys@my-deja.com
Subject: Re: system or backticks
Message-Id: <8m6s6b$ft$1@nnrp1.deja.com>

Hi Tina!

In article <8m4r01$5mcr3$6@ID-24002.news.cis.dfn.de>,
  news@tinita.de wrote:

> any more information about what goes wrong?
> any error message?
> $test = system("@args") or die $!;

Unfortunately, no.  I replaced my line with yours above and it just
died with no error message.

> btw, is this line correct?
> > @args=("jpegsize.exe", "test.jpg", "$testt.jpg");
> or did you want to write
> @args=("jpegsize.exe", "test.jpg", "testt.jpg");

Oops, yes the $testt.jpg was a mistake.

> maybe you want to use the qw operator, too.
> but that shouldn't solve your problem.

You are right, it didn't solve my problem.  Any ideas?

Thanks!

Matt
> tina
>
> --
> http://tinita.de    \  enter__| |__the___ _ _ ___
> tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
> search & add comments \    \ _,_\ __/\ __/_| /__/ perception
> please no answers via email unless followup is set to poster.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 16:19:40 GMT
From: mchampneys@my-deja.com
Subject: Re: system or backticks
Message-Id: <8m6tam$1ca$1@nnrp1.deja.com>

Hi Lauren!

In article <8m4r60$1dq$1@brokaw.wa.com>,
  "Lauren Smith" <lauren_smith13@hotmail.com> wrote:
>
> Are you in the right directory to execute jpegsize.exe?

Yes, the perl script is in the same directory as jpegsize.exe and does
not access any other directories.

> What are you trying to capture in $test?

That was a typo.  The $ shouldn't be there.  Removing it does not solve
my problem, unfortunately.

> Have you read the documentation for system() (which also describes the
> backticks, and their respective differences)?
>
> perldoc -f system

Yes, I have also consulted the O'Reilly Book, Programming Perl.  I
don't really care how it gets done, I just need to get jpegsize.exe
executed from within my Perl script.

jpegsize.exe is a small compiled C++ program that loads a .jpg image
file (the first parameter), resizes it and then creates another image
even smaller for a thumbnail (the second parameter) and saves both
as .jpg images.

Thanks!

Matt



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 1 Aug 2000 10:22:18 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: system or backticks
Message-Id: <8m70ur$4kb$1@brokaw.wa.com>


<mchampneys@my-deja.com> wrote in message
news:8m6tam$1ca$1@nnrp1.deja.com...
> Hi Lauren!

Hi again Matt!

>
> jpegsize.exe is a small compiled C++ program that loads a .jpg image
> file (the first parameter), resizes it and then creates another image
> even smaller for a thumbnail (the second parameter) and saves both
> as .jpg images.

When you say:

$test = system("jpegsize.exe test.jpg testt.jpg");

Are you trying to capture some sort of value in $test?  If the program
creates a second file, it seems to me that checking for the existence of the
newly created file is necessary, not the return value of 'jpegsize.exe'
(which returns 0 on exit and is the reason why 'system("jpegsize.exe ...")
or die $!' dies right away).

Why not just do something like:

system("jpegsize.exe test.jpg testt.jpg");
if (-e "testt.jpg") {
   print "Thumbnail created\n";
} else {
   print "Thumbnail not created!\n";
}

Lauren





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

Date: Tue, 01 Aug 2000 17:08:27 GMT
From: beginner <lliu00@my-deja.com>
Subject: Useragent in access secure web site
Message-Id: <8m7066$3qa$1@nnrp1.deja.com>

I tried to use LWP::UserAgent from Linux box to automatically access
a secure web site: https://login.domain.com/cgi/login.cgi.
Here is the code:

use LWP::UserAgent;
use HTTP::Cookies;


$ua = new LWP::UserAgent;
$ua -> proxy( ['http','https'], 'http://proxy/');
$ua -> cookie_jar( new HTTP::Cookies);

$url="https://login.domain.com/cgi/login.cgi";
$login = "login=user&password=pass";

$request = new HTTP::Request(POST=>$url);
$request->content_type( 'application/x-www-form-urlencode' );
$request->content( $login );

$response = $ua -> request( $request );

if( $response -> is_success ) {
	print $response->content;
} else {
	print $response->error_as_HTML;
}

I did not get anything back from the request, return code = 200 and msg
= OK, but nothing, when I put in the internet browser as:
https://login.domain.com/cgi/login.cgi?login=user&password=pass, I got
logged in and see all the content.

I tried use both POST and GET, no luck.

Please help!

Thanks!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 17:17:20 GMT
From: Sergey Lukashevich <lukash@rbc.ru>
Subject: why open("fifo") hangs?
Message-Id: <8m70mq$495$1@nnrp1.deja.com>

perl 5.6.0 undef RedHat Linux 6.2

I am qurious why opening a named pipe makes my perl HANG?

#########
use POSIX qw(mkfifo);
unlink($WellKnownFIFO);
mkfifo($WellKnownFIFO,0777) or die $!;
open(C,"$WellKnownFIFO") or die $!;
# REACHES HERE only when a write to FIFO occurs
#########

The same thing with opening FIFO for writing:
open(C,">$WellKnownFIFO") or die $!;

How can I make perl hanging on the 'read' op not open??
Please Help!

----------------------------
Sergey Lukashevich


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 01 Aug 2000 17:42:38 GMT
From: Sergey Lukashevich <lukash@rbc.ru>
Subject: Re: why open("fifo") hangs?
Message-Id: <8m726d$5cr$1@nnrp1.deja.com>



I am sorry -- this is Unix's feature, not Perl's
So I have to requery this question in some Unix conference...


In article <8m70mq$495$1@nnrp1.deja.com>,
  Sergey Lukashevich <lukash@rbc.ru> wrote:
> perl 5.6.0 undef RedHat Linux 6.2
>
> I am qurious why opening a named pipe makes my perl HANG?
>
> #########
> use POSIX qw(mkfifo);
> unlink($WellKnownFIFO);
> mkfifo($WellKnownFIFO,0777) or die $!;
> open(C,"$WellKnownFIFO") or die $!;
> # REACHES HERE only when a write to FIFO occurs
> #########
>
> The same thing with opening FIFO for writing:
> open(C,">$WellKnownFIFO") or die $!;
>
> How can I make perl hanging on the 'read' op not open??
> Please Help!
>
> ----------------------------
> Sergey Lukashevich
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

--
----------------------------
Sergey Lukashevich


Sent via Deja.com http://www.deja.com/
Before you buy.


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3872
**************************************


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