[15514] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2924 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 2 14:05:38 2000

Date: Tue, 2 May 2000 11:05:19 -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: <957290719-v9-i2924@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 2 May 2000     Volume: 9 Number: 2924

Today's topics:
        ****Southern Cali Perl Progammer Needed (ADan327830)
    Re: ****Southern Cali Perl Progammer Needed (Mark Badolato)
    Re: [IMPORTANT] Content-type to download an image! <charles.henry@engineer2k.com>
    Re: [IMPORTANT] Content-type to download an image! <tony_curtis32@yahoo.com>
    Re: [IMPORTANT] Content-type to download an image! <charles.henry@engineer2k.com>
    Re: bourne 'dot' or csh 'source behavior <rootbeer@redcat.com>
    Re: bourne 'dot' or csh 'source behavior nobull@mail.com
    Re: CGI.pm and -w (Tad McClellan)
    Re: CGI.pm and -w <rootbeer@redcat.com>
    Re: CGI: uploading binary files with IIS mmarini@intesi-lab.com
        Clear and then Reuse a package name space <qchen@snet.net>
        Clear and then Reuse a package name space richard_chen@my-deja.com
        Directory spaces causing problems? neo_20001@my-deja.com
    Re: Directory spaces causing problems? <rootbeer@redcat.com>
        Expect.pm not performing as expected larkus@my-deja.com
    Re: How to compare values between 2 arrays ? <aqumsieh@hyperchip.com>
    Re: How to compare values between 2 arrays ? nobull@mail.com
    Re: How to simulate a post request ? ogmandrake@my-deja.com
    Re: How to test perl CGI scripts on my computer first? <tcuffel@exactis.com>
    Re: How to test perl CGI scripts on my computer first? (Tad McClellan)
    Re: I goofed <sternberg@phys.uni-paderborn.de>
    Re: Javascript call Perl CGI <tcuffel@exactis.com>
    Re: Javascript call Perl CGI schnurmann@my-deja.com
    Re: Javascript call Perl CGI <lauren_smith13@hotmail.com>
        making croak _not_ act like confess <lancon@mail.ce.utexas.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 02 May 2000 17:04:30 GMT
From: adan327830@aol.comnospam (ADan327830)
Subject: ****Southern Cali Perl Progammer Needed
Message-Id: <20000502130430.10464.00000989@ng-bh1.aol.com>

I am in need of a database management skilled programmer to help finish a
personals site (think adultfriendfinder.com)
If you think you can design something similar, and have sites that I can take a
look at, email me at adan327830@aol.com


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

Date: 2 May 2000 17:58:07 GMT
From: mbadolato@quepasa.com (Mark Badolato)
Subject: Re: ****Southern Cali Perl Progammer Needed
Message-Id: <8F28621B0mbadolatoquepasacom@206.165.3.80>

On 02 May 2000, adan327830@aol.comnospam (ADan327830) wrote in
<20000502130430.10464.00000989@ng-bh1.aol.com>: 

>I am in need of a database management skilled programmer to help
>finish a personals site (think adultfriendfinder.com)
>If you think you can design something similar, and have sites that
>I can take a look at, email me at adan327830@aol.com


What is your perl question?


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

Date: Tue, 2 May 2000 19:35:59 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: Re: [IMPORTANT] Content-type to download an image!
Message-Id: <8en40t$gg6$1@news2.isdnet.net>

> You can't force a browser to do something from the
> server-side.  If the client side wants to `view' an
> image/gif stream then it will, likewise if it wants to
> `download' it, it will, no matter what you send.

Absolutely false.
You should do some CGI !!!

YES I can force the browser to that. That's what headers are made for!!
That's particularly helpful when you don't want people to link your image!!

If you can *understand* the following code, you'll know what I mean :

["logo.gif"]
--

#!/usr/local/bin/perl

use strict;
use CGI;

my $query = CGI->new->param('query');
my $logo   = 'mylogo.gif';

