[11665] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5265 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 31 04:04:04 1999

Date: Wed, 31 Mar 99 01:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 31 Mar 1999     Volume: 8 Number: 5265

Today's topics:
    Re: "Taint-free" relative paths (Ronald J Kimball)
    Re: Blank browser window (Ronald J Kimball)
    Re: Call an external program (Ronald J Kimball)
    Re: Converting Hex to ASCII <Philip.Newton@datenrevision.de>
    Re: File isn't locked, but Perl says it is? (Ronald J Kimball)
    Re: foreach loop works, for loop not (Ronald J Kimball)
        Getting owner of WindowsNT files <REINER_FISCHER@Non-HP-Germany-om4.om.hp.com>
    Re: Getting parent process's environment variable to ch <Philip.Newton@datenrevision.de>
        hashes <Ketil@dnb-data.dnb.no>
    Re: hashes <ebohlman@netcom.com>
    Re: hashes <clint@drtech.co.uk>
        How do i use the mod function in perl? agniora@usa.net
        Inserting Formfeed in report <joj@invalid.doms.dk>
    Re: LWP..to use or not? (I R A Aggie)
    Re: LWP..to use or not? <gisle@aas.no>
        Need for script which looks file and replaces HTML tags <tjp@cs.tut.fi>
        Newbie questions... <pt98hwi@student.hk-r.se>
    Re: Protecting Scripts from Privacy (Ronald J Kimball)
        random elements from an array <tgj@snip..net>
    Re: random elements from an array (Larry Rosler)
        removing ghost from variable <wanga@exterminator.net>
        script with arguments in SSI <wanga@exterminator.net>
    Re: strange ERROR mssg (Ronald J Kimball)
    Re: Tricky regex Problem (Ronald J Kimball)
        Typeglobbing functions in main <dwc3q@mamba.cs.Virginia.EDU>
    Re: Typeglobbing functions in main <uri@home.sysarch.com>
    Re: XML-Parser: dealing with predefined entities <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 31 Mar 1999 00:28:23 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: "Taint-free" relative paths
Message-Id: <1dpi2y5.f9t36f1e16bamN@p107.tc2.state.ma.tiac.com>

Dale Henderson <dhenders@cpsgroup.com> wrote:

> So, is there a safer way to derive the $prefix varialble. If not, is
> there a way to turn of taint checking in this instance only.

The perlsec documentation demonstrates how to untaint a variable, under
'Laundering and Detecting Tainted Data'.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 31 Mar 1999 00:28:24 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Blank browser window
Message-Id: <1dpi3kv.14zq5rb1gcdry8N@p107.tc2.state.ma.tiac.com>

Rob Annandale <rob_aNO@SPAMunipharm.com> wrote:

> #!/usr/local/bin/perl -w
> $ENV{A_TERM} = 'vt100';
> @args = ("runcbl", "-f", "thankyou.acu");
> print "Content-type: text/html\n\n";
> system(@args);
> 
> I receive a blank screen in my IE browser window when
> 'thankyou.acu' is supposed to be executed.

I don't suppose you checked the error logs to make sure your system
command is actually executing successfully?


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 31 Mar 1999 00:28:25 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Call an external program
Message-Id: <1dpi3ma.7xc96vod0966N@p107.tc2.state.ma.tiac.com>

<kiekko@my-dejanews.com> wrote:

> How would I call an external program from within a perl program.  Everything I
> try doesn't work and it ends with a "Useless use of string in void context
> at ./textconv line 11."

Perhaps you're using 'single quotes' instead of `back quotes`?
The back quote key is probably located above the tab key on the left
side of your keyboard.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: Wed, 31 Mar 1999 10:41:41 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Converting Hex to ASCII
Message-Id: <3701DFC5.6713CF85@datenrevision.de>

AdmFrodos wrote:
> 
> I would like to write a little function that converts a buffer filled
> with 32-bit hexadecimal numbers to their ASCII character equivalents,
> for use as a hex type editor function and with tcpdump. I don't know
> how to get 7-bits of character data from the numbers, and I am a bit
> confused on how ASCII type codes are stored.

