[18399] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 567 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 26 09:05:46 2001

Date: Mon, 26 Mar 2001 06:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985615516-v10-i567@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 26 Mar 2001     Volume: 10 Number: 567

Today's topics:
        "Compiler" 1.2 <aotto@t-online.de>
    Re: "Compiler" 1.2 <bart.lateur@skynet.be>
    Re: "Compiler" 1.2 (Randal L. Schwartz)
        'perl guy' wanted. <jfitzsimmons1@home.com>
        Don't know what happened <pigpen@easynews.com>
    Re: Don't know what happened <bart.lateur@skynet.be>
    Re: Email do not show up in MYSQL <mknscott@hotmail.yesyouremovethis.com>
    Re: Email do not show up in MYSQL (Damian James)
    Re: Email do not show up in MYSQL (Michel Dalle)
    Re: Email do not show up in MYSQL (Tad McClellan)
        Error DBI <bertj00@americasm01.nt.com>
    Re: FOREACH little victory, I take a beating [solved] <pigpen@easynews.com>
    Re: FOREACH little victory, I take a beating <bigrich318@yahoo.com>
        grep(EXPR,LIST) behaves strangely <ronald.fischer.gp@icn.siemens.de>
    Re: Hmmm... Which PERL Book Is Best Suited For This??? (Randal L. Schwartz)
    Re: How to post to a newsgroup from a script? <waverley2000@hotmail.com>
    Re: How to post to a newsgroup from a script? <andrew@erlenstar.demon.co.uk>
    Re: Newbie help <chaga@hotmail.com>
    Re: Problem running 'traceroute' command from perl scri <bart.lateur@skynet.be>
    Re: Problem running 'traceroute' command from perl scri (Andre Malo)
    Re: remove 'new line' from last element in array <bigrich318@yahoo.com>
    Re: Replacing spaces in a url with %20 (Randal L. Schwartz)
        Sorry for not posting sample data and $delimit = ----.  <pigpen@easynews.com>
    Re: String::Approx buggy ? <iltzu@sci.invalid>
    Re: String::Approx buggy ? <scollyer@netspinner.dont-spam.co.uk>
        Sub String <carllindsay1978@nospam.hotmail.com>
        Sub string <carllindsay1978@nospam.hotmail.com>
    Re: system() return value <ronald.fischer.gp@icn.siemens.de>
    Re: Writing a script to install Perl modules automatica <e_bachmann@hotmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 26 Mar 2001 11:45:35 +0200
From: Andreas Otto <aotto@t-online.de>
Subject: "Compiler" 1.2
Message-Id: <3ABF0FBF.E876B002@t-online.de>


Hi,

  "Compiler" has a new home

      http://www.compiler-factory.com

  Release  1.2  is out


  what's new :

    * new WEB interface
    * new user interface ( master - slave )
    * new licence key's
    * new examples


  i look for :

    * tcl community place(s) to put a banner on
    * sales representative for different country's
    * please email  mailto:aotto@t-online.de   


mfg

  aotto :)


-- 
================================================================
Andreas Otto              Phone: ++49-(0)8152-399540
IPN Ingenieurbuero fuer   mailto:aotto@t-online.de
    Praezisionsnumerik    Web: http://home.t-online.de/home/aotto
Ulmenstrasse 3            Skills: Unix,Sql,Tcl,Shell,Sybase...
D-34289 Zierenberg        Area: Bank, FX, MM, shares, options
=================================================================


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

Date: Mon, 26 Mar 2001 11:43:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: "Compiler" 1.2
Message-Id: <graubtg2inoed6ou3r3okv8q9gurb16tni@4ax.com>

Andreas Otto wrote:

>  "Compiler" has a new home
>
>      http://www.compiler-factory.com
>
>  Release  1.2  is out

Wrong newsgroup. Your "compiler" only works (at best ;-) with TCL. This
is not the TCL newsgroup.

-- 
	Bart.


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

Date: 26 Mar 2001 03:53:51 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: "Compiler" 1.2
Message-Id: <m1itkwoieo.fsf@halfdome.holdit.com>

>>>>> "Andreas" == Andreas Otto <aotto@t-online.de> writes:

Andreas> Hi,

Andreas>   "Compiler" has a new home

Perl content: 0
Spam likelyhood: 85%

Andreas>     * sales representative for different country's

Commercial posting likelyhood: 98%

foo on you

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 26 Mar 2001 13:30:02 GMT
From: Jim Fitzsimmons <jfitzsimmons1@home.com>
Subject: 'perl guy' wanted.
Message-Id: <B6E4AE8C.2B46D%jfitzsimmons1@home.com>

Help! my perl guy is sick (for the next few months apparently) , just as
I've finally tracked down a bug.