if (  $query && $ENV{HTTP_REFERER}=~m!^http://www.url.com! ) {
 if ($query eq 'show') {
  print "Content-type: image/gif\n\n"
 } else {
  print "Content-type: application/download\n";
  print "Content-Disposition: attachment; filename=logo$lg.gif\n\n";
 }
 open (IMAGE,$logo) or die $!;
 binmode(IMAGE);
 print <IMAGE>;
 close (IMAGE);
} else {
 print "Content-type: text/html\n\n";
 print "<HTML><BODY>You cannot link this logo!</BODY></HTML>';
};

--

I know the referer is a breeze to spoof but that not the point here. That
code will prevent most people from hotlinking my logo




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

Date: 02 May 2000 12:51:20 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: [IMPORTANT] Content-type to download an image!
Message-Id: <87k8hcrgbr.fsf@shleppie.uh.edu>

>> On Tue, 2 May 2000 19:35:59 +0200,
>> "Charles Henry" <charles.henry@engineer2k.com> said:

>> You can't force a browser to do something from the
>> server-side.  If the client side wants to `view' an
>> image/gif stream then it will, likewise if it wants to
>> `download' it, it will, no matter what you send.

> YES I can force the browser to that. That's what headers
> are made for!!  That's particularly helpful when you
> don't want people to link your image!!

But I can then define any handling behaviour that I want
for an 'application/download' in my browser/client
software.  You cannot know from the server what I am going
to do in the browser/client with your stream type.

tony


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

Date: Tue, 2 May 2000 19:52:31 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: Re: [IMPORTANT] Content-type to download an image!
Message-Id: <8en4vs$hd0$1@news2.isdnet.net>

> But I can then define any handling behaviour that I want
> for an 'application/download' in my browser/client
> software.  You cannot know from the server what I am going
> to do in the browser/client with your stream type.

That's what the line :

print "Content-Disposition: attachment; filename=logo.gif\n\n";

Was made for !!!

Like I said you should do some CGI !!!




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

Date: Tue, 2 May 2000 09:19:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: bourne 'dot' or csh 'source behavior
Message-Id: <Pine.GSO.4.10.10005020908580.13677-100000@user2.teleport.com>

On 2 May 2000 shutchis@sherritt-NO_SPAM_PLEASEintl.com wrote:

> I have some scripts to run non-interactively (cron) and need to
> establish a specific environment. Under sh|ksh I would '. <file>'; in
> csh 'source <file>'. How to get the same behaviour within perl?
> 
> Unfortunately, the <file> in question is vendor supplied, ruling out a
> perl re-write.

So, you need to run the file (in a shell), see what environment it gives,
and either run your new program in that environment or make Perl code to
replicate that environment. 

One way would be to make a shell script which sources that file, then
prints the current working directory, the values of all environment
variables, and any other pertinent settings. Run that from perl via
backticks and parse its output.

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 02 May 2000 17:39:56 +0100
From: nobull@mail.com
Subject: Re: bourne 'dot' or csh 'source behavior
Message-Id: <u9wvlcaotf.fsf@wcl-l.bham.ac.uk>

<shutchis@sherritt-NO_SPAM_PLEASEintl.com> writes:

> I have some scripts to run non-interactively (cron) and need to establish
> a specific environment. Under sh|ksh I would '. <file>'; in csh
> 'source <file>'. How to get the same behaviour within perl?

do

For details see previous (or indeed currently active) threads on this
same question - you shouldn't need to go back more than a week to two
to find enough to cover all aspects.

> Unfortunately, the <file> in question is vendor supplied,
> ruling out a perl re-write.

I don't understand - if this is a vendor supplied file that the vendor
is expecting you to include in your Perl scripts surely they would
have told you what mechanism they were wanting you to use!

Is it possible that when you say "same behaviour" you actaully mean
"interpret the file as a script in a sh-like laguage".  That's not the
"same behaviour" - that's somethong quite different.

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

Subject: 
--text follows this line--


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

Date: Tue, 2 May 2000 09:50:24 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: CGI.pm and -w
Message-Id: <slrn8gtn90.4fb.tadmc@magna.metronet.com>