Do you want to turn e.g. 0xDEADBEEF into 'D' 'E' 'A' 'D' 'B' 'E' 'E'
'F'? Or into the character with the ASCII code 0xDEADBEEF (which doesn't
exist)? Or what?

Cheers,
Philip


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

Date: Wed, 31 Mar 1999 00:28:26 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: File isn't locked, but Perl says it is?
Message-Id: <1dpi4l8.1tyt8lmz7479oN@p107.tc2.state.ma.tiac.com>

<sstarre@my-dejanews.com> wrote:

Okay, missed with my first guess.  Here's number two...


>  sysopen(F,$MEM,O_RDWR) || pmessage::SayError("file", "old member file $!");
>  sysopen(T,$T,O_RDWR|O_CREAT|O_TRUNC)
>   || pmessage::SayError("file", "new member file $!");
> 
>  lockF(0);
>  lockT(0);


You appear to be truncating the T file before you have a lock on it.
You should open the file without truncating, lock it, and then use
truncate().


-- 
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
      perl -e'for(sort keys%main::){print if $$_ eq 1}
            ' -s  -- -' Just' -' another ' -'Perl ' -'hacker 
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]


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

Date: Wed, 31 Mar 1999 00:28:27 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: foreach loop works, for loop not
Message-Id: <1dpi4ve.1o8sv67vz55dvN@p107.tc2.state.ma.tiac.com>

Tad McClellan <tadmc@metronet.com> wrote:

> Bill Mooney (wmooney@voicenet.com) wrote:

> : Could it be that your closing your for loop for a paren instead of a
> : bracket?
> 
> 
>    Please don't post random guesses.
> 
>    Seems readily apparent from David's words above that the
>    program is executing.
> 
>    You cannot get to "executing" when you have syntax errors,
>    so whatever David's problem is, it is most certainly not
>    due to a syntax error.
> 
>    It is just not possible.

Hey, it's not Bill's fault that David's post had an obvious syntax
error, is it?  I think it was very astute of Bill out a problem that you
presumably didn't even notice.

Clearly, that wasn't even David's real code that we were being asked to
debug.  Don't take it out on Bill.

-- 
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
      perl -e'for(sort keys%main::){print if $$_ eq 1}
            ' -s  -- -' Just' -' another ' -'Perl ' -'hacker 
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]


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

Date: Wed, 31 Mar 1999 07:57:14 +0200
From: Reiner Fischer <REINER_FISCHER@Non-HP-Germany-om4.om.hp.com>
Subject: Getting owner of WindowsNT files
Message-Id: <3701B93A.910C61ED@Non-HP-Germany-om4.om.hp.com>

Hello,

i have a problem. In WindowsNT, every file has an owner, for example
shown in the file properties.

Is there a module in Perl, which help me getting the ownername? I tried
stat() and File, but i found no
possibility.

Bye,

--
Reiner Fischer

--
Reiner Fischer

Advanced Technology Services Team
Application Services Europe
Hewlett Packard GmbH

Hanns-Klemm-Str. 5
71034 Bvblingen

Phone: +49 7031 626-1333, Telnet 702-1333
Fax:   +49 7031 626-1134
E-mail: REINER_FISCHER@Non-HP-Germany-om4.om.hp.com




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

Date: Wed, 31 Mar 1999 10:34:45 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Getting parent process's environment variable to change when running a perl script
Message-Id: <3701DE25.71313E25@datenrevision.de>

Don Roby wrote:
> 
> While certainly true, this isn't a real helpful answer to someone who
> wants to fake it in NT.  (I couldn't find the Unix answer in the
> comp.unix.questions FAQ for that matter, though I assume it's hiding
> there somewhere.)  Is there an appropriate NT FAQ to reference?  Is
> similar fakery even possible in NT?