Any kind soul willing to bail me out?
I've got a perl script using DBI that sends comments from a text field form
to a mysql database.
Works great, unless there is an apostrophe in the comments field where the
posting gets lost in space because mysql complains about the apostrophe.

I think I need to use quote something or other from the perl DBI, but I have
no idea where/how to implement it in the script.

Not looking for a free ride. will pay for your time.

Please contact me at jim@ramseeker.com if interested.
-- 
Jim Fitzsimmons, President - ramseeker.
memory price tracking for the Mac.  2000+ prices listed
http://www.ramseeker.com | jim@ramseeker.com




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

Date: Mon, 26 Mar 2001 12:37:33 GMT
From: "Nancy" <pigpen@easynews.com>
Subject: Don't know what happened
Message-Id: <hKGv6.2646$am2.513913@news.easynews.com>

I don't know why my message ended up in the subject line.  I'm sorry about
that. The content was in the message window when I hit send. sorry again.

"Nancy" <pigpen@easynews.com> wrote in message
news:AEGv6.2595$am2.505128@news.easynews.com...




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

Date: Mon, 26 Mar 2001 13:53:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Don't know what happened
Message-Id: <seiubtk2u20ohgpvgrauorpmq36ehfh6c5@4ax.com>

Nancy wrote:

>I don't know why my message ended up in the subject line.  I'm sorry about
>that. The content was in the message window when I hit send. sorry again.

This is what happened:

>X-Newsreader: Microsoft Outlook Express 5.50.4133.2400

It's again an example what happens if overzealous software tries to fill
in what users forgot.

Besides, it's not the whole message. It's only the first paragraph.

-- 
	Bart.


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

Date: Mon, 26 Mar 2001 13:45:23 +0100
From: Kenny Scott <mknscott@hotmail.yesyouremovethis.com>
Subject: Re: Email do not show up in MYSQL
Message-Id: <3ABF39E3.E99DA45D@hotmail.yesyouremovethis.com>



Victor Prasad wrote:
> 
> Hello,
> 
> I am trying to use an HTML form to a perl script to pass an email
> address in the form:
> 
> test@test.com
> 
> It shows up in the database and perl script as:  test%40test.com
> 
> I am using the POST method - how do I get it to enter it correctly?

You could run it through a regex first, ie

$email =~ s/%40/@/;

which will change it before you stick it in your database.

Kenny


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

Date: 26 Mar 2001 12:46:46 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Email do not show up in MYSQL
Message-Id: <slrn9buegj.qba.damian@puma.qimr.edu.au>

Victor Prasad chose Mon, 26 Mar 2001 10:55:51 GMT to say this:
>
>...
>
>test@test.com
>
>It shows up in the database and perl script as:  test%40test.com
>

Okay, you've established that the database side of this is irrelevent.

>I am using the POST method - how do I get it to enter it correctly?
>

The direct answer is that you should investigate one of the many modules
available for decoding html- and url-encoded characters. While you can do
this with s///, you won't deal with all such characters until you run into
them. This ought to be considered too late.

The correct answer is that you should be using the CGI module, which would
have done this for you, as well as made you life easier in parsing the
input you get from CGI. 

On any working Perl installation, try typing 'perldoc CGI' at the command
prompt.

>Thanks,
>

You're welcome

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Mon, 26 Mar 2001 13:45:24 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Email do not show up in MYSQL
Message-Id: <99ndoo$2pe$1@news.mch.sbs.de>

In article <3ABF2189.6DD2C803@spliced.com>, vivekvp@spliced.com wrote:
>Hello,
>
>I am trying to use an HTML form to a perl script to pass an email
>address in the form:
>
>test@test.com
>
>It shows up in the database and perl script as:  test%40test.com
>
>I am using the POST method - how do I get it to enter it correctly?

 ..
use CGI qw/:standard/;
 ..
my $email = param('email');
 ..

will give you the correct e-mail value instead of the encoded one.

This will also get rid of the %20 and + instead of spaces, and any
other "weird" things that are encoded by the browser before it
sends back the form data to your script...

And be sure to read the WWW Security FAQ before doing
anything with the data you receive from your HTML form :
http://www.w3.org/Security/Faq/www-security-faq.html

HTH,

Michel.


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

Date: Mon, 26 Mar 2001 07:04:01 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Email do not show up in MYSQL
Message-Id: <slrn9buc1h.7d1.tadmc@tadmc26.august.net>

Victor Prasad <vivekvp@spliced.com> wrote:
>
>I am trying to use an HTML form to a perl script 

>It shows up in the database and perl script as:  test%40test.com
>
>I am using the POST method - how do I get it to enter it correctly?