On Tue, 02 May 2000 10:00:09 -0400, Drew Simonis <care227@attglobal.net> wrote:
>> > I tried the following and it still prints a warning to the logs.
>> > Am I missing something?
>> >
>> > {
>> > local $^W = 0; #quiet warning that these variables only used once
>> > $CGI::POST_MAX=1024 * 1000;  # max 1M posts
>> > $CGI::DISABLE_UPLOADS = 1;  # no uploads
>> > }
>> 
>
>(Remember, Im still learning too, be nice)
>
>Would putting this in a BEGIN block disable warnings properly?


The issue is that you must turn off *all* warnings.

This includes the one you don't want to see, but it also
includes ones that you may _want_ to see, but won't see...


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 2 May 2000 09:01:02 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI.pm and -w
Message-Id: <Pine.GSO.4.10.10005020844000.13677-100000@user2.teleport.com>

On Tue, 2 May 2000, Drew Simonis wrote:

> > > {
> > > local $^W = 0; #quiet warning that these variables only used once
> > > $CGI::POST_MAX=1024 * 1000;  # max 1M posts
> > > $CGI::DISABLE_UPLOADS = 1;  # no uploads
> > > }
> > 
> > The 'used only once' message is a compile-time warning. You can't disable
> > it by turning off warnings at runtime. Not your fault; you were merely
> > given bad advice.
> 
> Hmm... I took that work around directly from Effective Perl 
> Programming, in the debugging section.

If I'm seeing the same page you are, you're right. The text of my copy
(page 143) says that you can "turn off warnings for a section of code" in
that way, but it should say that that applies only to run-time warnings
(since the assignment takes place at run time).