I once saw some code that did outrageous things to modify its parent's
environment under MS-DOS (chaining up PSP's and following strange
pointers, or maybe starting at the address contained in an interrupt
vector, or something). Probably wouldn't work under NT's memory
protection and even if it did, I don't remember where I saw it. I rather
doubt you can do such things under NT.

Cheers,
Philip


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

Date: Wed, 31 Mar 1999 08:24:19 +0200
From: Ketil Heggtveit <Ketil@dnb-data.dnb.no>
Subject: hashes
Message-Id: <3701BF93.E67A7891@dnb-data.dnb.no>


--------------F90F346D6E0DDFDB5E60BF72
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi,

I'm trying to use dbm-module to store data from a table that I have, but
are uable to store more than one columb in a dbm file.

#opt_p is an input variable, TODAY i the date.

use NDBM_File;
$dir="/home/ketil/share";
$file="al.txt";
dbmopen (%hist_pros,"$dir/$file", 0744 ) || die "Can\'t open : $!\n";
$hist_pros{$opt_p}{$TODAY} += $TIME ;

foreach $i (sort keys %hist_pros){
    for $j (sort keys %{$hist_pros{$i}}){
        print "$i $hist_pros{$j}\n";
      }
  }
dbmclose %hist_pros;

this does not work , WHY?
Can anyone tell me HOW to store a two-dimentional array in a dbm file ?

