[11881] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5481 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 25 23:07:30 1999

Date: Sun, 25 Apr 99 20:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 25 Apr 1999     Volume: 8 Number: 5481

Today's topics:
    Re: $. woes (Abigail)
    Re: $ENV...Explained (Abigail)
    Re: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex( <mpersico@erols.com>
    Re: Accepting Uploads via the web (Abigail)
    Re: Can a DNS lookup be performed from within perl ? (Abigail)
        Can Perl Run Local under Win 98? <joeyandsherry@mindspring.com>
    Re: Can Perl Run Local under Win 98? <ffchopin@worldnet.att.net>
    Re: Check to see if a Module Exists... <cassell@mail.cor.epa.gov>
    Re: Country of a visitor (Abigail)
    Re: Decimal to fraction (Abigail)
    Re: Extracting emails from array <jglascoe@giss.nasa.gov>
    Re: FAQ 4.50: How do I sort an array by (anything)? <cassell@mail.cor.epa.gov>
    Re: Generating a unique string for order number (Abigail)
    Re: Help me with a simple cgi/perl script (Abigail)
    Re: Help with Code (Abigail)
    Re: Help with CTlib and DBlib! (Abigail)
    Re: Help! Error message when using C-comment stripper f ebatutis@my-dejanews.com
    Re: Help! Error message when using C-comment stripper f <cassell@mail.cor.epa.gov>
    Re: How do i print something using perl? (Abigail)
    Re: How do we create global variables in perl? (Abigail)
    Re: Newbie regex query (Abigail)
    Re: PERL Books (Abigail)
        Perl operate autonomously? <joeyandsherry@mindspring.com>
        System Call <sotoo@home.com>
    Re: What is wrong with this picture? <basvreek@xs5all.nl>
    Re: What is wrong with this picture? <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 26 Apr 1999 01:20:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: $. woes
Message-Id: <7g0f1k$ntk$1@client2.news.psi.net>

Tad McClellan (tadmc@metronet.com) wrote on MMLXIII September MCMXCIII in
<URL:news:su5vf7.nj1.ln@magna.metronet.com>:
??    
?? 
??    If the list of records is short, you can get away with:
?? 
??       while ($record = <DB>) {  # untested!
??          do_stuff($record) if grep $_ == $., @rec_nos;
??       }

But that doesn't scale well if the number of records is large. Or if you
only want a few records from the beginning of a huge database.

Assuming @rec_nos is ordered:

     LOOP:
         while (@rec_no && !eof DB) {
             while ($. < $rec_no [0]) {
                 <DB>; last LOOP if eof DB;
             }
             do_stuff (scalar <DB>);
             shift @rec_no;
         }



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 26 Apr 1999 01:34:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: $ENV...Explained
Message-Id: <7g0frv$ntk$3@client2.news.psi.net>

HowToFoldSoup (webmaster@eat.me.howtofoldsoup.com) wrote on MMLXIII
September MCMXCIII in <URL:news:7fua98$ed2$1@sys14.hou.wt.net>:
~~ I believe the people who answered the question weren't understanding the
~~ question.
~~ 
~~ What the questioner, as I understand it, was trying to ask was if there is a
~~ list of the $ENV{'VAR_TYPE'} type of variables that a browser automatically
~~ passes to the perl script.
~~ 
~~ I know of the Following:
~~ 
~~ CONTENT_LENGTH
~~ HTTP_REFERRER
~~ REMOTE_HOST
~~ REMOTE_ADDR
~~ QUERY_STRING
~~ DOCUMENT_URI

These are wrong. Here is the complete list of variables passed from the
browser to your Perl script:


That's right. Nothing. Nothing at ALL. The browser isn't talking to
your Perl script. The server is. But that interaction has nothing to do
with Perl. Cause it isn't Perl specific. In fact, the server couldn't
care less your program is written in Perl. It would do the same if the
program was written in vi macros!

So, I suggest you find out which protocol your server is using to communicate
with your Perl program (Free clue: read the documentation of your server!),
and then either look up the specifics of said protocol (Free clue: it's on the
web!) or get flamed for asking FAQs in the group that discusses said protocol.



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Sun, 25 Apr 1999 20:57:42 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
Message-Id: <3723BA06.76D121D@erols.com>

Benjamin Franz wrote:
> 
[snip]
> Nor do I. I find pulling a 150+Kbytes for a form decoder to be...excessive.
> 
Um. what about AUTOLOAD? Doesn't that help? And isn't the package
AUTOLOADing?

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


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

Date: 26 Apr 1999 01:36:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Accepting Uploads via the web
Message-Id: <7g0fub$ntk$4@client2.news.psi.net>

Gabriel Richards (glrichards@email.msn.com) wrote on MMLXII September
MCMXCIII in <URL:news:O4bHfhqj#GA.239@cpmsnbbsa05>:
%% Is there a module or something that I can use to help me create a script to
%% allow users to upload images and text files via the web?


Most modern day browsers have all that functionality already buildin.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: 26 Apr 1999 01:45:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Can a DNS lookup be performed from within perl ?
Message-Id: <7g0gfb$ntk$5@client2.news.psi.net>

Benjamin Franz (snowhare@long-lake.nihongo.org) wrote on MMLXIII
September MCMXCIII in <URL:news:XcGU2.2917$oU1.210288@typhoon-sf.snfc21.pbi.net>:
$$ In article <MPG.118ac438437cee1698992e@nntp.hpl.hp.com>,
$$ Larry Rosler <lr@hpl.hp.com> wrote:
$$ >[Posted and a courtesy copy sent.]
$$ >
$$ >In article <37210887.24C61A7A@ececs.uc.edu> on Fri, 23 Apr 1999 19:55:51 
$$ >-0400, Rajesh Radhakrishnan <rradhakr@ececs.uc.edu> says...
$$ >...
$$ >>   # search for IP address eg.129.137.4.62 in log file
$$ >>   if (m/(\d+.\d+.\d+.\d+)/) {
$$ >
$$ >I'll just point out that this regex will also find, for example, 
$$ >'1234567' or lots of other strings that aren't dotted-quads.  I'll let 
$$ >the others whine about IP addresses that have only two or three dots.
$$ 
$$ Surprisingly enough, '1234567' could (almost) be an IP address.
$$ 
$$ Try http://3521755779/snowhare/ in a web browser (note -
$$ the Squid proxy server _mistakenly_ rejects straight 32 bit
$$ addresses as being invalid).

I don't think it _mistakenly_ does so. It might actually just follow
the specs.

While 3521755779 might be a valid IP address, RFC 1738 doesn't find
http://352175579/snowhare/ a valid URL. And that's what matters.

Of course, that has nothing to do with Rajesh question. If his server
always uses IP numbers with 3 dots, /(\d+\.\d+\.\d+\.\d+)/ will do just
fine. But (s)he has to add the \'s.


Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Sun, 25 Apr 1999 20:56:59 -0400
From: <joeyandsherry@mindspring.com>
Subject: Can Perl Run Local under Win 98?
Message-Id: <7g0e19$15q$1@nntp2.atl.mindspring.net>

Hello,

    Thanks for your assistance:

    I want to make a website run locally, but I use perl to do a simple
search, can perl be set up to operate locally, just as it does on the net?




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

Date: Sun, 25 Apr 1999 21:14:55 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Can Perl Run Local under Win 98?
Message-Id: <7g0ehp$e3g$1@bgtnsc02.worldnet.att.net>

<joeyandsherry@mindspring.com> wrote in message
news:7g0e19$15q$1@nntp2.atl.mindspring.net...
> Hello,
>
>     Thanks for your assistance:
>
>     I want to make a website run locally, but I use perl to do a simple
> search, can perl be set up to operate locally, just as it does on the net?

Sure, using Personal Web Server.  Without getting too much into it, you can
set up PWS (available as a free download from M$), and then use the IP
address 127.0.0.1 to refer to your local machine.  If everything is
configured correctly, then all should run as if it were called from the web.

Jason Simms




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

Date: Sun, 25 Apr 1999 17:18:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Check to see if a Module Exists...
Message-Id: <3723B0F2.15A377C7@mail.cor.epa.gov>

Steve Wells wrote:
> 
> I'm writing an install script and need to know if a module
> exists, if it doesn't I'd like to allow the user to install
> it with CPAN.pm.  I'm looking for something like:
> 
> use MOD or &install_MOD;
> 
> I realize there are several ways to do this and the first
> thing that comes to mind is wrapping it in an eval statement
> but I was wondering if there are any cool hacks for doing
> this as I'm sure others have run into before themselves.
> 
> TIA,

You might take a look at the ppm.pl and ppm.pm programs, both
of which come with ActiveState Perl [for win32], and see how 
they cope with the same issue.  

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 26 Apr 1999 01:51:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Country of a visitor
Message-Id: <7g0gqk$ntk$6@client2.news.psi.net>

selectthree (selectthree@gsig-net.qc.ca) wrote on MMLXII September
MCMXCIII in <URL:news:37222417.3253@gsig-net.qc.ca>:
## Does anyone know the code to determine the origin country of a visitor
## (or only it's code, like .com, .ca, .uk, .fr...)?


You can't.

You can of course do a 'gethostbyaddr', but there's nothing that
prevents someone from using 'foo.bar.com', 'foo.bar.ca', 'foo.bar.uk'
and 'foo.bar.fr' as names for the same host.

Not to mention that .com, .org and .net are everywhere. And do you 
really thing those .to hosts domains are all located on an island?

And what are you going to do with a "visitor" from country A, that
uses a proxy in country B?

Your best bet will be to hand out accounts and passwords, and actually
deliver the passwords yourself in person. But then, they might be just
visiting a friend.


Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


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

Date: 26 Apr 1999 01:56:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Decimal to fraction
Message-Id: <7g0h40$ntk$7@client2.news.psi.net>

JJ (webdude@mcminn.net) wrote on MMLXIV September MCMXCIII in
<URL:news:Y1OU2.2726$94.1233838@news1.usit.net>:
== is it possible to convert decimal values to fractions in a script? Maybe
== with regular expressions?


Yes.


    (my $fraction = $decimal) =~ s{\.(\d+)}{ $1/1${\(0 x length $1)}};


Abigail
-- 
perl -wlne '}{print$.' file  # Count the number of lines.


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

Date: Sun, 25 Apr 1999 19:51:27 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
Subject: Re: Extracting emails from array
Message-Id: <3723AA7F.2665BB23@giss.nasa.gov>

"Randal L. Schwartz" wrote:
> 
> Jay> the regex isn't foolproof.
> 
> Or correct.  It doesn't find
> 
>         fred&barney@stonehenge.com
> 
> which is a perfectly legal address (try it... it's an autoresponder).
> Or my friend Eli, with an address of something like <*@qz.to>, also
> legal.

oh well, no spam for Fred, Barney, or Eli.

;^)


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

Date: Sun, 25 Apr 1999 19:41:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 4.50: How do I sort an array by (anything)?
Message-Id: <3723D255.4E1275F2@mail.cor.epa.gov>

Tom Christiansen wrote:
> [a lot of useful stuff, cruelly elided]
> 
>     Which could also be written this way, using a trick that's come to

s/trick/technique/

>     be known as the Schwartzian Transform:

Well, at least you're not still calling it the "Black Transform."  :-)

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 26 Apr 1999 00:45:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Generating a unique string for order number
Message-Id: <7g0cv6$nrh$1@client2.news.psi.net>

Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote on MMLXIII September
MCMXCIII in <URL:news:1dqsfwh.3of6zf1v9co12N@[207.60.170.47]>:
__ 
__ 
__ And I still hold that using temporary process ids as _permanent_ order
__ ids is conceptually wrong.


It is. But that wasn't proposed. The proposal calls for using the
(temporary) process id as _part_ of the permanent order.

The idea behind using process ids is that they are temporary unique.

On a single machine, this ought to give unique strings:

     sub unique {
         sleep 2;  # This will sleep for _at least_ a second, sleep 1 might not.
         $$ . ":" . time;
     }


Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


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

Date: 26 Apr 1999 02:02:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help me with a simple cgi/perl script
Message-Id: <7g0hg4$ntk$8@client2.news.psi.net>

SatCP (satcp@ping.be) wrote on MMLXIII September MCMXCIII in
<URL:news:7fv8qc$dgs$3@news3.Belgium.EU.net>:
-- Hi everybody,
--
-- I'm new to cgi, but want a script on my webpage. I've looked around on the
-- web but couldn't find a script that does everything I want... I know most of
-- you will say, go out and buy a good book 'bout cgi and perl, but I only need
-- 1 simple script on my page and I'm not buying a book for that...


You don't have to buy a book. But you could read the documentation
that comes with Perl.

Read the documentation first, and if you have specific questions about
your script, feel free to ask them. But don't bother us with "write my
script for me" questions.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 26 Apr 1999 02:04:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with Code
Message-Id: <7g0hiv$ntk$9@client2.news.psi.net>

Simon Gronow (srg@babcom.com.au) wrote on MMLXIII September MCMXCIII in
<URL:news:372288D7.591A236B@babcom.com.au>:
$$ 
$$ My Question is how can I get one character in a line, the "/" to be
$$ changed to "\"


Use s///. Or, to please Larry (no, not him, the other one), y///.


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


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

Date: 26 Apr 1999 02:06:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with CTlib and DBlib!
Message-Id: <7g0hmh$ntk$10@client2.news.psi.net>

UNKOWN (quoc@wam.umd.edu) wrote on MMLXIII September MCMXCIII in
<URL:news:7fvcb2$7f7$1@dailyplanet.wam.umd.edu>:
,, I having trouble find a man page to DBlib and CTlib!


DBlib and CTlib are Sybase libraries. You can find manpages for them
on the Sybase website. (http://sybooks.sybase.com).

If you want information about the Perl interface to those libraries,
they come with sybperl.



Abigail
-- 
perl -wlpe '}{$_=$.' file  # Count the number of lines.


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

Date: Mon, 26 Apr 1999 01:33:10 GMT
From: ebatutis@my-dejanews.com
To: perlfaq-suggestions@perl.com
Subject: Re: Help! Error message when using C-comment stripper from perlfaq
Message-Id: <7g0fom$7gg$1@nnrp1.dejanews.com>

In article <7flli5$5k2$1@news1.rmi.net>,
  GoodfriB@jntf.osd.mil (James R. Goodfriend) wrote:
> Greetings,
>
> 	I'm using the massive regular expression listed in perlfaq6 to strip
> out the comments from a C file.  (I won't repeat my code here since mine
> exactly the same).  When I run this using -w I get the following error
message:
>
> Use of uninitialized value at (program) line 19, <CFILE> chunk 1.
>

I found a work-around.

Instead of just having $2 in the REPLACEMENT part of the expression

s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|\n+|.[^/"'\\]*)#
$2#g;

I used the expression

if (defined $2) { $2; } else { ""; }

with the "e" modifier. So the whole thing now looks like this:

s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|\n+|.[^/"'\\]*)#
if (defined $2) { $2; } else { ""; }#ge;

This seems ungainly. Perhaps there is a short-cut notation for

if (defined $2) { $2; } else { ""; }

Anyway, maybe an addendum to the FAQ item would be a good idea.

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


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

Date: Sun, 25 Apr 1999 19:57:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Help! Error message when using C-comment stripper from perlfaq
Message-Id: <3723D621.572CA1DE@mail.cor.epa.gov>

ebatutis@my-dejanews.com wrote:
> 
> [snip]
> I found a work-around.

Good.  I see that your work-around corrects the problem the error 
message complained about, instead of just dodging it.

> Instead of just having $2 in the REPLACEMENT part of the expression
> 
> s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|\n+|.[^/"'\\]*)#
> $2#g;
> 
> I used the expression
> 
> if (defined $2) { $2; } else { ""; }

Actually, the semi-colon is not required for the last [or only]
statement
in a block.  Just in case you were wondering...

> with the "e" modifier. So the whole thing now looks like this:
> 
> s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|\n+|.[^/"'\\]*)#
> if (defined $2) { $2; } else { ""; }#ge;
> 
> This seems ungainly. Perhaps there is a short-cut notation for
> 
> if (defined $2) { $2; } else { ""; }

There is.  It looks the same as in C.

(defined $2) ? $2 : ""   
 
> Anyway, maybe an addendum to the FAQ item would be a good idea.

In the immortal words of Tom Christiansen, "Patches are welcome."
[Why does that make me think of 'Father Knows Best'?  :-]
The FAQ will tell you the correct place to submit such a note.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 26 Apr 1999 02:07:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How do i print something using perl?
Message-Id: <7g0hpe$ntk$11@client2.news.psi.net>

smnayeem@my-dejanews.com (smnayeem@my-dejanews.com) wrote on MMLXIII
September MCMXCIII in <URL:news:7fui9h$mlu$1@nnrp1.dejanews.com>:
{} Does anyone know how i can direct the output of print statements to the
{} printer?


open PRINTER, "| lp"  # Or whatever print command you use on your system.
     or die "fork failed: $!";

print PRINTER "whatever";



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


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

Date: 26 Apr 1999 02:18:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How do we create global variables in perl?
Message-Id: <7g0idt$o1o$1@client2.news.psi.net>

Ted Unnikumaran (unni@wam.umd.edu) wrote on MMLXIII September MCMXCIII in
<URL:news:3722B025.7AC5002E@wam.umd.edu>:
-- Hello, i'm just beginning to learn perl, so I apologize if this is a
-- stupid question.
--
-- I want to know how I can use global variables in perl.

Just like you do in C or Pascal. A "global" variable is just a variable
that's visible everywhere in your program.

--                                                         I've heard that
-- environmental variables are basically global variables, but that doesn't
-- seem to work properly for me.

You heard wrong. Although, with some strech, one could say that environment
variables are "global" variables in a shell. But this is Perl.

-- This is basically what i want to do.
--
-- When someone enters my web page, i want them to enter a user id and
-- other information about themselves.  They then press the submit button
-- and that information gets passed to some .cgi file, say 1st.cgi.  This
-- 1st.cgi file will then create another web page, where the user will
-- enter even more information about themselves, and press another submit
-- button.  This second submit button wil call another .cgi file, lets call
-- it 2nd.cgi and its at this page that I am having problems.  How can I
-- access the information entered into the first web page and passed into
-- 1st.cgi from this 2nd.cgi file?

Come again? What has this to do with global variables? Global still 
means "inside the program". Global doesn't mean universal - there's
no such thing. At least, not that humankind knows of.

-- What if I want to access the information from the first web page from a
-- .cgi file that i call real late in the process, say 5th.cgi, how will I
-- be able to do that?

Keep state. "Hidden fields" or URLs with state information work very well.
If you don't mind losing a large fraction of your customers, you could use
cookies as well.

    BUT THIS NEWSGROUPS IS NOT ABOUT WEB PAGES OR CGI PROGRAMMING.

The techniques you want are discussed elsewhere. I suggest asking there.
Those techniques are not discussed here, because they have nothing to do
with Perl, they work for any language, even if you would use troff for
your CGI programming.

-- Another question that I have that might be related, is how can I call
-- another cgi file from one cgi file.  So far the only way I know how to
-- call a cgi file is if a user presses a submit button, or if a user
-- presses on a link.  But how can I call a cgi file from within another
-- file?

I suggest dialing `0' and ask the operator to call for you.

What on earth do you mean by "calling a file"?

-- I'm sorry if I confused you, you can e-mail me if you want more
-- details.  And any tips would be greatly appreciated.

Here's a free tip: you get more useful answers in a group better suited
for your problems. May I suggest rec.cooking.shoestrings?



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 26 Apr 1999 02:23:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie regex query
Message-Id: <7g0in7$o1o$2@client2.news.psi.net>

Tad McClellan (tadmc@metronet.com) wrote on MMLXII September MCMXCIII in
<URL:news:moqsf7.mk.ln@magna.metronet.com>:
()    A Perl programmer would have used Perl's notation for exponentiation:
() 
()       7x**3 and 21x**2


Shirley, you mean 7 * $x ** 3 and 21 * $x ** 2?



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 26 Apr 1999 01:25:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PERL Books
Message-Id: <7g0fa4$ntk$2@client2.news.psi.net>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMLXIII September
MCMXCIII in <URL:news:37231d04@cs.colorado.edu>:
`` 
`` Haven't you ever read what Dennis said about this?
`` 
``     Some people are confused over whether this word is
``     appropriately `UNIX' or `Unix'; both forms are common, and used
``     interchangeably. Dennis Ritchie says that the `UNIX' spelling
``     originally happened in CACM's 1974 paper "The UNIX Time-Sharing
``     System" because "we had a new typesetter and {troff} had just been
``     invented and we were intoxicated by being able to produce small
``     caps." Later, dmr tried to get the spelling changed to `Unix'
``     in a couple of Bell Labs papers, on the grounds that the word
``     is not acronymic. He failed, and eventually (his words) "wimped
``     out" on the issue. So, while the trademark today is `UNIX', both
``     capitalizations are grounded in ancient usage; the Jargon File uses
``     `Unix' in deference to dmr's wishes.
`` 
`` So, spelling it "UNIX" is a mistake, in that 1) it is not an acronym
`` and 2) is not what dmr wishes used.

3) It isn't followed by [TM] ... ;)



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Sun, 25 Apr 1999 21:03:11 -0400
From: <joeyandsherry@mindspring.com>
Subject: Perl operate autonomously?
Message-Id: <7g0ecs$2g3$1@nntp2.atl.mindspring.net>

I want to create a little utility that keeps a "robotic" watch on my
database files, like periodically checking for errors, etc. Is there a way
for this script to operate on its own? Not requiring it to be called to have
it perform these checks?


Thanks a lot.


--
Joey Cutchins
President
Trading Post.Com, L.L.C.
http://internettradingpost.com
ceo@internettradingpost.com




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

Date: Mon, 26 Apr 1999 01:44:58 GMT
From: Omar Soto <sotoo@home.com>
Subject: System Call
Message-Id: <3723C540.DF075832@home.com>

Re-Send
-----------------------------------------------------------------------------------------------------------

Hello:

    I am calling a scripts of Perl Programs from a Shell
Script.  From inside the Perl Program, I call another Perl
Program.  It works if I call the invoking PERL program from the
command line, but it does not work when I call it from the Shell
Script.  The Code and the Dumps Follow:

$Path_OUT = "/users/sotoo/data/";
$Path_Data = "/users/sotoo/data/";

 $comm[0] = "$pwd" . "wfrphr.pl";
 $comm[1] = "$Path_Data" . "stats.dat";
 $comm[2] = "$Path_OUT" . "spdat.htm";
 print ("@comm\n");
 $status = system(@comm);
 print ("$status\t$?\n");
 $comm[0] = "$pwd" . "wfrphr.pl";
 $comm[1] = "$Path_Data" . "stats.curr";
 $comm[2] = "$Path_OUT" . "spcurr.htm";
 print ("@comm\n");
 $status = system(@comm);
 print ("$status\t$?\n");

I am double cheking the inputs and the return values.  After the
shell script that run the programs is called, the output from
the print statements is:

/mount/s/users/sotoo/pscripts/master/wfrphr.pl
/users/sotoo/data/stats.dat  /users/sotoo/data/spdat.htm
65280     65280
/mount/s/users/sotoo/pscripts/master/wfrphr.pl
/users/sotoo/data/stats.curr  /users/sotoo/data/spcurr.htm
65280     65280

What can I do to correct this.

Omar Soto



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

Date: Mon, 26 Apr 1999 02:03:24 +0200
From: "Bas van Reek" <basvreek@xs5all.nl>
Subject: Re: What is wrong with this picture?
Message-Id: <7g0af6$qh9$1@weber.a2000.nl>



remove single quotes on line print <<'ending_print_tag';
you could write print<<QQQ;
with the last line changed into QQQ (or whatever you prefer)

or print "
with on the last line ";
But then you can not use double quotes in
this line <background= "#000000" text="#ff0000">
if you use the last example.


Brian Dodd <bd@albany.net> wrote in message news:3723A52B.22B0@albany.net...
> I am looking for some help.  Ihave een reading and working on this
> all day with no succeess.  Somone please help.
>
> My program:
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
>
> print <<'ending_print_tag';
> <html>
> <head>
> <title>Hello World</title>
> <background= "#000000" text="#ff0000">
> </head>
> <body>
> <h1>Hello World</h1>
> <hr noshade>
> </body>
> </html>
> ending_print_tag
>
>
> when I run it with telenet i get:
>
>
> Illegal character \015 (carriage return) at hello.cgi line 2.
>
> (Maybe you didn't strip carriage returns after a network transfer?)
>
> chmod is 755
>
> any answers?



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

Date: Sun, 25 Apr 1999 17:41:29 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: What is wrong with this picture?
Message-Id: <3723B639.A9105D2F@mail.cor.epa.gov>

Brian Dodd wrote:
> 
> I am looking for some help.  Ihave een reading and working on this
> all day with no succeess.  Somone please help.
> 
> My program:
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> 
> print <<'ending_print_tag';
> <html>
> <head>
> <title>Hello World</title>
> <background= "#000000" text="#ff0000">
> </head>
> <body>
> <h1>Hello World</h1>
> <hr noshade>
> </body>
> </html>
> ending_print_tag
> 
> when I run it with telenet i get:
> 
> Illegal character \015 (carriage return) at hello.cgi line 2.
> 
> (Maybe you didn't strip carriage returns after a network transfer?)
> 
> chmod is 755
> 
> any answers?

A lot of them, some of which could be wrong since you didn't give 
us enough information.  But my answer to your primary question is:
"Why don't you believe the error message you got?"

Did you use ftp to transfer this file from a win32 box to a unix 
box?  If so, you have to use the ASCII mode, not the binary mode, 
for the transfer.  Win/DOS systems use a two-character `newline',
and ASCII mode transfers fix that on the way to unix-land.

I'll let someone else complain about your code snippet, other
than to point out that you really should run all your Perl code
with the -w flag on the shebang line.  But good work on using
the here-doc instead of a jillion print statements.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

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

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