[13538] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 948 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 02:07:23 1999

Date: Wed, 29 Sep 1999 23:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938671510-v9-i948@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 29 Sep 1999     Volume: 9 Number: 948

Today's topics:
        Help on finding duplicate lines in two files tvn007@my-deja.com
        HELP! Clueless know-nothing asks a question <jre@idirect.com>
    Re: HELP! Clueless know-nothing asks a question <jeff@vpservices.com>
        How can I tell if something is already installed <rhys@ottawa.com>
    Re: hyperlink submits (Abigail)
    Re: Matching problem with brackets <rick.delaney@home.com>
    Re: newbie file transfer question <makkulka@cisco.com>
        Perl AI Apps/Expert Systems <mkabat@ibm.net>
    Re: Perl IDE for X <fromero@csudh.edu>
    Re: perl routine to emulate "find . -ls" command?? (Randal L. Schwartz)
    Re: perlcc? vishalb@my-deja.com
    Re: Reading from STDIN (Charles DeRykus)
    Re: RedHat Linux 6.0 and Perl 5.005_03 (David Efflandt)
    Re: Reliable UK ISP with Perl <news@elmbronze.demon.co.uk>
    Re: Sorting weird numeric data <bwalton@rochester.rr.com>
    Re: Sorting weird numeric data (Abigail)
    Re: Split() on vertical bar | <admin@gatewaysolutions.net>
        Substitutions <ldb@gbr.msd.ray.com>
        testing <mikael.eriksson@utfors.se>
        using CPAN to upgrade perl version (Danny Aldham)
    Re: Using multiple query strings <v0xman@yahoo.com>
    Re: Win32::ODBC and Binary Data. <sjohns17@uic.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Sep 1999 05:54:39 GMT
From: tvn007@my-deja.com
Subject: Help on finding duplicate lines in two files
Message-Id: <7sutur$cht$1@nnrp1.deja.com>

Hello,

Would someone help me with the following  problem ?

Compare each line  on each file, if the line is the same on
each file then put ; in front of that line.
Below is the example:

I have two files:

file: "startadr.txt" has the following lines:
linexxxx
line1
line2

file: "remove_list.txt" has the follwing lines:

line1
line2

I would like to have the output as follow:

linexxx
;line1
;line2

Below is what I have on my script. HOwever the result is not what I
want:

linexxx
;line1
line2
linexxx
line1
;line2
linexxx
line1
line2
##############################################
#!/usr/local/bin/perl5

$remove_list = "remove_list.txt";
$start = "startadr.txt";

open (REMOVE_LIST,$remove_list) || die "cannot open $remove_list\n";
open (START,"$start") || die "cannot open $start\n";

@remove = <REMOVE_LIST>;
foreach $remove (@remove) {
	chomp $remove;
	seek(START,0,0);
	$line = <START>;
	while ($line ne ""){
	chomp $line;
	if ($remove eq $line){
	$comment_out = ";" ;
	$comment_out .= $line ;
	print "$comment_out\n";
	$line = <START>;
	 }
	else {
	print "$line\n";
	$line = <START>;
	 }
	}

}




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


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

Date: Thu, 30 Sep 1999 03:53:50 GMT
From: "James E." <jre@idirect.com>
Subject: HELP! Clueless know-nothing asks a question
Message-Id: <i9BI3.16108$fp1.182268@quark.idirect.com>

Dear CGI gods and/or goddessess -

I'm trying to get info from a file (wwwboard.out) to an HTML file
(index.html).  In the index.html, I have <!--#exec cgi="getforum.pl"-->, and
the file I'm executing is below:

#!/usr/local/bin/perl

open(FORUM,"wwwboard.out");
print "Content-type: text/html\n\n";
while(<FORUM>) {
  print "$_";
}

close FORUM;


=====
When I open the index.html file, there's nothing!  wwwboard.out has
something in it, so it should load.  The server supports SSI, and everything
is CHMOD'd properly.  So my question - what's wrong!?

