Re: help with open function

2001-12-11 Thread Carl Franks

Also note that the file path is relative to the script that is being run, 
not where your perl executable is.

e.g.
if perl is at
e:\perl\bin\perl.exe

and your script is at
e:\scripts\myScript.cgi

and the file is
e:\workflow.txt

then the path needs to read
   open("Workflow", "..\workflow.txt")|| die "Cannot open Workflow $!\n";


Carl

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Hash of Hashes to set up form

2001-12-11 Thread Marcus Willemsen


>Curtis,


Thanks a lot for your help, it works perfectly and it isn't harder to 
maintain than the solutions I have tried out so far.

Marcus


>=
>Senior Programmer
>Onsite! Technology (http://www.onsitetech.com/)
>"Ovid" on http://www.perlmonks.org/
>
>__
>Do You Yahoo!?
>Send your FREE holiday greetings online!
>http://greetings.yahoo.com

Marcus Willemsen
Online Redaktion
Juve Verlag
Agrippastr. 10
50676 Köln

tel: ++49(0)221 91 38 80 16
fax: ++49(0)221 91 38 80 18
www.juve.de
[EMAIL PROTECTED]
[EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: accessing ASP functionality through Perl/CGI

2001-12-11 Thread MARCOS LABORDE

#!/usr/bin/perl

#I once had the same problem, an NT server running a webpage that made a POST request 
to an app passing values USER,FRM,MSG and SEND to it.
#here's the code.

use strict;
use LWP::Simple;
use URI::URL;
my $content;
my $url=url('http://your_NT_webserver_address/scripts/webgate.exe'); #This is where 
the script resides in the NT server...where the webpage in that server is pointing 
with the POST request
$url->query_form( USER => 'value1', FRM => 'value2', MSG => 'value3', SEND => 
'value4');
$content=get($url);

>>> "Molly Magai" <[EMAIL PROTECTED]> 12/10/01 05:11PM >>>
Does anyone know how to have a cgi script send a POST request to an
unrelated Web page?

Here's why: We're getting a new NT server. We currently run our pages on
CGI scripts, but we're planning to move all our hosting to ASP in the
next few months. In the meanwhile, we'll be running CGI on the new
server. Since ASP has a built-in mail function, my boss doesn't want to
go to the trouble/expense of installing SendMail on the new server for
the interim period. He has the idea that we can somehow have the CGI
scripts access an ASP page (perhaps through a POST request, but whatever
would work) and send email through ASP. I'm not doing the server
administration, but I do some scripting in Perl/CGI, and have been asked
to investigate this possibility.

I'd love to hear from anyone who has the experience to tell me: Is my
boss brilliant, or crazy? Can this be done, and if so, how?

(By the way, i'm aware that cheaper alternatives to SendMail exist -
we're looking into that too.)

Molly Magai
SurveyHost/Apian Software
(206) 547-5321 X 11 

--
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: script doesn

2001-12-11 Thread Mark Bergeron

Have you set up your cert on the server?

-Original Message-
From: "Alex Chau"<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Mon Dec 10 20:21:24 PST 2001
Subject: script doesn't work under https but works under http???

>hi everybody,
>
>I have posted a script to my server, and it works properly if I use 
>http://blarblar/cgi-bin/test.pl,
>but if I use https://blarblar/cgi-bin/test.pl with SSL, the browser will 
>display the text instead of execute it.
>
>Can anyone tell me what's the possible problem?
>
>Thanks in advance.
>
>Alex
>
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


___
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Array Help Please:)

2001-12-11 Thread Andre` Niel Cameron

Hi,

I have a prob:)  I need to search threw an array and remove an item based on
its name.  I was thinking about maybie a for each loop but I am not sure how
to go about it.  Heres what I need to do:

say $object= sword;
I have an array @AllObjects('beer', 'nuts', 'sword', 'and more stuff')
Now sword may or may not ever be in the same location of the array so a
simple shift will not work here.  I need to find a way to pull sword out of
that array.  Any help is as always greatly appreciated:)
Regards,
Andre` C.
Technical Support
ԿԬ

-
Visit our support manual at http://supportmanual.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Array Help Please:)

2001-12-11 Thread Jan-Willem Haaring

Hi,

This is a possible solution:

$object = "sword";

foreach(@AllObjects) {
  if (/$object/) { next; };
  push(@temp,$_);
}

@AllObjects = @temp;

- JW

On Tue, 11 Dec 2001, Andre` Niel Cameron wrote:

> Hi,
>
> I have a prob:)  I need to search threw an array and remove an item based on
> its name.  I was thinking about maybie a for each loop but I am not sure how
> to go about it.  Heres what I need to do:
>
> say $object= sword;
> I have an array @AllObjects('beer', 'nuts', 'sword', 'and more stuff')
> Now sword may or may not ever be in the same location of the array so a
> simple shift will not work here.  I need to find a way to pull sword out of
> that array.  Any help is as always greatly appreciated:)
> Regards,
> Andre` C.
> Technical Support
> ԿԬ
> 
> -
> Visit our support manual at http://supportmanual.com/
>
>
>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Array Help Please:)

2001-12-11 Thread Bob Showalter



> -Original Message-
> From: Andre` Niel Cameron [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 11, 2001 9:18 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Array Help Please:)
> 
> 
> Hi,
> 
> I have a prob:)  I need to search threw an array and remove 
> an item based on
> its name.  I was thinking about maybie a for each loop but I 
> am not sure how
> to go about it.  Heres what I need to do:
> 
> say $object= sword;
> I have an array @AllObjects('beer', 'nuts', 'sword', 'and more stuff')
> Now sword may or may not ever be in the same location of the 
> array so a
> simple shift will not work here.  I need to find a way to 
> pull sword out of
> that array.  Any help is as always greatly appreciated:)

To remove all occurences of 'sword', you can use:

   $a[$_] eq 'sword' && splice(@a,$_,1) for 0..$#a;

or even

   @a = grep { $_ ne 'sword' } @a;

If you're doing a lot of this kind of thing, you need to investigate
whether a hash might be a better way to store this data.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Array Help Please:)

2001-12-11 Thread Bob Showalter

> -Original Message-
> From: Bob Showalter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 11, 2001 9:40 AM
> To: 'Andre` Niel Cameron'
> Cc: [EMAIL PROTECTED]
> Subject: RE: Array Help Please:)
> 
> ...
> To remove all occurences of 'sword', you can use:
> 
>$a[$_] eq 'sword' && splice(@a,$_,1) for 0..$#a;