As I was a technical reviewer on this book, perhaps I should have caught
that. :-)  (To be sure, I don't recall whether I reviewed that particular
section; it's been several years. But I doubt that I would have spotted
that; it's subtle.) Oh, well!

Although it's possible to manipulate $^W at compile time to turn off some
compile-time errors, I don't _think_ that's useful for this one. And it
would probably turn off all used-only-once warnings, rather than just
the superfluous ones.

In this case, if it were needed, I'd probably use a line of code like this
one to do the declaration.

    { package CGI; use vars qw/ $POST_MAX $DISABLE_UPLOADS /; }

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 2 May 2000 16:27:32 GMT
From: mmarini@intesi-lab.com
Subject: Re: CGI: uploading binary files with IIS
Message-Id: <8emvlk$8h0$1@news.netmar.com>

In a previous article,  Jonathan Stowe  <gellyfish@gellyfish.com> writes:
---------
open(OUTFILE,">$basedir/$fileName")||die "Cant open $basedir/$fileName -
$!\n";
binmode OUTFILE;
while (my $bytesread = read($file, my $buffer, 1024)) 
{ 
      print OUTFILE $buffer; 
} 
close (OUTFILE); 
---------
Thanks for your reply but I'm sorry, I tried to put 'binmode' as you wrote
but... no changes.
What am I doing wrong?



     -----  Posted via NewsOne.Net: Free Usenet News via the Web  -----
     -----  http://newsone.net/ --  Discussions on every subject. -----
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: Tue, 02 May 2000 13:45:46 -0400
From: Richard Chen <qchen@snet.net>
Subject: Clear and then Reuse a package name space
Message-Id: <390F144A.A56BF02E@snet.net>

perlfaq7 shows 2 methods for clearing a package.
The methods work fine if the package will not be
reused in the same perl process. However, in some cases
a perl process may have to reuse the same package name space
many times. In those cases, the methods described do not work.

The following short program demonstrates the problem:

#!/usr/bin/perl -w
use strict;
use vars qw($template $text);
use Symbol qw(delete_package);
$template=q{ &hello(); $out="$in{first_name} $in{last_name}"; };
%Q::in=();
$Q::in{first_name}='Larry';
$Q::in{last_name}='Wall';
*Q::hello=\&hello;
$text=eval "no strict; package Q; $template";
print "eval failed: $@\n" if $@;
print "output is |$text|\n";
print "\n******now delete_package *********\n";
delete_package('Q');
%Q::in=();
$Q::in{first_name}='Larry';
$Q::in{last_name}='Ellison';
*Q::hello=\&hi;
$text=eval "no strict; package Q; $template";
print "eval failed: $@\n" if $@;
print "output is |$text|\n";
sub hello { print "hello\n"; }
sub hi { print "hi\n"; }

The output from the above program is:
hello
output is |Larry Wall|

******now delete_package *********
Subroutine hello redefined at ./bar.cgi line 18.
eval failed: Undefined subroutine &Q::hello called at (eval 2) line 1.

Use of uninitialized value at ./bar.cgi line 21.
output is ||

I am using perl 5.005_03.

The other method of using scrub_package is worse. It actually
undef the original subroutine.

Is it not possible to clear/reuse a package name space
with the current version of perl or there are other methods of
clearing/reusing a package that I don't know about?

Thanks for any info.

Richard


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

Date: Tue, 02 May 2000 17:54:50 GMT
From: richard_chen@my-deja.com
Subject: Clear and then Reuse a package name space
Message-Id: <8en4p0$hk1$1@nnrp1.deja.com>

perlfaq7 shows 2 methods for clearing a package.
The methods work fine if the package will not be
reused in the same perl process. However, in some cases
a perl process may have to reuse the same package name space
many times. In those cases, the methods described do not work.

The following short program demonstrates the problem:

#!/usr/bin/perl -w
use strict;
use vars qw($template $text);
use Symbol qw(delete_package);
$template=q{ &hello(); $out="$in{first_name} $in{last_name}"; };
%Q::in=();
$Q::in{first_name}='Larry';
$Q::in{last_name}='Wall';
*Q::hello=\&hello;
$text=eval "no strict; package Q; $template";
print "eval failed: $@\n" if $@;
print "output is |$text|\n";
print "\n******now delete_package *********\n";
delete_package('Q');
%Q::in=();
$Q::in{first_name}='Larry';
$Q::in{last_name}='Ellison';
*Q::hello=\&hi;
$text=eval "no strict; package Q; $template";
print "eval failed: $@\n" if $@;
print "output is |$text|\n";
sub hello { print "hello\n"; }
sub hi { print "hi\n"; }

The output from the above program is:
hello
output is |Larry Wall|

******now delete_package *********
Subroutine hello redefined at ./bar.cgi line 18.
eval failed: Undefined subroutine &Q::hello called at (eval 2) line 1.

Use of uninitialized value at ./bar.cgi line 21.
output is ||

I am using perl 5.005_03.

The other method of using scrub_package is worse. It actually
undef the original subroutine.

Is it not possible to clear/reuse a package name space
with the current version of perl or there are other methods of
clearing/reusing a package that I don't know about?

Thanks for any info.

Richard


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


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

Date: Tue, 02 May 2000 17:03:46 GMT
From: neo_20001@my-deja.com
Subject: Directory spaces causing problems?
Message-Id: <8en1p4$e4e$1@nnrp1.deja.com>

I have a directory named "School Trips", and my
CGI script has problems
writing to it.  In fact it simply doesn't write
the file, giving no errors
or anything.  I have checked the permissions on
directoray as well.  Does
anyone else have this problem? If so, how can I
fix it?

Thanks in advance,
John

PS I have talked to my tech support and she
seemed to think u inserted special characters
between the words, almost like "School+Trips"?



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


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

Date: Tue, 2 May 2000 10:19:25 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Directory spaces causing problems?
Message-Id: <Pine.GSO.4.10.10005021018400.13677-100000@user2.teleport.com>

On Tue, 2 May 2000 neo_20001@my-deja.com wrote:

> I have a directory named "School Trips", and my CGI script has
> problems writing to it.  In fact it simply doesn't write the file,
> giving no errors or anything.

Maybe you're not asking it to check for errors.

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.cpan.org/
   http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
   http://www.cpan.org/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 02 May 2000 15:26:59 GMT
From: larkus@my-deja.com
Subject: Expect.pm not performing as expected
Message-Id: <8ems3c$728$1@nnrp1.deja.com>

I am hoping someone with some experience using Expect.pm can lend some
advice. I am trying to automate an smbmount.

I expected the following code to smbmount a machine on my network, using
the given username.

If I manually type in the same command, it works. In other words, if I
type "smbmount //machine/share /mount/point -U username" on a command
line and enter my password at the prompt, i can do a "df" and see the
new mount.

However -- after I execute this script and do a "df", ain't nothin'
mounted.

I have included Debug info after the script. Personal variables (IP's,
passwds, machine names, etc) have been changed for this posting.

Thanks.


# ****************
## CODE         ##
# ****************
#!/usr/bin/perl -w
use strict;
use Expect;
$| = 1;
$Expect::Debug=3;
$Expect::Log_Stdout=1;
$Expect::Exp_Internal=1;
my $smb;
$smb = Expect->spawn("smbmount //machine/share /mount/point -U
username");

if ( $smb->expect(30, "Password: ") ) {
print $smb "my_password\r";
}
else {
die "Never got password prompt, " . $smb->exp_error() . "\n";




# ****************
## DEBUG OUTPUT ##
# ****************
Spawned 'smbmount //machine/share /mount/point -U username' (spawn
id(3))
        Pid: 8785
        Tty: /dev/ttya0
Beginning expect from spawn id(3).
Accumulator: ''
Expect timeout time: 30 seconds.
expect: Pty=spawn id(3), time=957275266, loop_time=30
Expecting from spawn id(3): 'Password: '
Does ''
from spawn id(3) match:
        pattern 1 ('Password: ')? No.
expect: handle spawn id(3) ready.
expect: read 76 byte(s) from spawn id(3).
Does 'Added interface ip=a.b.c.d bcast=a.b.c.255
nmask=255.255.255.0\r\n'
from spawn id(3) match:
        pattern 1 ('Password: ')? No.
expect: handle spawn id(3) ready.
expect: read 10 byte(s) from spawn id(3).
Does 'Added interface ip=a.b.c.d bcast=a.b.c.255
nmask=255.255.255.0\r\nPassword: '
from spawn id(3) match:
        pattern 1 ('Password: ')? Yes!
Matched pattern 1 ('Password: ')!
        Before match string: 'Added interface ip=a.b.c.d bcast=a.b.c.255
nmask=255.255.255.0\r\n'
        Match string: 'Password: '
        After match string: ''
Returning from expect successfully.
Accumulator: ''


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


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

Date: Tue, 02 May 2000 15:18:21 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: How to compare values between 2 arrays ?
Message-Id: <7au2ghq8ub.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


c_neak@my-deja.com writes:

> Hi all ,
> 
> Newbie in Perl , i don't know how to do that :
> I want to perform search in a file and i want to extract only some
> values which are in another array .

The FAQs outline some good ways to do that:

perlfaq4: How do I compute the difference of two arrays?  
          How do I compute the intersection of two arrays? 

--Ala


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

Date: 02 May 2000 17:35:03 +0100
From: nobull@mail.com
Subject: Re: How to compare values between 2 arrays ?
Message-Id: <u9zoq8ap1k.fsf@wcl-l.bham.ac.uk>

c_neak@my-deja.com writes:

> Hi all ,
> 
> Newbie in Perl , i don't know how to do that :
> I want to perform search in a file and i want to extract only some
> values which are in another array .

FAQ: "How can I tell whether a list or array contains a certain element?"

> My code in Perl...

 ...looks familiar.  You've posted this before.  We've told you what's
wrong with it before.  You have ignored us.  What point is there in us
trying to help you?

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


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

Date: Tue, 02 May 2000 17:16:44 GMT
From: ogmandrake@my-deja.com
Subject: Re: How to simulate a post request ?
Message-Id: <8en2h8$eu0$1@nnrp1.deja.com>

I have been contemplating this and it seems to me that it may be
possible to send the data using hidden fields and a redirection.  You
could include a piece of javascript into your code to send it
automatically onLoad kinda thing.

In article <8cmm36$m3t$1@nnrp1.deja.com>,
  ogmandrake@my-deja.com wrote:
> I would like to know where you need to use this it seems to me that
> there is some redundancy redirecting the data and then picking it up
> again.  Why not internalise all the functions into a single script.
The
> only reason that I can see for a redirection script in the middle is
if
> you need to send the data to seperate machines for processing in an
> effort to load share a high volume site.  If you put all of that
script
> into one script then you can just send the process right through.
Using
> the "sub" commands and either hidden command fields to read where the
> data should be directed upon calling the script or using a get to pass
> the redirection to the script.
>
> Is that what you are getting at or do you have something else in mind?
>
> Jeff Rickard
>
> In article <8arqal$cig$1@nnrp1.deja.com>,
>   napa1999@yahoo.com wrote:
> > Hi:
> >
> > I'm trying to figure out how I can simulate a post request in perl.
> What
> > I'm trying to do is the following:
> >
> > web_form1 -post-> redirect_script (no UI) -post-> [script1(no UI -
> > displays either a successful or unsuccessful response) or web_form2]
> >
> > The problem that I'm trying to figure out is how I simulate a post
> > request so that script1 can get the data that was filled out in
> > web_form1.
> >
> > I have thought about using "exec" but that does not work since I
> believe
> > exec generates a process in the background. I keep getting a
"document
> > returned no data error" which I believe is what redirect_script is
> > returning since it does not print anything to the user's screen.
> >
> > Any ideas ? Thanks for your help in advance.
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Tue, 2 May 2000 09:27:58 -0500
From: "Tim Cuffel" <tcuffel@exactis.com>
Subject: Re: How to test perl CGI scripts on my computer first?
Message-Id: <mfCP4.1864$jY2.257916@den-news1.rmi.net>

Bernie Cosell wrote in message ...
>tadmc@metronet.com (Tad McClellan) wrote:
>
>} On Sun, 30 Apr 2000 07:05:15 -0400, Ryan & Treena Carrier <ryanc@nci1.net> wrote:
>} >I'm trying to figure out how to set my computer up so I can write some CGI
>} >scripts in Perl and test them on my computer before posting them to my
>} >internet web server.
>}
>}
>} Since you are using CGI.pm, you can get one level of testing
>} by running your CGI program from the command line, and entering
>} form values yourself (or redirect them from a file).
>}
>} To get the most realistic testing environment, you need to
>} get a WWW server installed.
>
>Actually, I've found that you don't need the server at all [at least not a
>local one] --- run the CGI, feeding it the environment/form/vbl stuff it
>needs, collect the output as some suitable file ['cgiout.html' or some
>such].  Then you can eyeball the HTML output, or just view it locally [I
>believe that all browsers allow you to view 'local' HTML files directly,
>without need of an actual server.


And you test forms this way?  How about multiple interacting pages?

-T




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

Date: Tue, 2 May 2000 09:15:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to test perl CGI scripts on my computer first?
Message-Id: <slrn8gtl77.46i.tadmc@magna.metronet.com>

On Tue, 02 May 2000 09:19:44 -0400, Bernie Cosell <bernie@fantasyfarm.com> wrote:
>tadmc@metronet.com (Tad McClellan) wrote:

>} Since you are using CGI.pm, you can get one level of testing
>} by running your CGI program from the command line, and entering
>} form values yourself (or redirect them from a file).
>} 
>} To get the most realistic testing environment, you need to
>} get a WWW server installed.
>
>Actually, I've found that you don't need the server at all [at least not a
>local one] --- run the CGI, 
                ^^^^^^^^^^^