-- _/ Ketil Heggtveit
_/Basisstxtte, DnB P&U IT-Drift, Sandsli
_/e-mail:Ketil
_/tlf: (55 2)2 34 71 fax: (55 2)2 33 00



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

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>I'm trying to use dbm-module to store data from a table that I have,
but are uable to store more than one columb in a dbm file.
<p>#opt_p is an input variable, TODAY i the date.
<p>use NDBM_File;
<br>$dir="/home/ketil/share";
<br>$file="al.txt";
<br>dbmopen (%hist_pros,"$dir/$file", 0744 ) || die "Can\'t open : $!\n";
<br>$hist_pros{$opt_p}{$TODAY} += $TIME ;
<p>foreach $i (sort keys %hist_pros){
<br>&nbsp;&nbsp;&nbsp; for $j (sort keys %{$hist_pros{$i}}){
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "$i $hist_pros{$j}\n";
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp; }
<br>dbmclose %hist_pros;
<p>this does not work , WHY?
<br>Can anyone tell me HOW to store a two-dimentional array in a dbm file
?
<p>-- _/ Ketil Heggtveit
<br>_/Basisst&oslash;tte, DnB P&amp;U IT-Drift, Sandsli
<br>_/e-mail:<a href="mailto:Ketil.Heggtveit@dnb-data.dnb.no">Ketil</a>
<br>_/tlf: (55 2)2 34 71 fax: (55 2)2 33 00
<br>&nbsp;
<br>&nbsp;</html>

--------------F90F346D6E0DDFDB5E60BF72--



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

Date: Wed, 31 Mar 1999 06:45:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: hashes
Message-Id: <ebohlmanF9G5FE.9pt@netcom.com>

Ketil Heggtveit <Ketil@dnb-data.dnb.no> wrote:

: --------------F90F346D6E0DDFDB5E60BF72
: Content-Type: text/plain; charset=iso-8859-1
: Content-Transfer-Encoding: 8bit

Please configure your newsreader not to post multi-part HTML-encoded 
articles.

: I'm trying to use dbm-module to store data from a table that I have, but
: are uable to store more than one columb in a dbm file.

Take a look at MLDBM.  The db modules by themselves can store only 
strings, not complex data structures built from references.  MLDBM will 
handle the marshalling (stringification and de-stringification) of such 
structures for you.



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

Date: Wed, 31 Mar 1999 07:54:42 +0100
From: "Clinton Gormley" <clint@drtech.co.uk>
Subject: Re: hashes
Message-Id: <7dsgk3$4u0$1@taliesin.netcom.net.uk>

Try the MLDBM module on CPAN

Ketil Heggtveit <Ketil@dnb-data.dnb.no> wrote in message
news:3701BF93.E67A7891@dnb-data.dnb.no...
> Hi,
>
> I'm trying to use dbm-module to store data from a table that I have, but
> are uable to store more than one columb in a dbm file.
>
> #opt_p is an input variable, TODAY i the date.
>
> use NDBM_File;
> $dir="/home/ketil/share";
> $file="al.txt";
> dbmopen (%hist_pros,"$dir/$file", 0744 ) || die "Can\'t open : $!\n";
> $hist_pros{$opt_p}{$TODAY} += $TIME ;
>
> foreach $i (sort keys %hist_pros){
>     for $j (sort keys %{$hist_pros{$i}}){
>         print "$i $hist_pros{$j}\n";
>       }
>   }
> dbmclose %hist_pros;
>
> this does not work , WHY?
> Can anyone tell me HOW to store a two-dimentional array in a dbm file ?
>
> -- _/ Ketil Heggtveit
> _/Basisstxtte, DnB P&U IT-Drift, Sandsli
> _/e-mail:Ketil
> _/tlf: (55 2)2 34 71 fax: (55 2)2 33 00
>
>
>




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

Date: Wed, 31 Mar 1999 08:16:14 GMT
From: agniora@usa.net
Subject: How do i use the mod function in perl?
Message-Id: <7dslk8$8j2$1@nnrp1.dejanews.com>

In perl how will i do the modulus function on two operatives.
if anyone knows please let me know.
thanks for ur help.
Nayeem

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 31 Mar 1999 09:25:44 +0200
From: "John Xllgerd Jensen" <joj@invalid.doms.dk>
Subject: Inserting Formfeed in report
Message-Id: <3701CDF8.3866DB4C@invalid.doms.dk>

How do I  insert a formfeed in my report using the format declaration
and a  header with page
number?
Note: The page following the forced formfeed should be a full page with
the page number
incremented by one.

Before replying, please remove the word 'invalid' from my e-mail addr.


Below is following some code showing what I'm doing:


format REPORT_TOP=
@||||||||||||||||||||||||||||              Page @<
"This is a header line",                   $%
 .


format REPORT=
Dollar_procent: @<<   Dollar_minus: @<<
                $%  , $-
This is a test report:
RepDate:  @<<<<<<<<<<<
          $RepDate
End of test report.
 .

format REPORT2=
Dollar_procent: @<<   Dollar_minus: @<<
                $%  , $-
This is a test report2:
Rep2Date:  @<<<<<<<<<<<
           $RepDate
End of test report2.
 .


sub report1
  {
    $RepDate = "1999-01-11";
    select((select(MYREPORT), $~ = "REPORT")[0]);

    for ($i=0; $i < 45; $i++)
      {
        write MYREPORT;
      }
  }

sub report2
  {
    $RepDate = "1999-02-22";
    select((select(MYREPORT), $~ = "REPORT2")[0]);

    for ($i=0; $i < 45; $i++)
      {
        write MYREPORT;
      }
  }



open (MYREPORT, ">myreport.txt");

report1;

# Insert formfeed before report2:
# ?????
$- = 0; # set number of lines left = 0.
        # That should provoke a formfeed before next write report2
        # but this doesn't work
        # maybe because I'm not refering to the right filehandle??


report2;

close (MYREPORT);



# thank, John.




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

Date: 31 Mar 1999 06:05:37 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: LWP..to use or not?
Message-Id: <slrn7g3fca.lru.fl_aggie@stat.fsu.edu>

On Wed, 31 Mar 1999 08:32:53 +1000, Mick <horizon@internetexpress.com.au> wrote:

+ I've had a look at LWP, but am not sure if this is the correct method
+ to use?
+ Say remote address http://127.0.0.1/datafiles/ contains 30 data files
+ I need to process, but I only want to parse the data files with a
+ particular extension -
+ No problems if local
+ @data_files = grep { /\.data$/ } readdir(DIR);
+ closedir(DIR);

+ But how do I go about this with remotely located files?
+ Can I parse each one like I normally can with local files -?

You may want to take a look at lwp-mirror, a value-added bonus
to LWP.

James


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

Date: 31 Mar 1999 07:58:47 +0200
From: Gisle Aas <gisle@aas.no>
Subject: Re: LWP..to use or not?
Message-Id: <m3u2v2nqso.fsf@eik.g.aas.no>

Mick <horizon@internetexpress.com.au> writes:

> I need to be able to fetch multiple data files from remote locations.
> The data files are processed as the script runs.
> I've had a look at LWP, but am not sure if this is the correct method
> to use?
> Say remote address http://127.0.0.1/datafiles/ contains 30 data files
> I need to process, but I only want to parse the data files with a
> particular extension -
> No problems if local
> @data_files = grep { /\.data$/ } readdir(DIR);
> closedir(DIR);
> 
> But how do I go about this with remotely located files?

You can't, unless the server reveals the file names for you (possibly
as an HTML page).