Actually, this doesn't remove adjacent appearances of sword. Need
something like this:

 $a[$_] eq 'sword' && (splice(@a,$_,1), redo) for 0..$#a;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




help with outputting information

2001-12-11 Thread Lance Prais


I am opening a file and just want to check to make sure that the file is
being read correctly therefore I am using the following piece of code but
getting an error message but according to what I have read it is formatted
correctly.

1. #/usr/bin/perl
2. #open a file with the filehandle
3.
4.
5. open WORKFLOW, "..\\..\\workflow.txt"  or die "Cannot open Workflow
$!\n";
6.  While (){
7.  #chomp;   #a)
8.   my $line=$_;
9.  Print STDRR "\nline: $line";
10. }


ERROR MESSAGE:
syntax error at test line 6, near "){"
Can't use global $_ in "my" at test line 8, near "=$
syntax error at test line 10, near "}"
Execution of test aborted due to compilation errors.


Does anyone know what I am doing wrong?

Thank you


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: help with outputting information

2001-12-11 Thread Bob Showalter

> -Original Message-
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 11, 2001 12:55 PM
> To: [EMAIL PROTECTED]
> Subject: help with outputting information
> 
> 
> 
> I am opening a file and just want to check to make sure that 
> the file is
> being read correctly therefore I am using the following piece 
> of code but
> getting an error message but according to what I have read it 
> is formatted
> correctly.
> 
> 1. #/usr/bin/perl
> 2. #open a file with the filehandle
> 3.
> 4.
> 5. open WORKFLOW, "..\\..\\workflow.txt"  or die "Cannot open Workflow
> $!\n";
> 6.While (){
> 7.#chomp;   #a)
> 8. my $line=$_;
> 9.Print STDRR "\nline: $line";
> 10.   }
> 
> 
> ERROR MESSAGE:
> syntax error at test line 6, near "){"
> Can't use global $_ in "my" at test line 8, near "=$
> syntax error at test line 10, near "}"
> Execution of test aborted due to compilation errors.
> 
> 
> Does anyone know what I am doing wrong?

While => while
Print => print
STDRR => STDERR

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




src with Perl

2001-12-11 Thread Lupo

(Sorry for my English...)

Can I request an image-path with Perl?

...





Re: src with Perl

2001-12-11 Thread Curtis Poe

--- Lupo <[EMAIL PROTECTED]> wrote:
> (Sorry for my English...)
> 
> Can I request an image-path with Perl?
> 
> ...

Yes.  There are two ways to deal with this.  One is to have your perl script redirect 
the browser
to the location of the image:

#!/usr/bin/perl -wT
print "Location:  /path/to/image\n\n";

The other is to dynamically generate the image.  Let's say that this is the HTML:



Note that the attribute value is quoted!  It's not important in this example, but it's 
easy to
have problems with that in the future.  