You mean "run the CGI program from the command line", it is 
*not* running under the CGI (read: "not completely realistic").


>feeding it the environment/form/vbl stuff it
>needs, collect the output as some suitable file ['cgiout.html' or some
>such].  Then you can eyeball the HTML output, or just view it locally [I
>believe that all browsers allow you to view 'local' HTML files directly,
>without need of an actual server.


But that is not "most realistic" as it will not show problems
relating to environment such as cwd, PATH, etc....

Of course, when you get a server, you have to configure it like
the "target server" to see those problems locally.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 02 May 2000 19:11:43 +0200
From: Michael Sternberg <sternberg@phys.uni-paderborn.de>
Subject: Re: I goofed
Message-Id: <390F0C4F.EDC620E@phys.uni-paderborn.de>

Tapio Luukkanen wrote:
> So, does anyone have or know about a script which can compare the
> contents of two directory trees, say A and B, and set the timestamps
> of files in A to those of the respective files in B, if the file
> contents are identical ?

A shell solution:  if you have (a) civilised filenames and (b) the trees ARE
identical:

    cd /goofed/dir; find . | xargs -n1 -i touch -r /backup/dir/'{}' '{}'

You may want to echo first instead of touch blindly.

If the conditions don't hold:  (a) - sprinkle with some more quotes; (b) - if
the referenced file doesn't exist in the backup, the point is moot.


Regards,
-- 
Michael Sternberg                        | Uni-GH Paderborn
http://www.phys.uni-paderborn.de/~stern/ | FB6 Theoretische Physik 
phone: +49-(0)5251-60-2329   fax: -3435  | 33098 Paderborn, Germany
"Who disturrrbs me at this time?"  << Zaphod Beeblebrox IV >>	<*>


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

Date: Tue, 2 May 2000 09:35:34 -0500
From: "Tim Cuffel" <tcuffel@exactis.com>
Subject: Re: Javascript call Perl CGI
Message-Id: <nmCP4.1871$jY2.258010@den-news1.rmi.net>

schnurmann@my-deja.com wrote in message <8ekrd4$pq$1@nnrp1.deja.com>...
>How might a Javascript call a CGI Perl script?  I have two buttons that
>are not part of a form.  if the user clicks on either, a function is
>called by the browser to verify the user's intentions, and if ok, will
>call a CGI Perl script passing one parameter.


No magic here.  If your script can print,

<script language="JavaScript">

document.write("<h1>Hi, mom!</h1>");

</script>

then you can do JavaScript, no matter what language you are using
for CGI.

Note this is not a Perl question.  In future, please consider posting
to a different group, such as comp.infosystems.www.authoring.cgi.








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

Date: Tue, 02 May 2000 16:17:21 GMT
From: schnurmann@my-deja.com
Subject: Re: Javascript call Perl CGI
Message-Id: <8emv1u$ak2$1@nnrp1.deja.com>

I am not sure to what question you wrote your answer, but it wasn't
mine.

In article <nmCP4.1871$jY2.258010@den-news1.rmi.net>,
  "Tim Cuffel" <tcuffel@exactis.com> wrote:
> schnurmann@my-deja.com wrote in message <8ekrd4
$pq$1@nnrp1.deja.com>...
> >How might a Javascript call a CGI Perl script?  I have two buttons
that
> >are not part of a form.  if the user clicks on either, a function is
> >called by the browser to verify the user's intentions, and if ok,
will
> >call a CGI Perl script passing one parameter.
>
> No magic here.  If your script can print,
>
> <script language="JavaScript">
>
> document.write("<h1>Hi, mom!</h1>");
>
> </script>
>
> then you can do JavaScript, no matter what language you are using
> for CGI.
>
> Note this is not a Perl question.  In future, please consider posting
> to a different group, such as comp.infosystems.www.authoring.cgi.
>
>


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


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

Date: Tue, 2 May 2000 10:19:00 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Javascript call Perl CGI
Message-Id: <8en2lb$ivl$1@brokaw.wa.com>


<schnurmann@my-deja.com> wrote in message
news:8emv1u$ak2$1@nnrp1.deja.com...
> In article <nmCP4.1871$jY2.258010@den-news1.rmi.net>,
>   "Tim Cuffel" <tcuffel@exactis.com> wrote:
> > schnurmann@my-deja.com wrote in message <8ekrd4
> $pq$1@nnrp1.deja.com>...
> > >How might a Javascript call a CGI Perl script?
> >
> > Note this is not a Perl question.  In future, please consider posting
> > to a different group, such as comp.infosystems.www.authoring.cgi.
> >
> >
> I am not sure to what question you wrote your answer, but it wasn't
> mine.
>

You are asking a CGI question (how to pass a parameter to a CGI program), so
asking it in a CGI newsgroup would get you much more information than asking
here would.

Lauren




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

Date: Tue, 02 May 2000 12:29:17 -0500
From: Donald Lancon <lancon@mail.ce.utexas.edu>
Subject: making croak _not_ act like confess
Message-Id: <390F106D.A47743DB@mail.ce.utexas.edu>

In Perl, the Carp module gives you a way of making croak() behave like
confess():

  perl -MCarp=verbose script.pl

or (for example):

  use Carp qw(:DEFAULT verbose);

or by including "MCarp=verbose" in the PERL5OPT environment variable
(see Carp documentation).

Somehow, on my Perl (ActivePerl 5.6.0, build 613, on Win NT 4.0) this
behavior is enabled by default:

  C:\>perl -e "use Carp; sub a{confess 'foo'} &a;"
  foo at -e line 1
          main::a called at -e line 1
  
  C:\>perl -e "use Carp; sub a{croak 'foo'} &a;"
  foo at -e line 1
          main::a called at -e line 1

But I want croak() to behave like croak()!

There is no PERL5OPT environment variable and I don't see anything in
'perl -V' that would indicate why it's doing this (reformatted to fit 72
columns):

  Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
    Platform:
      osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
      uname=''
      config_args='undef'
      hint=recommended, useposix=true, d_sigaction=undef
      usethreads=undef use5005threads=undef useithreads=define
  usemultiplicity=define
      useperlio=undef d_sfio=undef uselargefiles=undef 
      use64bitint=undef use64bitall=undef uselongdouble=undef
  usesocks=undef
    Compiler:
      cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
      cppflags='-DWIN32'
      ccflags ='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
  -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
  -DPERL_MSVCRT_READFIX'
      stdchar='char', d_stdstdio=define, usevfork=false
      intsize=4, longsize=4, ptrsize=4, doublesize=8
      d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
      ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
  lseeksize=4
      alignbytes=8, usemymalloc=n, prototype=define
    Linker and Libraries:
      ld='link', ldflags ='-nologo -nodefaultlib -release
  -libpath:"C:\Perl\lib\CORE"  -machine:x86'
      libpth="C:\Perl\lib\CORE"
      libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
  odbc32.lib odbccp32.lib msvcrt.lib
      libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
    Dynamic Linking:
      dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
      cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
  -libpath:"C:\Perl\lib\CORE"  -machine:x86'
  
  
  Characteristics of this binary (from libperl): 
    Compile-time options: MULTIPLICITY USE_ITHREADS
  PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
    Locally applied patches:
    	ActivePerl Build 613
    Built under MSWin32
    Compiled at Mar 24 2000 12:36:25
    @INC:
      C:/Perl/lib
      C:/Perl/site/lib
      .