Try typing these:

   perldoc CGI

   perldoc -q CGI


You are expected to check the Perl FAQ *before* posting to 
the Perl newsgroup. Perl FAQ, part 9:

   "How do I decode a CGI form?"


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 Mar 2001 07:16:00 -0500
From: "Bertrand, Jean-Starff [BAN:X740:EXCH]" <bertj00@americasm01.nt.com>
Subject: Error DBI
Message-Id: <3ABF3300.48937B72@americasm01.nt.com>

How can i fix that error

install_driver(Oracle) failed: Can't load
'd:/ActivePerl/site/lib/auto/DBD/Oracle/Oracle.dll' for
module DBD::Oracle:load_file:Access
is denied at d:/ActivePerl/lib/DynaLoader.pm line 200. at
(eval 1) line 3

Compilation failed in require at (eval 1) line 3. Perhaps a
required shared library or dll isn't installed where
expected at F:\test\cgi-bin\GenererCompany4.pl line 29




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

Date: Mon, 26 Mar 2001 13:16:49 GMT
From: "Nancy" <pigpen@easynews.com>
Subject: Re: FOREACH little victory, I take a beating [solved]
Message-Id: <5jHv6.3106$am2.572412@news.easynews.com>

Thanks Rich!  You solved the problem. I needed the values changed outside
the loop.  Your explanation made my problem clear.  Setting the values
outside the loop, then changing them within the loop gives me what I need.
Sorry for the incomplete posting.  I'm never sure how much code to post.
The sub that this snippet resides in is 329 lines.  I've seen complaints
about posting too much code before.

FWIW, the three variables are used to display/hide buttons at the bottom of
a web page that submit specific values if clicked.  If the user has already
programmed spec's for covers, hiding the "Add Cover" button is desired to
keep them from adding covers twice (trying to make the script idiot proof so
I can use it : ).

Thanks Again!!


"Rich" <bigrich318@yahoo.com> wrote in message
news:tbud348r1svo6c@corp.supernews.com...
>
> "Nancy" <pigpen@easynews.com> wrote in message
> news:NcAv6.2677$dM.549831@news.easynews.com...
> > I have the following foreach statement that I can't beat into
submission.
> It
> > reads @orders just fine and prints each line of the output properly, but
> I
> > also need to look at each line, and set a corresponding variable.  The
> best
> > I can come up with only seems to be reading the last line of @orders to
> set
> > the variables, but otherwise processes each line properly.  BTW, there
> will
> > never be more than 4 lines in @orders.  What basic concept am I failing
> to
> > grasp here?
>
> Basic concept 1: Post the actual code. Copy and paste to avoid typos.
>
> >
> > my ($i)=0;
> > foreach $line (@orders) {
> >    ($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
> > $plex, $originals) = split (/$delimit/, $line);
> >
> >          if ($item eq 'Cover Charges') {$msg_cov = 0;  } else {
$msg_cov
> =
> > 1;  }
> >          if ($item eq 'Inserts') {$msg_ins = 0;  } else {  $msg_ins =
> ;  }
> >          if ($item eq 'Finishing') {$msg_fin = 0;  } else {  $msg_fin =
> > ;  }
>
> Is "else {  $msg_fin =;  }" correct or a typo?
>
> >                 ++$i;
>
> Why keep count? You don't use it in this code.
>
> > print " A lot of the data in a pretty format. \n";
>
> We'll have to take your word for it.
>
> > }
>
> It is unclear how or why you are using $msg_cov $msg_ins and $msg_fin. Are
> you using them inside the loop or outside of the loop?
>
> If you are using them inside of the loop, then the problem has to do with
> the way you are using them but without all of the code there is no way to
> give a solution.
>
> Each time through the loop, the values of $msg_cov $msg_ins and $msg_fin
> are set based on the value of $item. If you don't use or save those values
> within the loop, they are re-set with each iteration with the final values
> based on the last iteration. That's why it appears to only read the last
> line.
>
> If they are used outside of the loop, and you just want to change the
value
> of any of those variables if the "$line"s in @order contain the
appropriate
> values, set them outside of the loop and change them ,if needed, in the
> loop.
>
> my ($i)=0;
> my $msg_cov = 1;
> my $msg_ins = 1;
> my $msg_fin = 1;
>
> # $msg_cov $msg_ins and $msg_fin
> # are each set to 1 before entering loop
>
> foreach $line (@orders) {
> ($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
> $plex, $originals) = split (/$delimit/, $line);
> if ($item eq 'Cover Charges') {$msg_cov = 0;  }
> if ($item eq 'Inserts') {$msg_ins = 0;  }
> if ($item eq 'Finishing') {$msg_fin = 0;  }
> ++$i; # Why the count? You don't use it.
> print " A lot of the data in a pretty format. \n";
> }
>
> # $msg_cov $msg_ins and $msg_fin could now be
> # set to 0 or 1 if they were changed in the loop
>
>
>
>
>
>
>
>
>
>
>
>
>




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