We can use this in our code (untested):

#!/usr/bin/perl -wT
use strict;
use CGI qw/:standard/;
use constant IMAGE_DIR => '../images/';

my @images = qw/ default.gif one.gif two.gif three.gif four.gif /;

my $image  = param( 'image' )  || 0; # use default if no param
( $image ) = ( $image =~ /^([0-4])$/ ) || 0; # untaint or assign default
$image = IMAGE_DIR . $images[$image];

open IMAGE, "< $image" or die "Cannot open $image for reading: $!";
binmode IMAGE_FILE; # In case we're on Windows
print header( 'image/gif' );
print ;
close IMAGE;

The untainting will seem weird if you're not used to it.  Read 'perldoc perlsec' for 
more
information on this.

Hope that helps.

Cheers,
Curtis "Ovid" Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




cgi call cgi program or URL

2001-12-11 Thread Tat Nam

Hi,
   Does anybody tell how to call another CGI program within a CGI script?  Is it 
possible to include a hyper link within a CGI script?  How?

Tat Nam






RE: cgi call cgi program or URL

2001-12-11 Thread Herbold, John W.

Unless I am tottaly missing your question...

print "Click here
";

should do it, then inside of newprogram.pl you can read in the var1, and
var2. You could also
use a form if you wanted to pass dynamic parameters.

John Herbold