Using Exporter's verbose mode, I get (again, reformatted slightly):

  C:\>perl -e "BEGIN{$Exporter::Verbose=1} use Carp; sub a{croak 'foo'}
  &a;"
  Carp::EXPORT_FAIL cached: verbose &verbose at
  C:/Perl/lib/Exporter/Heavy.pm line 141
          Exporter::heavy_export('Carp', 'main') called at
  C:/Perl/lib/Exporter.pm line 35
          Exporter::import('Carp') called at -e line 1
          main::BEGIN() called at C:/Perl/lib/Carp.pm line 1
          require 0 called at C:/Perl/lib/Carp.pm line 1
  Importing into main from Carp: carp, confess, croak at
  C:/Perl/lib/Exporter/Heavy.pm line 160
          Exporter::heavy_export('Carp', 'main') called at
  C:/Perl/lib/Exporter.pm line 35
          Exporter::import('Carp') called at -e line 1
          main::BEGIN() called at C:/Perl/lib/Carp.pm line 1
          require 0 called at C:/Perl/lib/Carp.pm line 1
  foo at -e line 1
          main::a called at -e line 1

Hmm.  What does "Carp::EXPORT_FAIL cached: verbose &verbose at
C:/Perl/lib/Exporter/Heavy.pm line 141" mean?

I've tried specifying "use Carp qw(!verbose)", "perl -MCarp=!verbose
 ...", and "BEGIN {undef $Carp::Verbose}".  None of these make a bit of
difference; croak() still behaves like confess().

So what's the obvious thing I'm not seeing here?

-- 
Donald Lancon


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

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


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