Date: Mon, 26 Mar 2001 06:25:39 -0600
From: "Rich" <bigrich318@yahoo.com>
Subject: Re: FOREACH little victory, I take a beating
Message-Id: <tbud348r1svo6c@corp.supernews.com>


"Nancy" <pigpen@easynews.com> wrote in message
news:NcAv6.2677$dM.549831@news.easynews.com...
> I have the following foreach statement that I can't beat into submission.
It
> reads @orders just fine and prints each line of the output properly, but
I
> also need to look at each line, and set a corresponding variable.  The
best
> I can come up with only seems to be reading the last line of @orders to
set
> the variables, but otherwise processes each line properly.  BTW, there
will
> never be more than 4 lines in @orders.  What basic concept am I failing
to
> grasp here?

Basic concept 1: Post the actual code. Copy and paste to avoid typos.

>
> my ($i)=0;
> foreach $line (@orders) {
>    ($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
> $plex, $originals) = split (/$delimit/, $line);
>
>          if ($item eq 'Cover Charges') {$msg_cov = 0;  } else {  $msg_cov
=
> 1;  }
>          if ($item eq 'Inserts') {$msg_ins = 0;  } else {  $msg_ins =
;  }
>          if ($item eq 'Finishing') {$msg_fin = 0;  } else {  $msg_fin =
> ;  }

Is "else {  $msg_fin =;  }" correct or a typo?

>                 ++$i;

Why keep count? You don't use it in this code.

> print " A lot of the data in a pretty format. \n";

We'll have to take your word for it.

> }

It is unclear how or why you are using $msg_cov $msg_ins and $msg_fin. Are
you using them inside the loop or outside of the loop?

If you are using them inside of the loop, then the problem has to do with
the way you are using them but without all of the code there is no way to
give a solution.

Each time through the loop, the values of $msg_cov $msg_ins and $msg_fin
are set based on the value of $item. If you don't use or save those values
within the loop, they are re-set with each iteration with the final values
based on the last iteration. That's why it appears to only read the last
line.

If they are used outside of the loop, and you just want to change the value
of any of those variables if the "$line"s in @order contain the appropriate
values, set them outside of the loop and change them ,if needed, in the
loop.

my ($i)=0;
my $msg_cov = 1;
my $msg_ins = 1;
my $msg_fin = 1;

# $msg_cov $msg_ins and $msg_fin
# are each set to 1 before entering loop

foreach $line (@orders) {
($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
$plex, $originals) = split (/$delimit/, $line);
if ($item eq 'Cover Charges') {$msg_cov = 0;  }
if ($item eq 'Inserts') {$msg_ins = 0;  }
if ($item eq 'Finishing') {$msg_fin = 0;  }
++$i; # Why the count? You don't use it.
print " A lot of the data in a pretty format. \n";
}

# $msg_cov $msg_ins and $msg_fin could now be
# set to 0 or 1 if they were changed in the loop















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

Date: Mon, 26 Mar 2001 15:41:21 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: grep(EXPR,LIST) behaves strangely
Message-Id: <3ABF4701.69DD6B1C@icn.siemens.de>

Who can help me with this? I have

@ids=(3,5,6);

When I write

$count = grep { $_ == 5 } @ids;

I get, as expected, $count==1. But if I write the statement as

$count = grep('$_ == 5',@ids);

I get $count==3

Ronald Fischer
-- 
Ronald Otto Valentin Fischer <rovf@earthling.net>
[now at: Siemens ICM N MR UR DE 6, phone: +49(Germany)+89-722-23368]
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html


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

Date: 26 Mar 2001 03:50:33 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <m1u24goik6.fsf@halfdome.holdit.com>

>>>>> "---Pete---" == ---Pete---  <bogus@erol.com> writes:

---Pete---> Upon reviewing all those books, it was a close race between
---Pete---> "Programming Perl" and "Mastering PERL 5". I thought that 
---Pete---> "Mastering PERL 5" was well organized, indexed best and the
---Pete---> type was larger making it easier on the eyes, but the
---Pete---> "Programming Perl" book won out becasue it was more detailed
---Pete---> and had more examples in the topics I was interested in.

If it's a close race, then let me throw one additional item into the
pot.

Buying "Programming Perl" puts about a buck-n-change into Larry's
pocket, and keeps O'Reilly and Associates happy enough to keep
employing Larry full time so he can concentrate on Perl rather than
have to work at a "day job" to support his family while he spends his
nights and weekends on Perl.