Please email me, as this isn't one of my usual usenet haunts.  :)

Thanks,
--James E.
jre@idirect.com



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

Date: 30 Sep 1999 04:33:59 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: HELP! Clueless know-nothing asks a question
Message-Id: <37F2E66C.79AE6D1C@vpservices.com>

"James E." wrote:
> 
> Dear CGI gods and/or goddessess -

They can be prayed to in other newsgroups, only Perl dieties reside here
and I ain't one of them. 

> open(FORUM,"wwwboard.out");
> print "Content-type: text/html\n\n";
> while(<FORUM>) {
>   print "$_";
> }
> When I open the index.html file, there's nothing!  

You opened a file to read from, but not one to write to.  You need a
line like:

	open(OUTFILE,">index.html") or die "$! index.html";

Then read the manual on print.  By default print writes to the screen,
not to a file.  So change this line:

	print "$_";

to:

	print OUTFILE "$_";

which is better written as:

	print OUTFILE $_;

which is better written as:

	print OUTFILE;

> Please email me, as this isn't one of my usual usenet haunts.  :)

Well I will this time, but if you ever post in this newsgroup again,
please plan to read the answer in this newsgroup.  Because what happens
if I email you this answer and it turns out I am a complete idiot and
somebody in the group corrects me tommorrow?  They're called groups for
a reason - so the group mind can answer questions, not hapless fools
like me.

-- 
Jeff


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

Date: Thu, 30 Sep 1999 05:31:39 GMT
From: "Rhys Ronald Boswarva" <rhys@ottawa.com>
Subject: How can I tell if something is already installed
Message-Id: <%ACI3.1535$zM1.813622@news1.rdc1.on.wave.home.com>

How can I tell if something is already installed on RedHat Linux.  i.e.
mod_perl

I know Apache is installed. And I also know PERL 5.004_04 is installed

please help


--
Have Fun

Rhys Ronald Boswarva
rhys@ottawa.com
http://www.boswarva.com
-----------------------------------------------------------
    GO DOLPHINS GO!!




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

Date: 30 Sep 1999 00:28:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: hyperlink submits
Message-Id: <slrn7v5to8.6o.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCCXX September MCMXCIII in
<URL:news:MPG.125bf35a74f7dadf98a000@nntp.hpl.hp.com>:
?? In article <Pine.HPP.3.95a.990929190112.16629N-100000@hpplus01.cern.ch> 
?? on Wed, 29 Sep 1999 19:05:06 +0200, Alan J. Flavell 
?? <flavell@mail.cern.ch> says...
?? > On Wed, 29 Sep 1999, Michael Frost jeopardized the group with:
?? > > The syntax is: <A
?? > > HREF="http://your.domain/<path>/filename.cgi?parameter1=value1&parameter2=
?? > 
?? > Invalid HTML syntax.  You need to represent ampersand as &amp; in this
?? > kind of HTML attribute value. 
?? 
?? Totally wrong (as well as totally off-topic).

Uhm, no. Attribute values are to be parsed for entities. 


Followups set.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 30 Sep 1999 02:10:51 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Matching problem with brackets
Message-Id: <37F2C69F.40359190@home.com>

[posted & mailed]