-- 
Gisle Aas


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

Date: Wed, 31 Mar 1999 10:07:52 +0300
From: "Tero Putkonen" <tjp@cs.tut.fi>
Subject: Need for script which looks file and replaces HTML tags with WML tags
Message-Id: <7dshkj$o41$1@baker.cc.tut.fi>

Hi !
I need help for writing script which reads file and if it finds some HTML
tag it replaces it with some other tag (WML). HTML Tags which are not
replaced will be taken off from that file.

Can somebody help me ?

Thanks,
    Tero




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

Date: Wed, 31 Mar 1999 11:56:26 +0200
From: Henrik Widenfors <pt98hwi@student.hk-r.se>
Subject: Newbie questions...
Message-Id: <3701F14A.D88@student.hk-r.se>

Hi 

Notice: I4ve never done Perl or CGI programming before.

1. I4m supposed to do a homepage with a form that a visitor can fill in.
Then a e-mail is supposed to be sent to a sertain e-mail adress
containing what the visitor just wrote (name, address and comments etc).
How can this be done? I know that I must (or?) use a CGI script. But how
do I make my owne CGI-script? Do I have to use Perl? What is the most
common to use in this situation? What would YOU suggest?


2. How can I make a HTML page access a Database (for example : MS Access
or FileMakerPro) located on the same server as the HTML page? Can YOU
give a basic explaination.
Here what I think about it so far (please correct me) : I use a
HTML-page and in this page I call my CGI-script. From the CGI-script I
access the Database. Can the CGI-script forwad data loacated in the
Database to the HTML-page? What4s the difficulties in building a
application like this? Where do YOU think I have to spend the most time?


Any suggestions and answer would be greatly appretiated. Thanks

Please email to :  pt98hwi@student.hk-r.se  aswell


/ Henrik Widenfors


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

Date: Wed, 31 Mar 1999 00:28:30 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Protecting Scripts from Privacy
Message-Id: <1dpi7e5.murlti1gxssv0N@p107.tc2.state.ma.tiac.com>

Mike Watkins <mwatkins@promotion4free.com> wrote:

> Subject: Protecting Scripts from Privacy

Finally!  After all the paranoid users asking how to hide their code
from thieves and crooks, it's refreshing to find someone who instead
wants to protect their code from such foolish privacy.

You have my undying respect, sir!


> Hi there,
> 
> I'm sure some of you have had this problem, so I thought I would ask.  Is
> there anyway way to protect your CGI scripts which you sell from being
> pirated?
> 
> Thanks,
> Mike

Oh, you meant piracy.  Never mind.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 31 Mar 1999 00:52:24 -0800
From: "TinP" <tgj@snip..net>
Subject: random elements from an array
Message-Id: <7dsd12$4kj$1@news1.fast.net>

How can you take a random element of an array yet not randomly choose it
again?