That should be more than enough to tip *any* scale.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 26 Mar 2001 13:09:41 +0100
From: "Chris Thompson" <waverley2000@hotmail.com>
Subject: Re: How to post to a newsgroup from a script?
Message-Id: <985608536.28765.0.nnrp-08.c1ed3545@news.demon.co.uk>

<blah@blah.blah.invalid> wrote in message
news:tbtj8mmhlu7183@corp.supernews.com...
> Chris Thompson <waverley2000@hotmail.com> wrote:
> > Hi!  I am currently trying to build a script which will post details of
job
> > vacancies to relevant jobs newsgroups. I have a suspicion a newsgroup
> > posting could be done using the Net::NNTP module, but despite my best
> > efforts I haven't been able to get this to work.
> >
> > Any advice or examples of similar scripts would be much appreciated.
>
> Net::NNTP (or News::NNTPClient) is the right way to go.  They both come
> with fine documentation.  Since you haven't said what you have done,
> I'm not in any position to tell you what to do next.  My general advice,
> though, is to try harder.
>
> Eric


Eric, thanks for your help, nice to know I'm not barking up completely the
wrong tree!

The error message I am receiving is as follows:

Software error:
Can't call method "group" on an undefined value at
/host/w/a/v/p/o/r/waverley.portland.co.uk/cgi-bin/post_to_newsgroups.cgi
line 68.