Anno Siegel wrote:
> 
> Jim Drummey  <jpd@drum.terranet.com> wrote in comp.lang.perl.misc:
> >
> >I've tried several combos including:
> >if ( /^\[$sharename/ )   doesn't work
 ...
> >if ( $_ =~ $sharename && /^\[/ )  each of these conditions works by
> >                                  itself, but not when separated by
> >                                  the && operator

Nonsense.

> >If I leave one condition out, the statement works. I need to test
> >both conditions, that is 1) square brackets begin line and 2) followed
> >by $sharename.
> 
> Well, that's not how you combine regular expressions, not in Perl
> anyway.  Intuition is useful, but must be backed up by hard facts,
> preferably from a manual.  In particular, intuition may be misleading
> when it comes to precedence of operators.  Try
> 
>    m/^\[/ && m/$sharename/

Except for the good advice on RTFMing and style, I don't understand what
you mean here.  Are you saying that there is a precedence problem in 

    $_ =~ $sharename && /^\[/

or maybe that the $_ =~ $sharename syntax is no good?  Neither of these
is true so perhaps you mean something else?
 
> Note that $_ is the default search space, so $_ =~ ... is never
> necessary.

Except when matching against a pattern that isn't delimited, as above.

My only suggestion for Jim is 

    perldoc -f quotemeta

since

    /^\[$sharename/

and

    /$sharename/ && /^\[/

can behave quite differently if $sharename =~ /]/.  Of course, that
wouldn't fix the the problem as described so I might as well suggest
rebooting.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 29 Sep 1999 18:10:17 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: newbie file transfer question
Message-Id: <37F2B879.54DAD5BE@cisco.com>

[ bruce wrote:

> How get the files from the random website to my
> server so I can get copies of the text files? Do I need to use CGI.pm or
> something like this to make this happen?

(1)If these files that you wish to download are under the document root
of the webservers and accessible using URLs then you could
make a series of GET calls using LWP::UserAgent to get
these files and translate to HTML.
Refer to perldoc LWP::UserAgent and perldoc HTTP::Request::Common
to find more info on making such calls.

(2) Else you may have to resort to a FTP get/put solution.

(3) Lastly, users on remote servers could even upload these
files onto your machine. A cron job could fire your translation scripts
whenever a new data file arrives.
--



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

Date: Wed, 29 Sep 1999 21:42:01 -0400
From: "none" <mkabat@ibm.net>
Subject: Perl AI Apps/Expert Systems
Message-Id: <37f2c2ca_3@news3.prserv.net>

Does anyone know if there are any Perl developed AI Apps out there, Expert
systems, etc?




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

Date: Wed, 29 Sep 1999 18:55:14 -0700
From: Francisco Romero <fromero@csudh.edu>
Subject: Re: Perl IDE for X
Message-Id: <37F2C2FF.C7B72BA3@csudh.edu>

I rather use pico, it's easier.  I just want somthing that will make my life
easier in hacking Perl.

Kent Perrier wrote:

> Francisco Romero <fromero@csudh.edu> writes:
>
> > Does anyone know if there is an Integrated Developmental Enviornment for
> > perl?
>
> Sure.  have two xterms open.  In one, have a vi session going with your
> code in it.  in the other, run your script.
>
> >
> > Is there anything to help me write Perl code in X ?
> >
>
> Xterm's (or Eterms or gnome-terminals, etc) are of tremendous
> help.
>
> Kent
> --
> work hard, save aggressively, invest well and get the hell out



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

Date: 29 Sep 1999 18:17:02 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perl routine to emulate "find . -ls" command??
Message-Id: <m11zbh19m9.fsf@halfdome.holdit.com>

>>>>> "dennis" == dennis  <dennis.moreno@pop.safetran.com> writes:

dennis> Does anyone know of a simple routine to emulate find . -ls?

Besides the output of "find2perl . -ls" ?

Not offhand. :)

print "Just another Perl hacker,"

-- 
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: Thu, 30 Sep 1999 00:59:13 GMT
From: vishalb@my-deja.com
To: grega.bremec@siol.net
Subject: Re: perlcc?
Message-Id: <7suckq$ka$1@nnrp1.deja.com>

In article <37F0CAEC.D7DF8C30@gbsoft.net>,
  grega.bremec@siol.net wrote:
> Hello all,
>
> I've had terrible problems with perlcc, and as far as I've RTFM,
nothing
> even remotely covers the programming style for modules and scripts
which
> are intended for further compilation into binary form. I've heard that
> autoload is forbidden, I've read that perlcc doesn't handle empty
> modules well (as in A::B where A has no methods), same with threading
> but that's pretty much it.

Autoload is not forbidden any more, but you lose the advantage of
compilation on autoloaded subs.perlcc does handle empty modules
correctly.Threading hasnot been tried at all.

>
> I've tried compiling using a threading perl 5.005.2 - 5.005.61, but
> perlcc seems to be broken everywhere. Note that I don't use threads
> however, because I'm trying to compile a CGI application and I've no
use
> for threads there.

_61 is quite Ok  with perlcc. Please do not try 5.005_2/_3 since
they are very old with respect to the compiler.

Have you managed to compile simple scripts?
perlcc is meant for module compilation but most work has been
concentrated on compiling scripts, not modules. There are a few
unresolved issues with Module compilation, so it is not advisable
to try it just now. Since your aim seems to be CGI, i am happy to
inform you that CGI  does work well with the compiler.

>
> ./Some/Mod.pm.c:xxx: parse error before `.'
>     ^-- This seems to be bad syntax for a call of the XS
>         macro - containing an unquoted pathname.
>
> ./Some/Mod.pm.c:xxx+2: `thr' undeclared here (not in a function)
> ./Some/Mod.pm.c:xxx+2: register name not specified for `sp'
> ./Some/Mod.pm.c:xxx+2: initializer element is not constant
> ./Some/Mod.pm.c:xxx+2: register name not specified for `mark'
>     ^-- These all seem to be a part of a macro called dXSARGS.
>
> ./Some/Mod.pm.c:xxx+4: conflicting types for `Perl_push_scope'
> /perl/lib/CORE/etc/proto.h:xxx: previous declaration of
> `Perl_push_scope'
>     ^-- This is a part of a macro called ENTER.

Even though you are not using threads in you application, your
perl header files are meant for threaded perl and since
you compiled executable uses the  threaded libperl, i am not
surprised that this happens. I would not recommend using a threaded
perl. Threads themselves are a new feature like the compiler,
compiler support for them is some way off. Anyway you would
be taking a needless performance hit using a threaded libperl over
non threaded perl on non threaded applications even if they do work,
so it is not recommended.

>
> I'm not quite sure whether or not this subject had already been
covered,
> because I'm quite new to comp.lang.perl.* -- if it has, my apologies -
> please direct me. I've tried some subject searches in this newsgroup
> though, but I found nothing. I've also been searching all around for
> some kind of a perlcc user's guide, nothing again. Is perlcc a tool
that
> can be considered stable under certain circumstances?

Not until perl5.006 comes out, when it will be hopefully, usable.
Some documentation has been added in latest development release.

cheers,
Vishal



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


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

Date: Thu, 30 Sep 1999 01:46:03 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Reading from STDIN
Message-Id: <FIunKr.AzG@news.boeing.com>

In article <37F2737B.D61515EB@NortelNetworks.com>,
Kyle Brost  <anstud01@NortelNetworks.com> wrote:
>Hello,
>
>I am having troubles with reading from STDIN without blocking.
>Everytime that I read all the data, perl sits at the read statement and
>waits for more data.  I would like to trap the situation where there is
>no data and then continue in my code.  I know that I can use <STDIN>,
>but the data I am using won't have newlines.  (Example code attached
>below)
>
>#!/usr/bin/perl
>use strict;
>
> my $line;
> while(read(STDIN,$line,10,0)>0)  {
>  print "READ:($line)";
>}

use POSIX qw(:errno_h :fcntl_h);
my $flags = 0;
fcntl(STDIN, F_GETFL, $flags)
   or die "can't get STDIN flags\n";
$flags |= O_NONBLOCK;
fcntl(STDIN, F_SETFL, $flags)
   or die "can't set STDIN flags\n";
#  { 
#     your sysread loop
#  }
if  ( !defined($rv) && $! && $! != EAGAIN ) {
   warn "sysread error: $!\n":
}



hth,
--
Charles DeRykus




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

Date: 30 Sep 1999 03:08:21 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: RedHat Linux 6.0 and Perl 5.005_03
Message-Id: <slrn7v5l1l.9j.efflandt@efflandt.xnet.com>

On Wed, 29 Sep 1999 09:40:04 -0400, news.way.com <mccomb@clubplanet.com> wrote:
>I have some very wierd behavior with some Perl scripts under a new Linux
>install.
>
>Basically,  if the script starts with
>
>#!/usr/bin/perl
>
>when I execute the script I get a "command not found" error message.  If the
>script starts with:
>
>!#/usr/bin/perl -w
>
>the script runs as expected.  Any ideas?

The classic edited in Windows Notepad syndrome.  Actually bash is trying
to tell you that it cannot find "perl^M", but ^M is one of those nasty
carriage returns that goes back to the beginning of the line, so you don't 
see the whole error.  In the latter case (assuming shebang is corrected)
it can find /usr/bin/perl because the ^M comes after the -w and perl has
no problem with carriage returns.

If you don't know how to use vi or emacs, install 'pine' and use 'pico'
for editing.  'pico' can also get rid of those carriage returns if you
load the file, space, backspace and save the file.

>Also, trying to execute a chmod command from within a CGI script does not
>seem to do anything, but when run from a shell it executes correctly.

The webserver runs as 'nobody' (unless configured for suexec) so CGI can
only do what 'nobody' (others) can do.

-- 
David Efflandt  efflandt@xnet.com  http://www.xnet.com/~efflandt/
http://www.de-srv.com  http://cgi-help.virutalave.net/
http://thunder.prohosting.com/~cv-elgin/


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

Date: Thu, 30 Sep 1999 02:09:47 +0100
From: Dave Eastabrook <news@elmbronze.demon.co.uk>
Subject: Re: Reliable UK ISP with Perl
Message-Id: <0TpWGOAbhr83EwSN@elmbronze.demon.co.uk>

on Tue, 28 Sep 1999 Jerry Pank <jerryp.usenet@connected.demon.co.uk>
wrote
>Recommendations wanted for reliable UK/European ISP running Perl.
>
>Our Web Hosters are Demon Internet but we are currently having terrible
>reliability/resource problems with their CGI server.
>I know there are plenty of other sources for this info but I would
>really rather not do one this by trial and error.

My commercial pages are with Global, but I may be moving them.  If any
one emails you any interesting stuff, please pass it on!  By the way,
apart from the "we're investigating" Global still haven't replied to my
warning to them that they're using an old Matt CRAP FormMail script :(

:Dave         [less than 100 days until 19100]
-- 
Dave Eastabrook;  still telling you to "GET your Y2k mess SORTED"!
Did you know there was a problem with Perl and JavaScript?   Well,
http://www.elmbronze.co.uk/year2000/perlprob.htm is a tiny taster.
(This page needs updating now, please return in a week or three!)


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

Date: Thu, 30 Sep 1999 00:01:24 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Sorting weird numeric data
Message-Id: <37F2E093.6F7243B9@rochester.rr.com>

Larry Rosler wrote:
 ...
> > Oh? Your sorting algorithm beats O (N log N)?

The following program will sort the input we are discussing 
(items of the form 1.2.3.4) in O(N).  Why is it folks consider 
the best sort that can be done to require O(N logN) operations? 

@in=<>;
$i=0;$l=0;$b=0;
for(@in){ #determine maximum fields, bins
	@{$d[$i++]}=split /\./,$_;
	$l=$l<@{$d[$i-1]}?@{$d[$i-1]}:$l; #max fields
	for(@{$d[$i-1]}){$b=$b<$_?$_:$b} #max bins
}
for($i=$l-1;$i>=0;$i--){ #go through each field, last first
	$j=0;
	for(@in){ #parse input into integers
		@{$d[$j++]}=split /\./,$_;
	}
	@stacks=();
	for(0..$#d){ #put input into bins
		#this could also be done with indexing if push
		#increases things to O(N^2)
		push @{$stacks[$d[$_][$i]]},$in[$_];
	}
	$k=0;
	for(0..$b){ #collect input from bins
		#could have pushed shift and push, but there
		#might have been an argument shift increased
		#order to O(N^2)
		$kk=0;
		$count=@{$stacks[$_]};
		while($kk<$count){$in[$k++]=$stacks[$_][$kk++]}
	}
}
print for(@in);

> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
-- 
Bob Walton


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

Date: 30 Sep 1999 00:20:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Sorting weird numeric data
Message-Id: <slrn7v5t87.6o.abigail@alexandra.delanet.com>

Bob Walton (bwalton@rochester.rr.com) wrote on MMCCXXI September MCMXCIII
in <URL:news:37F2E093.6F7243B9@rochester.rr.com>:
// Larry Rosler wrote:
// ...
// > > Oh? Your sorting algorithm beats O (N log N)?
// 
// The following program will sort the input we are discussing 
// (items of the form 1.2.3.4) in O(N).  Why is it folks consider 
// the best sort that can be done to require O(N logN) operations? 

Not so fast. Your algorithm seems to be Omega (U + S * N), where U and S
are dependent on the data. If I give you the list

    map {$_ * $_ * $_} 1 .. $N

to sort, your algorithm takes Omega (N^3).

Another fun list to sort is:

   1 x $N, 1 . ".0" x $N

which takes Omega (N^2).

[ Adaption of counting sort snipped ]


Counting sort only beats O (N log N) by making extra assumptions.
Assumptions we were not making here.

And yes, I know everything about Perl being limited to 32 bits.
Let's not go that way.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 29 Sep 1999 21:15:05 -0500
From: "Scott Beck" <admin@gatewaysolutions.net>
Subject: Re: Split() on vertical bar |
Message-Id: <rv5hnpng3i551@corp.supernews.com>


Bill Feduska <feduskabm@msx.upmc.edu> wrote in message
news:37F2638B.A9826D7A@msx.upmc.edu...
> Any ideas on how to split() a line on a vertical bar (hash mark) | ?
> Thanks.
>
($name,$pass)= split (/\|/, $file);




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

Date: Wed, 29 Sep 1999 16:29:56 -0400
From: Laurel Benn {73247} <ldb@gbr.msd.ray.com>
Subject: Substitutions
Message-Id: <37F276C4.FCF0FA83@gbr.msd.ray.com>

Hope someone can help me with this problem.  I have code written the
following way:

type sometype
--% This is the description for some type
--%  this description has more than one line

some_constant: constant:integer;
--% This is the description for this constant

with  procedures and functions defined similarly with descriptions below
declarations.  I am trying
to switch the positions of the comments with declarations , so that all
comments precede the respective
declaration. e.g.

--% This is the description for some type
--%  this description has more than one line
type sometype

Is there an easy way to do this in perl?  I've tried the following but
it doesn't work exactly the way I want it to.

$/ = "";
$* = 1;
while(<>){
if (/(--%\s+\S+)/) {
print "\t$1 $' $`\n\n";
}else {
print ;
}
}

L.B.





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

Date: Thu, 30 Sep 1999 03:08:17 +0200
From: Mikael Eriksson <mikael.eriksson@utfors.se>
Subject: testing
Message-Id: <37F2B801.113D02FD@utfors.se>


--------------C9A4F1EB2523B1A8C539AD97
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit





--------------C9A4F1EB2523B1A8C539AD97
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
&nbsp;
<pre></pre>
&nbsp;</html>

--------------C9A4F1EB2523B1A8C539AD97--



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

Date: 30 Sep 1999 03:20:37 GMT
From: danny@hendrix.postino.com (Danny Aldham)
Subject: using CPAN to upgrade perl version
Message-Id: <7suku5$eum$1@hendrix.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

I am not sure I would want to, but is it possible to use the CPAN module
to actually upgrade the version of perl running?

--
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Mail Lists, Web Databases, SQL & Perl


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

Date: Wed, 29 Sep 1999 22:23:21 -0300
From: "Vox" <v0xman@yahoo.com>
Subject: Re: Using multiple query strings
Message-Id: <EXyI3.5566$xJ4.272031@newscontent-01.sprint.ca>

I've also been programming cgi with perl for about a couple of months now
with no book but the tutorials on the net and pieces of other code put
together.  I had this same problem not too long ago.

you don't need 'read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});' for query
strings.  Also $buffer = "$buffer\&$ENV{'QUERY_STRING'}";  really is
unnessary