-Original Message-
From: Tat Nam [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 11, 2001 10:50 AM
To: Beginners Perl
Subject: cgi call cgi program or URL


Hi,
   Does anybody tell how to call another CGI program within a CGI script?
Is it possible to include a hyper link within a CGI script?  How?

Tat Nam




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Dynamic html/frames frm PERL not working

2001-12-11 Thread David Gilden

Duh, I found the problem,

Perl comment was in side of the 'here' doc
script works fine now,

Dave


# HTML Page out
print header;

print 
Frame Setter for \u$pageName


old code with mistake

print header;

print 
Frame Setter for \u$pageName


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




What do you think is better

2001-12-11 Thread Lance Prais


I have a question and I was wondering if anyone had an opinion on it.  I am
using a perl script to parse through a log file and if there is an error
found I need to send and email to someone..


I was thinking about calling an ASP page and passing, the relevant
information and when this page is called generate and send the email.  Is it
possible to just do this all with perl?  If so can someone recommend a site
or direction?   I have looked on all the major sites and have not been able
to find anything that references this concept.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: What do you think is better

2001-12-11 Thread Herbold, John W.

Here is one that I wrote to parse a WebServer log file, and look for 
what ever the user typed in.  It will then display the records that
matched.  It would be easy to change and mail out the results using
sendmail...  Let me know if you have any questions

John

#! perl -w
use CGI;

my $query = new CGI;
print $query->header;
print $query->start_html("Parse Web Log");
print "";

get_vars();
get_file();
if ($match_count > 0 ) {if ($REC) {view_detail()} else {view_data();} } 
else {$msg="No matches found for $search$total_count lines searched";
enter_date();}

sub get_vars {
$date   = $query->param('DATE');
$search = $query->param('SEARCH');
$REC= $query->param('REC');
$search = uc($search);
if ($date) {} else {enter_date();}
$year  = substr($date,2,2);
$month = substr($date,5,2);
$day   = substr($date,8,2);
$logfile = 'ex' . "$year" . "$month" . "$day" . '.log';
}


sub enter_date {
 print "";
 print "\n";
 print "\n";
 print "\n
";
 print "\n";
 print "Search Web Logs";
 print "$msg";
 print "Date to Search 
";
 print "String to Look For 
";
 print "\n ";
 print "";
 print "\n";
 print "\n ";
 print "\n";
 exit;
}

sub get_file {

$file = "c:/winnt/system32/logfiles/w3svc1/$logfile";
$total_count=0;
$match_count=0;
open(LOGFILE,$file); 
while (LOGFILE) {
 $total_count++; 
 $line = ;
 if ($line eq "") { last};
 $linetest = uc($line);
 $test = $linetest =~ m"$search";
 if ($test >0) {$match_count++; @LINE[$match_count] = $line;}
}
close(LOGFILE);
}

sub view_data {
 print "";
 $rec=0;   $date = '';   $htime = '';
$c_ip = '';   
 $cs_username = '';$s_sitename = ''; $s_computername = '';
$s_ip = ''; 
 $s_port = ''; $cs_method = '';  $cs_uri_stem = '';
$cs_uri_query = ''; 
 $sc_status = '';  $sc_win32_status = '';$sc_bytes = '';
$cs_bytes = ''; 
 $time_taken = ''; $cs_version = ''; $cs_host = '';
$cs_User_Agent = '';
 $cs_Cookie = '';  $cs_Referer = '';

 print " Rec ";
 print " Date ";
 print " Time "; 
 print " Client "; 
 print " Client Name "; 
 print " Method "; 
 print " URI "; 
 print " Status ";
 print " Win32 Status  ";
 print " SC Bytes ";
 print " CS Bytes ";
 print " Time Taken ";
 
 while ($rec <= $match_count) {
$rec++;
($date, $htime, $c_ip, $cs_username, $s_sitename, $s_computername,
$s_ip, $s_port, $cs_method, $cs_uri_stem, $cs_uri_query, $sc_status,
$sc_win32_status, $sc_bytes, $cs_bytes, $time_taken, $cs_version, $cs_host,
$cs_User_Agent, $cs_Cookie, $cs_Referer) 
= split(m"\s",@LINE[$rec]);
print "$rec";
print "$date "; 
print " $htime "; 
print " $c_ip "; 
print " $cs_username "; 
print " $cs_method "; 
print " $cs_uri_stem "; 
print " $sc_status ";
print " $sc_win32_status  ";
print " $sc_bytes ";
print " $cs_bytes ";
print " $time_taken ";
}
 print "";
exit;   
}

sub view_detail {
 print "";
 ($date, $htime, $c_ip, $cs_username, $s_sitename, $s_computername,
$s_ip, $s_port, $cs_method, $cs_uri_stem, $cs_uri_query, $sc_status,
$sc_win32_status, $sc_bytes, $cs_bytes, $time_taken, $cs_version, $cs_host,
$cs_User_Agent, $cs_Cookie, $cs_Referer) 
= split(m"\s",@LINE[$REC]);
print "Date   
$date "; 
print "Time   
$htime "; 
print "Client 
$c_ip "; 
print "User   
$cs_username "; 
print "Site   
$s_sitename "; 
print "Server 
$s_computername "; 
print "Server IP  
$s_ip "; 
print "Server Port
$s_port "; 
print "Method 
$cs_method "; 
print "STEM   
$cs_uri_stem "; 
print "Query  
$cs_uri_query ";
print "Status 
$sc_status ";
print "Win32 Status   
$sc_win32_status  ";
print "S -> C Bytes   
$sc_bytes ";
print "C -> S Bytes   
$cs_bytes ";
print "Time   
$time_taken ";
print "Client Version 
$cs_version ";
print "Client Host
$cs_host ";
print "Client Agent   
$cs_User_Agent ";
print "Client Cookie  
$cs_Cookie ";
print "Referer
$cs_Referer \n";
print "";
exit;   
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: src with Perl

2001-12-11 Thread Mark Bergeron

Great for counter scripts.

-Original Message-
From: "Lupo"<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Tue Dec 11 09:22:29 PST 2001
Subject: src with Perl

>(Sorry for my English...)
>
>Can I request an image-path with Perl?
>
>...
>
>


___
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: cgi & form again

2001-12-11 Thread zentara

On Tue, 11 Dec 2001 15:17:01 +0800, [EMAIL PROTECTED] (Tat Nam) wrote:

>Hi,
>   The following scripts processes the form and write somthings out and then
>allow the user to input his/her e-mail address.  After input of the e-mail
>address, the script write it into a flat file.  However, the script runs
>into trouble.

Hi, I got your script to run, but I had to put a "my" in front
of your first $smoking var, and it needed a } at the end of the file.

Post the html form that calls this, or I can't fiddle anymore.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl modules on web host server

2001-12-11 Thread Jack Daly



On Sat, 8 Dec 2001, Hoenie Luk wrote:

> Hi, I'm new to cgi-programming with Perl and I've been looking for answers 
> for the following questions:
> 
> 1. How do you find out if the web host supports certain Perl modules?
> 
> 2. If the web host does not have certain modules installed and I need to 
> use them for my Perl cgi-script, what can I do?
> 

I'm guessing you're talking about your ISP as your web host, if so, the
only way I know how to do it is to actually put the "use" statement in an
cgi script and see if it works. Like:

test.pl


#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use ?::Module;

print header, start_html("test"), h1("Add test.");

-

Where "?::Module" is the one you need. Bit of a long way to go, but
the server will let you know if the module you need isn't installed.  
If it's not, what you could do is:

1.  Download and install the module on your home machine

2. Copy all the subroutines from the module (or just the subroutines you
actually need into your cgi script.  Again, a long way to go, but it
worked for me. You could use:

perldoc -m ?::Module > test.cgi

Substitute your own headers, and put your code after the subroutines,
delteing everything else.  Should work the same the same as using the
module.  In my case it worked fine with Sort::Fields

good luck,

Jack Daly



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]