My own (novice's) interpretation of this is that somehow the $nntp variable
isn't getting initialised properly in the "my $nntp = new
Net::NNTP('news.demon.co.uk');" line of the script, though I am not sure how
to get this working. The news server specified is not the one where the
script is hosted, does this matter?  I've included the relevant parts of the
script below, if this is any help.

Any advice greatly appreciated.

Chris


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

use CGI;
use CGI::Carp qw{fatalsToBrowser};
use strict;
use Net::NNTP;

my $co = new CGI;
my $nntp = new Net::NNTP('news.demon.co.uk');

print $co->header;

my @newsgroups_to_send_to = split(" ", $co->param('newsgroups'));  # gets
the newsgroups to send to

# construct content of posting
my @posting = qq`
Position: Web Developer
Web developer required to join prestigious Internet consultancy.
----------
`;

# loop through all of the newsgroups to send to and send details to each one
using the net::nntp module
my $newsgroup_to_send_to;
foreach $newsgroup_to_send_to (@newsgroups_to_send_to) {

    # select newsgroup
    $nntp->group($newsgroup_to_send_to);

    # post message
    $nntp->post(@posting);
};

# display success message
print qq`
<HTML>
<HEAD>
<TITLE>Post Vacancy Details to Newsgroups</TITLE>
</HEAD>
<BODY>

<H1>Post Vacancy Details to Newsgroups</H1>

The vacancy has been succesfully posted to the selected newsgroups.<P>

</BODY>
</HTML>
`;





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

Date: 26 Mar 2001 14:20:04 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: How to post to a newsgroup from a script?
Message-Id: <871yrkbraz.fsf@erlenstar.demon.co.uk>

>>>>> "Chris" == Chris Thompson <waverley2000@hotmail.com> writes:

 Chris> My own (novice's) interpretation of this is that somehow the
 Chris> $nntp variable isn't getting initialised properly in the "my
 Chris> $nntp = new Net::NNTP('news.demon.co.uk');" line of the
 Chris> script, though I am not sure how to get this working. The news
 Chris> server specified is not the one where the script is hosted,
 Chris> does this matter?

Yes.

I won't be any more explicit than that, or point out any of the other
bugs in your script, because automated posting of job ads is an abuse
of Usenet. In some newsgroups it's got so bad that no-one reads them
anymore except spam-cancelling bots.

The only advice I'll give you is to go and read this:
<http://www.eyrie.org/~eagle/writing/rant.html>

-- 
Andrew.


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

Date: Mon, 26 Mar 2001 08:06:51 -0500
From: Mo <chaga@hotmail.com>
Subject: Re: Newbie help
Message-Id: <3ABF3EEB.25857D06@hotmail.com>

John,

Thank you!!  Much appreciate it.



"John W. Krahn" wrote:

> Mo wrote:
> >
> > Newbie Help.
> >
> > I am having trouble getting the second option right.....I can't figure
> > out what I am doing wrong ...help. Thankx
> >
> > #!/usr/bin/perl
>
> #!/usr/bin/perl -w
> use strict;
>
> > print "content-type:text/html\n\n";
> >
> > read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
> >
> > ($junk, $option) = split (/=/, $query_string);
>
> my ( undef, $option ) = split( /=/, $query_string );
> # or
> my $option = (split( /=/, $query_string )[ 1 ];
>
> > %capital = ("e", "E", "i", "I", "o", "O", "u", "U");
> >
> > @ARGV = ("ass3.txt");
> >
> > if ($option == 1)
> > {
> >  printf " Convert Vowels to Upper Case(except a)</b><br><br>";
>
>   print " Convert Vowels to Upper Case(except a)</b><br><br>";
>
> You don't need printf as you are not using format strings.
> From perlfunc:
>                Don't fall into the trap of using a printf() when
>                a simple print() would do.  The print() is more
>                efficient and less error prone.
>
> >  while (<>)
> >  {
> >   s/([eiou])/$capital{$1}/g;
>
> s/([eiou])/uc($1)/eg;
> # or
> tr/eiou/EIOU/;
>
> >   printf $_;
> >         printf "<br>";
>
>     print "$_<br>";
>
> >  }
> >
> > }
> >
> > #This is what I am having trouble with. How do I Reverse the order of
> > last two words of #each input line from the file ass3.txt(or any file
> > for that matter)?? Any help would br appreciated
> > elsif ($option == 2)
> > {
> >  printf "  Reverse the order of last two words of each input
> > line</b><br><br>";
>
> print "  Reverse the order of last two words of each input
> line</b><br><br>";
>
> >  while (<>)
> >  {
> >   chop;
>
>   chomp;
>
> >  @words = split;
>
> my @words = reverse split;
>
> if ( @words > 2 ) {
>     @words = ( reverse( splice( @words, 2, @words - 2 ) ), @words[ 0, 1
> ] );
>     }
>
> print "@words<br>";
>
> >
> > [snip code]
> >
> > }
>
> John
> --
> use Perl;
> program
> fulfillment



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

Date: Mon, 26 Mar 2001 12:14:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <chcubto4i5bk7m9fkiladffj0vi6e8llsi@4ax.com>

Andre Malo wrote:

>>> $|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
>>> for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
>>> $¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$?$?$?0.1}}print$/
>                                                  ^ ^ ^
>
>Your newsreader is broken, Abigails .sig doesn't contain any question
>marks. 

No, but Abigails original post contains some non-Ascii characters. They
are in ISO-Latin-1. As John Lin appears to be posting from Taiwan, I'm
not too suprised he can't see them as intended.

-- 
	Bart.


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

Date: 26 Mar 2001 12:42:00 GMT
From: ndparker@gmx.net (Andre Malo)
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <Xns9070958BBC9E7ndparker@news.o3media.de>

Bart Lateur wrote in <chcubto4i5bk7m9fkiladffj0vi6e8llsi@4ax.com>:

>No, but Abigails original post contains some non-Ascii characters. They
>are in ISO-Latin-1. As John Lin appears to be posting from Taiwan, I'm
>not too suprised he can't see them as intended.

I know, but Abigail's posting also contains correct encoding headers,
John's doesn't do.
But I'm more confused about the fact, that Outlook apparent shows *some*
of the non-ascii characters (like 1/4 [\274]) and hides the rest (e.g.
1/2 [\275]). 

Both are problems of the (broken;-) newsreader, IMHO.

(however, my perl sources strictly doesn't contain any non-ascii
characters...) 

(I hope, you'll understand my broken English ;-)

n.d.p.
-- 
s;.*;aaaaaoaaaoaaaaooooaaoaaaomaaaa:a:alataa:aaoat:a:a:a
maoaa:a:laoata:a:oia:a:o:a:m:a:o:alaoooat:aaool:aaoaa
matooololaaatoto:aaa:o:a:o:m;;s:\s:\::g;y;mailto:;
\40\51/\134\137|"n.d.p."<nd@o3media.de>;;print;


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

Date: Mon, 26 Mar 2001 05:23:46 -0600
From: "Rich" <bigrich318@yahoo.com>
Subject: Re: remove 'new line' from last element in array
Message-Id: <tbu9en82nurse5@corp.supernews.com>


"Tobias Ruehle" <tobias.ruehle@de.bosch.com> wrote in message
news:99muo0$cd6$1@proxy2.fe.internet.bosch.com...
> I read in a file line by line and then use the following command:
> @array = split(',', $_);
>
> ok, let's assume taht @array[2] is the last array element.
> My problem is that this last element contains a "\n" and i want to print
> this element into the middle of a line without a linefeed.
>
> Is there a way to remove that \n from the array element.

chomp it before you split it.

while (<FILE>) {
chomp; #same as chomp($_)
@array = split(',', $_); # \n has been removed
 ...etc...
}

perldoc perlfunc is your friend. It contains a list of the available
functions along with detailed (in most cases) descriptions and examples.




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

Date: 26 Mar 2001 03:52:36 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Replacing spaces in a url with %20
Message-Id: <m1puf4oigr.fsf@halfdome.holdit.com>

>>>>> "grimrob" == grimrob  <grimrob@ukrivals.net> writes:

grimrob> This is a really simple question I am sure, but I cannot for the life of me
grimrob> find the answer!

Spaces are not the only things that need encoding.  What you need is
the "URI" module, part of the LWP suite.  Found in any CPAN location.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 26 Mar 2001 12:31:28 GMT
From: "Nancy" <pigpen@easynews.com>
Subject: Sorry for not posting sample data and $delimit = ----. The following is @orders as printed to an output file at the line before the foreach statement.  Printed only for troubleshooting using:  Re: FOREACH little victory, I take a beating
Message-Id: <AEGv6.2595$am2.505128@news.easynews.com>

Sorry for not posting sample data, and $delimit = ----. The following is
@orders as printed to an output file at the line before the foreach
statement.  Printed only for troubleshooting using:

open (DATABASE, ">>order.txt");
print DATABASE "@orders\n";
close (DATABASE);

<contents of order.txt>
10----Base Printing Charges----Basic Printing Charges|Stock Size::8.5 X
11|Stock Color::White|Proof Option::PDF File|Artwork Supplied::PDF
File|Number of Sheets::10|Sides Printed::1|Stock Weight::20# Text|Job
Description::ADSas----0.1950----0.01----1----633----add_order----1----10
10----Cover Charges----Cover Charges|Cover Weight::65# Cover $ .08|Cover
Color::White|Sides
Printed::1----0.1000----.05----1----633----add_cover----1----10
10----Inserts----Inserts-Tabs|Inserts::3 $ .060|Sides Printed::1|Insert
Color::White|5 Bank
Tabs::None----0.0700----.02----1----633----add_insert----1----10
10----Finishing----Additional Finishing-Bindry Options|Additional Finishing
Options::None|Sides Printed::1|Primary Finishing Options::Single Portrait
Staple $ .030----0.0300--------1----633----add_finish----1----10

"Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote in message
news:slrn9btr7m.cpa.bernard.el-hagin@gdndev32.lido-tech...
> On Mon, 26 Mar 2001 05:12:13 GMT, Nancy <pigpen@easynews.com> wrote:
> >I have the following foreach statement that I can't beat into submission.
It
> >reads @orders just fine and prints each line of the output properly, but
I
> >also need to look at each line, and set a corresponding variable.  The
best
> >I can come up with only seems to be reading the last line of @orders to
set
> >the variables, but otherwise processes each line properly.  BTW, there
will
> >never be more than 4 lines in @orders.  What basic concept am I failing
to
> >grasp here?
> >
> >my ($i)=0;
> >foreach $line (@orders) {
> >   ($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
> >$plex, $originals) = split (/$delimit/, $line);
> >
> >         if ($item eq 'Cover Charges') {$msg_cov = 0;  } else {  $msg_cov
=
> >1;  }
> >         if ($item eq 'Inserts') {$msg_ins = 0;  } else {  $msg_ins =
;  }
> >         if ($item eq 'Finishing') {$msg_fin = 0;  } else {  $msg_fin =
> >;  }
> >                ++$i;
> >print " A lot of the data in a pretty format. \n";
>
> You didn't provide sample data which makes it very difficult for us to
> help. If you decide to post your question again with sample data
> included remember to also tell us what $delimit is.
>
> Cheers,
> Bernard
> --
> #requires 5.6.0
> perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$
?] }'




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

Date: 26 Mar 2001 11:54:22 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: String::Approx buggy ?
Message-Id: <985607334.18184@itz.pp.sci.fi>

In article <985603697.11132.0.nnrp-12.9e98901a@news.demon.co.uk>, Stephen Collyer wrote:
>
>print "match\n" if amatch('fred', [ 2, 'D2', 'I0', 'S0'], 'frooooooood');
>
>prints "match". As far as I can see there should be no amatch here,
>as I have limited the total number of edits to 2, and restricted them
>to deletions. I can't see how 'frooooooood' can amatch 'fred' with
>those restrictions, even if we allow any kind of edit - surely there
>is a greater edit distance than 2 between the two strings ?

I *think* that's not a bug, but simply counterintuitive behavior and
rather obscure documentation.  What happens is that amatch() tries to
find a *substring* of 'frooooooood' that is no more than two deletions
away from 'fred'.  One such such substring is 'fr'.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.



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

Date: Mon, 26 Mar 2001 13:32:19 +0100
From: "Stephen Collyer" <scollyer@netspinner.dont-spam.co.uk>
Subject: Re: String::Approx buggy ?
Message-Id: <985610051.29372.0.nnrp-08.9e98901a@news.demon.co.uk>


Ilmari Karonen <iltzu@sci.invalid> wrote in message
news:985607334.18184@itz.pp.sci.fi...
> In article <985603697.11132.0.nnrp-12.9e98901a@news.demon.co.uk>, Stephen
Collyer wrote:
> >
> >print "match\n" if amatch('fred', [ 2, 'D2', 'I0', 'S0'], 'frooooooood');
> >
> >prints "match".

> I *think* that's not a bug, but simply counterintuitive behavior and
> rather obscure documentation.  What happens is that amatch()
> tries to find a *substring* of 'frooooooood' that is no more than
> two deletions away from 'fred'.  One such such substring is 'fr'.

I think you're almost right - only almost because it seems that
amatch has to match multiple substrings to get a match here:

frooooooood
fr________d

It seems to me that amatch does the deletions first, then runs
some kind of LCS algorithm to match what's left. Unfortunately
I'm not familiar with the Wu-Manber alg, the docs are not very
helpful, and there's too much code for me to read :-(

I'll just have to play around till I'm happy I can match the things
I want and avoid the things I don't.

Steve Collyer
Netspinner Ltd




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

Date: Mon, 26 Mar 2001 14:28:19 +0100
From: Carl Lindsay <carllindsay1978@nospam.hotmail.com>
Subject: Sub String
Message-Id: <3ABF43F3.A615BFD4@nospam.hotmail.com>

hi,

I was hopping that someone could help me I want to extract a string from
another string is there a way to do this in perl

i.e. checkbox2(-flags)

I need to be able to have access to the -flags so the string in the
brackets I have tried:

 $name[$i]=~ s/(\w+)/<$1>/;
 $name[$i]=~ s/\(/ /;
 $name[$i]=~ s/\)/ /;

which works put does not allow me to compare the result to another
string, even though both strings are the same there must be an easy
solution to this.  I could use substr() but then how do I count the
chars in the brackets?

Please help,





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

Date: Mon, 26 Mar 2001 14:44:46 +0100
From: Carl Lindsay <carllindsay1978@nospam.hotmail.com>
Subject: Sub string
Message-Id: <3ABF47CE.E87382F7@nospam.hotmail.com>


hi,

I was hopping that someone could help me I want to extract a string from

another string is there a way to do this in perl

i.e. checkbox2(-flags)

I need to be able to have access to the -flags so the string in the
brackets I have tried:

 $name[$i]=~ s/(\w+)/<$1>/;
 $name[$i]=~ s/\(/ /;
 $name[$i]=~ s/\)/ /;

which works put does not allow me to compare the result to another
string, even though both strings are the same there must be an easy
solution to this.  I could use substr() but then how do I count the
chars in the brackets?

Please help,






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

Date: Mon, 26 Mar 2001 15:34:23 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: Re: system() return value
Message-Id: <3ABF455F.C6D94188@icn.siemens.de>

kellyboy wrote:
> if (system(something)) {
>     im here cuz system return error
>     }
>     else {
>     im here cuz system return 0 which mean success
> }
> 

Yes, that's correct; but I don't see what your question is actually.

Ronald
-- 
Ronald Otto Valentin Fischer <rovf@earthling.net>
[now at: Siemens ICM N MR UR DE 6, phone: +49(Germany)+89-722-23368]
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html


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

Date: Mon, 26 Mar 2001 14:25:49 +0200
From: "Erik Bachmann" <e_bachmann@hotmail.com>
Subject: Re: Writing a script to install Perl modules automatically
Message-Id: <kzGv6.172$US2.17811@news.get2net.dk>

Have you read:
http://world.std.com/~swmcd/steven/perl/module_mechanics.html ??

:-) Erik Bachmann

"Makhno" <imak@imakhno.freeserve.co.uk> wrote in message
news:99icj9$tvi$1@news6.svr.pol.co.uk...
> Hi, I'm writing a bash script to install a large set of Perl modules
> automatically, and the trouble is that the Makefile.PL and all the other
> stuff that's needed to install them are at different levels, eg:
> I might have one module called MyModule
> and another called MyModule::Somefink::Else
> and yet another called MyModule::YetMore
>
> My problem is that the hierarchical package names translate into
directories
> like eg:
>
> MyModule
> MyModule/Somefink/Else
> MyModule/YetMore
>
> with the Makefile.PL at the end of this chain. Is there a 'nice' way of
> installing the modules separately with a script without
>
> a) Combining all the modules into one big module (not an option)
> b) Making my bash script search around the hierarchy for the Makefile.PL
>
> (eg: is there a way to get Perl to do the hard work?)
> Thank you.
>
>
>
>




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

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


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