I want to simulate some cardgames and I set up an array called @cards
("Ad","2d","3d", etc for 52 elements
(to let you know: Ad = Ace of Diamonds 2d = 2 of Diamonds......)

What I want to do is grab a random element but not repeat it. I can do that
but I would like to know how I can "Deal a hand" without repeating an
element I already chose.

For example this below will pick 5 random elements but it may pick the same
one twice.
@cards = ("Ad","2d","3d", etc up to 52 );

srand();
while ($count < 5){
print @cards[&randomcard];
print "\n";
$count++;
}
sub randomcard{
$num = int(rand(52));
}






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

Date: Tue, 30 Mar 1999 22:59:28 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: random elements from an array
Message-Id: <MPG.116b67951b98761a9897f8@nntp.hpl.hp.com>

In article <7dsd12$4kj$1@news1.fast.net> on Wed, 31 Mar 1999 00:52:24 -
0800, TinP <tgj@snip..net >says...
> How can you take a random element of an array yet not randomly choose it
> again?

print splice(@cards, rand @cards, 1), "\n" for 1 .. 5;

This destroys the array @cards.  Keep a copy and reconstitute it for 
each deal.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 29 Mar 1999 23:17:45 +0200
From: wanga <wanga@exterminator.net>
Subject: removing ghost from variable
Message-Id: <36FFEDF9.25787BBB@exterminator.net>

hi all,

say i have $text variable (output of html form by cgi) but there could
be some newline codes in it (for example - user in form's text input
writes some lines inbetween pressing <ENTER> key).
so i need to remove newline splits in this variable.

looks simple - but i can't get pass it:

i tried substitution of '\n' to simple space character:
$space = " ";
$text =~ s/\n/$space/g;

but that haven't fully solved all problem. although after such
substitution there are no more '\n' code - anyway there left some
unknown crap that hampers.

that crap - in windows notepad, in the text file generated from
outputting that variable - looks like symbol with black cube.
windows netscape - doesn't show this character, but interprets it
like newline code.
and in unix - i piped that new variable' print to sendmail - and got
the beginning of a first line overwritten by the second' symbols, but
not removed left symbols of the first line.

the only idea i imagine - that <-ENTER key-> in html form generates
not only \n code but also something more. could it be that there are
one code to write FROM THE BEGINNING of line and another code to write
in NEXT line ('\n')??

hope someone will explain and help me to remove that strange code.

thanks in advance.
-w-




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

Date: Mon, 29 Mar 1999 23:16:26 +0200
From: wanga <wanga@exterminator.net>
Subject: script with arguments in SSI
Message-Id: <36FFEDAA.6846CDBD@exterminator.net>

hi,

i need to use perl script with arguments by SSI.

if i run script from browser url with arguments
(like http://www.x.com/cgi-bin/test.pl?temp) - it works well, but
trying same by SSI in html (<!--#exec cgi="/cgi-bin/test.pl?temp"-->) -
i get [error processing directive].

any ideas? am i doing something wrong?

thx in advance.
-w-




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

Date: Wed, 31 Mar 1999 00:28:33 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: strange ERROR mssg
Message-Id: <1dpi7un.16hr5loug8wwiN@p107.tc2.state.ma.tiac.com>

Marc Bakker <mbakker@atmm.nl> wrote:

> I got this error message upon compiling (perl -c) my code:
> 
> Illegal character \015 (carriage return) at get_top_ten.pl line 2.
> (Maybe you didn't strip carriage returns after a network transfer?)
> 
> I see nothing unusual at line 2 - and yes, there is a CR.
> 
> What does it mean?

It means you have an illegal character (\015 - carriage return) at line
2 of your script, get_top_ten.pl.  Perhaps you didn't strip carriage
returns after a network transfer?

Your system expects \012 line endings, but you're giving it a script
with \015 characters in it.  The solution should be obvious:
remove the \015 characters.

perl -pi -e 'tr/\015//d;'


-- 
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
      perl -s -e'print sort grep { /\s/ } keys %main::
            ' -- -is -' Just' -' another ' -'Perl ' -'hacker 
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]


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

Date: Wed, 31 Mar 1999 00:28:35 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Tricky regex Problem
Message-Id: <1dpi89x.np3rd4rzv2cjN@p107.tc2.state.ma.tiac.com>

Tony Irvine <Tony.Irvine@env.qld.gov.au> wrote:

> Expected output : htisi s osmet ex1t23
> Actual output : ${$order[0]}${$order[1]}${$order[2]}${$order[3]}
> 
> If I simply fill out the rhs like this:
> 
> s/$lhs/${$order[0]}${$order[1]}${$order[2]}${$order[3]}/g;
> 
> then it works fine... but this of course will not scale for different
> sized @order.
> 
> I have read up on the use of /e and even tried nesting them but all to
> no avail.

You have the right idea, then.  Nesting /e is a bit tricky.



Working backwards:

  s/$lhs/$2$1$3$4/g;

  s/$lhs/"${$order[0]}${$order[1]}${$order[2]}${$order[3]}"/ge;

  $rhs = '"${$order[0]}${$order[1]}${$order[2]}${$order[3]}"';
  s/$lhs/$rhs/gee;



The key to nesting /e is that each evaluation needs to start with a
valid expression.

In particular, this is not a valid Perl expression:

  ${$order[0]}${$order[1]}${$order[2]}${$order[3]}

But this one is:

  "${$order[0]}${$order[1]}${$order[2]}${$order[3]}"



So, you can make /ee work by adding

  $rhs = "qq{$rhs}";

right before the substitution.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: Wed, 31 Mar 1999 01:07:47 -0500
From: David Coppit <dwc3q@mamba.cs.Virginia.EDU>
Subject: Typeglobbing functions in main
Message-Id: <Pine.GSO.4.05.9903310101360.10090-100000@mamba.cs.Virginia.EDU>


I'm having trouble getting "dprint" in a package to call "dprint" in main,
like so:

Package main...

sub dprint 
{
  my $string = shift;
  print "DEBUG: $string\n";
}

Package foo...

*dprint = \&main::dprint;
dprint "Some stuff";

Can anyone see what I'm doing wrong? I get complaints about dprint not
being declared...

I see modules like timelocal.pm referencing functions in Time::Local, and
don't see why my version doesn't work.

David

_________________________________________________________________________
David Coppit - Graduate Student        coppit@cs.virginia.edu
The University of Virginia             http://www.cs.virginia.edu/~dwc3q
    "Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."



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

Date: 31 Mar 1999 01:27:26 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Typeglobbing functions in main
Message-Id: <x71zi6w4vl.fsf@home.sysarch.com>

>>>>> "DC" == David Coppit <dwc3q@mamba.cs.Virginia.EDU> writes:

  DC> Package main...

  DC> sub dprint 
  DC> {
  DC>   my $string = shift;
  DC>   print "DEBUG: $string\n";
  DC> }

  DC> Package foo...

package is lower case (as are all perl keywords and funcs)

  DC> *dprint = \&main::dprint;
  DC> dprint "Some stuff";

  DC> Can anyone see what I'm doing wrong? I get complaints about dprint not
  DC> being declared...

this has nothing to do with the typeglob or the package stuff. perl
doesn't know that dprint is a sub since you are giving it no way of
knowing that. use parens to let perl know it is a sub call.

this works:

dprint( "Some stuff" );

hth,

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 31 Mar 1999 06:12:44 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: XML-Parser: dealing with predefined entities
Message-Id: <ebohlmanF9G3x9.8Iq@netcom.com>

Jed Parsons <jed@socrates.berkeley.edu> wrote:
: By ``deal with'' I mean handle.  I assumed that if I set an entity handler
: for a parser $p 

: 	$p->setHandlers (Entity => \&entity_handler);

: it would invoke &entity_handler whenever it came across things like
: &amp;  That it does not makes me think my idea of ``entity'' might be
: confused.

You assumed wrong.  XML::Parser's (ok, ok, it's really 
XML::Parser::Expat's) Entity handler is called when the parser reads an 
<!ENTITY...> *declaration* in the DTD.  It's *not* called when an entity 
*reference* is encountered in the document; those are expanded 
transparently (though the process involves a call to the ExternEnt 
handler if the entity was declared external).
 


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5265
**************************************

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