All the info it needs is in  $ENV{'QUERY_STRING'} .

This is the code I use that works fine for multiple variables in a query
string.  Try this out....

sub parse_form {

if ($ENV{'QUERY_STRING'})  {
        # Split the name-value pairs
        @pairs = split(/&/, $ENV{'QUERY_STRING'});
}

foreach $pair (@pairs)
  {
  ($name,$value) = split(/=/,$pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
  $FORM{$name} = $value;
 }

}

and you don't need the '&' on the first variable 'script.cgi?&value1=' in
your URL

change
www.whatever.com/cgi-bin/script.cgi?&value1=something&value2=somethingelse

to
www.whatever.com/cgi-bin/script.cgi?value1=something&value2=somethingelse

now it should work.





Donboy <webmaster@roleplayinggames.net> wrote in message
news:k6xI3.1099$CL1.9275772@news-read1.qis.net...
I've been writing my own scripts for a little while now, but up to this
point, I've been using forms to input all the variables.  Now, I'm trying to
work with inserting the variables using query strings.  However, the only
way I'm able to do this is using a single query string like so....

www.whatever.com/cgi-bin/script.cgi?value

But now I'm getting to the point where a single variable inserted into the
script just isn't enough.  I'd like to use more than one query string in the
same line...

www.whatever.com/cgi-bin/script.cgi?&value1=something&value2=somethingelse

So how can I do this??  I've tried using a line similar to what I just
showed above, but the script won't recognize those values.  It's like I'm
not even defining those variables at all.

Now I've seen a script that uses them successfully and I thought I could
just clone it and it would work fine.  It looked as if the variables were
getting sorted out properly with a "parse form" subroutine like so....

sub parse_form {
 read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
 if ($ENV{'QUERY_STRING'})  { $buffer = "$buffer\&$ENV{'QUERY_STRING'}"; }
 @pairs = split(/&/,$buffer);
 foreach $pair (@pairs)
  {($name,$value) = split(/=/,$pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
  $FORM{$name} = $value;
 }
}

But it ain't quite working out!  So what's going wrong here?  Am I missing
something?  What tells the script to accept more than one query string from
the same line?

BTW, I bought the "Perl Cookbook" and it's pretty nice, but it assumes that
you already know your stuff to some degree.   I think I'm going to have to
try something simpler and work my way up to using the 'Cookbook' to solve my
problems!








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

Date: Wed, 29 Sep 1999 23:00:44 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: Win32::ODBC and Binary Data.
Message-Id: <Pine.A41.4.10.9909292258200.74868-100000@tigger.cc.uic.edu>

On Wed, 29 Sep 1999, Kangas wrote:

> I can put binary data into an access database directly but how do I do
> it through Win32::ODBC?

You take a scalar containing binary data and do an "INSERT." I'm afraid
this question doesn't make any sense, unless of course you know neither
perl nor anything about SQL, in which case you should be R'ingTFM.

-Seth



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

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


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