Re: CGI value is not getting passed

2011-04-18 Thread Bill Luebkert
On 4/18/2011 8:36 PM, A F wrote:
 Hi All,
 I writting some cgi script on window running Apache.
 I am having probelem getting the value on the entry box when I use 
 ID=userid ( input type=text id=userid/ )
 But if I use NAME=userid ( input type=text name=userid/ ), the value 
 getting passed but my autocompletion stop working.
 Any idea how can I pass my variable using ID ?

name is the proper filedname to pass to the CGI not id, id is for CSS use.
Can't you just put both in there ? :

The normal way to input a username:

input type=text name=userid value=

can easily append the id keyword too for manipulation (not for CGI
purposes):

input type=text id=userid name=userid value=
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: File won't upload

2008-09-30 Thread Bill Luebkert
fREW Schmidt wrote:
 Hello all,
 
 I am having the weirdest problem and no one seems to have any idea what 
 it is; so maybe you (the internet :-)  will.  Here is the problem:
 
 I am trying to upload a CSV and process it.  I have some dummy code to 
 just print the contents of the file to the log and nothing is working.  
 Here is the code:
 
 my $uploadHandle = $Input-upload(File);
 
 while($uploadHandle) {
 warn $_;
 }
 
 On the same server I have very similar code and that *does* work.  
 Furthermore the server does know the filename and firebug clearly shows 
 the contents of the file getting sent to the server.  Does anyone have 
 any ideas of what could cause this?

Guess what - those 3 lines of code won't upload anything.  How about stripping
your script down to the basics and change the URL/passwords to something generic
and re-post so we have something to work with.  We need complete scripts with
warnings and strict turned on preferably.  Run the script locally before posting
and then cut-n-paste it into your email.  Keep it small and complete and 
indicate
how it fails exactly.
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Performance Issues

2008-09-04 Thread Bill Luebkert
fREW wrote:
 Hello all,
 
 I am having some pretty major performance issues on a certain page of
 mine.  Our site is driven by perl, IIS6, and MS SQL Server.  Does
 anyone have any good tips or tools on finding out what is causing the
 issue, like a profiler that will work on IIS?

You could start by timing the script and seeing how long it takes.

I would first open a log file and then add the log file's FH to the
prints below or do something similar:

our ($pt0, $timeit); BEGIN { $timeit = 0; } # time the script
BEGIN { if ($timeit) { print scalar (localtime), \n;
  $pt0 = Win32::GetTickCount (); } }
END { if ($timeit) { print scalar (localtime);
  printf  - %.3f seconds\n, (Win32::GetTickCount () - $pt0) / 1000; } }

If the script isn't taking excessive time, then you'll need to look
at your server docs for help.  If the script is taking a lot of time,
you could look at some of the debug profiling modules that are available
with Perl (eg: Devel::DProf).
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: PerlIS and PerlEx blocked, but by what? Bug?

2008-01-21 Thread Bill Luebkert
Henning Michael Møller Just wrote:
 Hi everyone
 
 My first post here in many years, and this time it's with a very strange 
 problem.
 
 (I tried to post this on the perlex-mailinglist but that didn't respond, then 
 sending it directly to Jan but he's probably busy).
 
 We are experiencing a problem when a PerlEx or PerlIS script is printing the 
 response to the client. The problem is that the script acts as if the print 
 statement is blocking and stays blocked for as much as 200 seconds. Mostly 
 it's around 50-80 seconds. It happens every once in a while and provided the 
 conditions are right it is practically every second time.
 
 I know that it's the print statement that is blocked since a simple 'warn 
 time();' before and after reveals the time spent there.
 
 We only experience this on our Win2k3 servers (running ActivePerl 820) and 
 not on our older Win2k servers or our development machines (Win2k pro and 
 WinXP pro).
 
 Originally we thought the problem was with our own code (looping or fetching 
 data from the database), but finally I managed to make a test case which 
 didn't do anything but print. Essentially just HTML, but there are a couple 
 of strange things in that.
 
 First of all, it only blocks if there is a certain combination of HTML tags 
 and text in the print statements. Very strange. Then it only blocks if there 
 is a small delay between two print statements (about 0.0085 seconds), at a 
 point where we originally were fetching some data from the database.
 
 I can't send you the HTML since our client should not be disclosed, and if I 
 remove or change too much of the text, the script doesn't block! Which 
 doesn't make sense.

Why not just replace each word that would identify the client with some garbage,
test it to see if it fails and post it ?  Hopefully some readers will give it a 
try
and maybe help isolate the problem.  I've never used IIS, PerlIS/Ex, so doubt I
could be much help unless there's something obvious.

 I am thinking - since this error only has occurred on our IIS6 servers - that 
 it could be something to do with the IIS5 to IIS6 changes (sending packages 
 as soon as possible etc). But I am also thinking it could be something to do 
 with the way the server may be trying to interpret the content of the file - 
 otherwise why would the behaviour change if I substituted a couple of HTML 
 tags with a string of the same length, but just text?

Could be a buffer length/boundary issue or some such obscure thing.

 We have tested this with different clients (MSIE + FF) and the behaviour is 
 the same.

Which leads you back to the server.  Have you tried Apache (if it's possible
with your setup) ?

___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: get html source from web page blocked mouse right button.

2007-09-04 Thread Bill Luebkert
Chang Min Jeon wrote:
 hello,
 
 i want to get html source from web page blocked mouse right button.
 
 how to do that ?

What browser are we talking about ?

If you're using a decent browser there should be a hotkey.

On Thunderbird, use Ctrl-U or the View pulldown menu.
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: having a html button/check box call a perl subroutine

2007-07-26 Thread Bill Luebkert
[EMAIL PROTECTED] wrote:
 I don't think it is possible to just run something in the script without
 refreshing the page (reloading the script), however knowing the ingenuity
 of full-time Perl hackers I would not be surprised if someone has figured
 out how to do something similar.

I haven't tried anything like this, but I would think some JS in a frame
could be used to call a CGI script and refresh just the frame it's in.
You could have the form sit in a frame all by itself.

I'm not entirely sure that you couldn't do it even without a frame (I'm
not that conversant in JS) - maybe just a table or row/column in the table ?
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: displaying pictures using Perl CGI, apache and Windows

2007-05-21 Thread Bill Luebkert
Dhivya Arasappan/O/VCU wrote:
 Hi all,
 
  
 
 I have a local web server set up on a windows machine with Apache. I'm 
 using Perl cgi script to create a web interface. Everything is working 
 well, except that images are not getting displayed on the website. The 
 images along with the perl code are in the cgi-bin directory of apache- 
 I dont know why there's a problem only with the images.
 
  
 
 Here's the set of header lines, followed by the line of code that 
 displays the image:
 
  
 
 /use CGI qw(:standard);/
 
 /use CGI;/
 
 /use Shell qw(echo wget);/
 
 /use CGI::Carp qw( fatalsToBrowser carpout);/
 
 /my $query = new CGI;/
 
 /print $query-header();/
 
 
 
 /print centerimg src = 
 'hrabargraph2.gif'/img/center; /
 
 The hrabargraph.gif is already in cgi-bin folder. Usually with Linux, 
 such things happen because of permissions. What could be the reason in 
 Windows? Is it the perl code or could it be some kind of apache 
 configuration?

You need to add /cgi-bin to the path:

print EOD;
centerimg src=/cgi-bin/hrabargraph2.gif/img/center
...
EOD

or as previously suggested, create the images in their own dir (eg: /gif or
/images or /whatever):

print EOD;
centerimg src=/gif/hrabargraph2.gif/img/center
...
EOD
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Trying to Send mail

2007-01-30 Thread Bill Luebkert
Ben Eagle wrote:
 I am trying to get mail working but I have yet been able to get tit to 
 work properly, I am using MIME::Lite

Worked for me with my own to, from, file and email server.  Try running
this one as is and if it still fails, set debug to 1 and check for diag msgs.
Make sure you have the right smtp mail host.

use strict;
use warnings;
use MIME::Lite;

my $debug = 0;  # set to 1 to get diags

my $to = '[EMAIL PROTECTED], [EMAIL PROTECTED]';
my $from = '[EMAIL PROTECTED]';
my $subject = Email Sent via Perl;
my $message = This email was sent using Perl.;
my $file = graph1.jpg;

email ($to, $from, $subject, $message, $file);
exit;

sub email {
my ($to, $from, $subject, $message, $file) = @_;

MIME::Lite-send('smtp', 'email01.alinean.com', Timeout = 60, Debug = $debug);

my $msg = MIME::Lite-new(From = $from, To = $to, Subject = $subject,
   Data = $message) or die new MIME::Lite: $! ($^E);

$msg-attach(Type = 'image/jpeg', Path = $file, Filename = $file,
   Disposition = 'attachment') or die attach $file: $! ($^E);
$msg-send or die send: $! ($^E);

}

__END__
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: HTTP request arguments/content

2007-01-29 Thread Bill Luebkert
Marijn Pessers wrote:
 Hello,
 
  
 
 I have been trying to open a html page in perl. It works but I can’t 
 send the correct arguments (post values) with it to work.

Try this one:

use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);

sub get_page_http ($;$);

my $ua = LWP::UserAgent-new;
my $remote = 'localhost';   # fix me
my $path = '/somecgi.pl';   # fix me
my $leverancier_nr = 'stuff';
my $FMnummer = 'more stuff';
my $datastring = 'what goes here?';

my ($hdr, $ct) = get_page_http ($ua, $remote, $path, $leverancier_nr,
   $FMnummer, $datastring);
print \nhdrs:\n$hdr\nct:\n$ct\n;
exit;

sub get_page_http ($;$) {
my $ua = shift;
my $remote = shift || 'localhost';
my $path = shift || '/';
my $leverancier_nr = shift;
my $FMnummer = shift;
my $datastring = shift || '';   # raw datastring for ?

# print get_page: http:$remote$path ('$datastring')\n;

my $url = http://$remote$path;;
my $req = POST $url, Content = [
 'submit_waarde' = '', 'page' = 'zks1', 'submit_waarde' = '',
 'leverancier_nr' = $leverancier_nr, 'FMnummer' = $FMnummer ];

for (1 .. 2) {
my $res = $ua-request($req);
if ($res-is_error) {
sleep 1;# wait a sec and try again
next;
}
if (wantarray) {
return ($res-headers_as_string, $res-content);
} else {
return $res-content;
}
}

# failed return null string(s)

if (wantarray) {
return ('', '');
} else {
return '';
}

}

__END__
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl/Binmode issue

2007-01-06 Thread $Bill Luebkert
Zahir Lalani wrote:
 Hello
  
 not sure what is going on here. I have a standard xampp install on win 
 XP, with the updated install of perl - which is activeperl 5.8.8. I have 
 some test code to send a pdf from the cgi to the browser as follows:
  
 
 #!C:/Program Files/xampp/perl/bin/perl
 
 print Content-Type:application/pdf\n;
 print Content-Disposition:attachment;filename=test3.pdf\n\n;
 
 my $files_location;
 my $ID;
 my @fileholder;
 
 $files_location = C:\Data\Perl;
 
 open(DLFILE, $files_location\test.pdf);
 binmode(DLFILE);
 binmode(STDOUT);
 @fileholder = DLFILE;
 close (DLFILE);
 
 print @fileholder;
 
 
 
 When I run this, I get the save as dialog. Whether I save or open 
 directly, the resulting data is deemed as corrupt by acrobat. If I 
 access the file directly via apache rather than the cgi, it works fine. 
 To make sure the code was OK, I ran the same code (apart from the paths 
 and the binmode) on a unix install - and it worked fine. I also tried an 
 equivalent version of PHP via the xampp install - worked fine. So this 
 seems to be a perl issue on win32.
 
 Has anyone got a clue as to what the problem could be?

The only thing obvious is your \s should be \\s when inside double
quotes.  State your OS, webserver, browser so we have some idea of
your environment and also do as previously suggested:

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);

You could also try hex-dumping the file and the returned file and
see what's different.
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: embedding javascript in cgi perl- works in linux but not windows!

2006-09-19 Thread $Bill Luebkert
Dhivya Arasappan/O/VCU wrote:
 Hi,
 
 I've been using a perl script for a while now on  for a button which
 when clicked opens up another site (through a javascript function
 embedded in the perl). Its been working fine, but recently I opened the
 site in windows and tried hitting the button. It didnt work. It doesnt
 open up the other site.
 
 Any idea why it seems to work only in Linux and not in windows ?
 
 The code snippet is as below:

When are you posters going to learn to provide complete failing snippets ?
Make a little more effort so we don't have to do all the work.
This works for me - if it doesn't for you, describe your error :

#!/usr/bin/perl

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);

print EOD;
Content-Type: text/html

HTML
HEAD
script
function inputformat () {

var url = 'http://some-legit-url/'; # fix URL for your site
newwindow = window.open (url, 'input format', 'height=600, width=700');
if (window.focus) {
newwindow.focus()
}

}
/script
/HEAD

BODY
input type='button' value='Input file format' onClick='inputformat();'
/BODY
/HTML
EOD

__END__

 print input type = button value = 'Input file format' onClick =
 'inputformat();';
 
 print script;
 
 print function inputformat(){;

 #print alert('going to see input format');;
 print var url = 'http://gus.csbc.vcu.edu/gus/inputformat.pl';;
 print newwindow=window.open(url, 'input format','height=600,
 width=700');;
 print if(window.focus){;
 print newwindow.focus();
 print };
 
 print };
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CGI header problem in 5.8

2006-05-08 Thread $Bill Luebkert
dorian wrote:

 I just upgraded my Win2000 server from ActivePerl5.6 to 5.8 and now my
 CGI scripts are failing.  I have many scripts where I use CGI
 qw/:standard/; and then:
  
 print header;
 print start_html;
  
 As per the CGI.pm man page.  But now it prints two http headers and
 displays the html source to the browser.  If I delete the first print
 header statement then it displays correctly.  This would not be such a
 big deal but there are many scripts where I do this and it appears to
 still be correct from looking at the CGI.pm docs.  More seriously I am
 also using CGI::Ajax (which worked under 5.6) and it is also outputting
 double headers and I see no way to control this.  I lasso don't know
 what other scripts may be affected by this.
  
 Any help on this would be most appreciated.  I am hesitant to upgrade my
 production server to 5.8 and now the scripts on my development and
 production servers are out of sync.

I'd suggest you come up with the smallest complete test case that reproduces
your problems along with the complete script and output from the script
(maybe also run it in a command window and cut-n-paste the output into
your post).
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl / javascript and MD5

2006-03-22 Thread $Bill Luebkert
Hon Shi wrote:

 Do these generate the same hash?
 The password fails every time.  

I'd start by printing out the content of $cat and ts.value and
see if they're the same (or similar since they'll be run at
different times).  If that looks OK, proceed to printing $pwhash
(at both places) and pwhash.value.

 Perl version:
 
   use Digetst::MD5 qw(md5);
   $tm = time * 1000;
   $cat = $password . $tm;
   $pwhash = md5($cat);  # alternative tried md5($password, $tm);
   $pwhash = uri_escape($pwhash);
 
   then post with 
 
   do_POST($url_login_post,
   [ 'ts' = $tm,
 'encrypw' = $pwhash,
 'submit1' = 'Login',
 'text1' = $user_id ]);
   
 
 Javascript version:
 
 script language=javascript srcmd5.js/scripts
 script language=javascript
 .
 .
 .
   ts.value = date.getTime();
   pwhash.value = calcMD5(password.value + ts.value);
   fr.submit();
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Popup on upload on server's pc

2005-03-26 Thread $Bill Luebkert
Charles Maier wrote:

 I have an upload script/webpage on my Win32 PC server. It allows people
 to upload  file(s) and the script puts it in a directory of my setting.
 So far.. No big deal.
 
 What I would like is to be able, from the upload script, to send a
 NOTIFY message that an upoad has been made. I want it to be non-modal so
 the script will not be waiting for a response. Just popup a window
 with the news.
 
 Can this be done?? How?

Wouldn't it be easier to send an email or use a log file ?

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Popup on upload on server's pc

2005-03-26 Thread $Bill Luebkert
Charles Maier wrote:

 Easier?? Maybe... Especially if what I asked for was not possible  ;o))
 
 I have a number of grandkids that will send a photo or two whenever
 and I am usually on the pc that has the server. If I get a popup I know
 I can dialog with them about the photo... As soon as I can see it. As
 matter of reality.. I could just as easily as a log file.. Look in the
 directory that uploads go to... Etc.etc. 
 
 
 BUTCan I get a popup from my PC server's CGI???

Sure any number of ways.  They may lock up your CGI though till you
clear it.  What you could do is :

system 'start wperl another-script-with-a-dialog-box.pl';

and use one of these inside methods to do a dialog/msg box inside it :

Win32::MsgBox
Win32::GUI::DialogBox
Tk::DialogBox
etc.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Automated Web-surfing

2004-08-11 Thread $Bill Luebkert
[EMAIL PROTECTED] wrote:

 Hi there,
 
 still no idea of how to solve the problem (tried to read through the lwp manpage and 
 lwp cookbook):
 
 I have a website that displays a login (username, password) prompt where you have to 
 enter the data and click on a button. 
 Then select a menu to get a new page (full with java-script commands an cookies) 
 that 
 shows a form where I would like to fill out somewhat like 20 fileds with data that 
 is in 
 the clipboard (pretty easy parseable) and then click on a submit button.
 
 So, the question is: should I use perl as a keyboard-macro-tool that just hits the 
 keys in 
 the explorer-window as I would manually (would that be done with OLE like the Win32-
 Excel-examples)?
 
 As I understand the other option is to setup a UserAgent, but therefore I cannot 
 find 
 any examples that show how to work with all that Cookie-Javascript-password stuff.
 
 I think there must be lots of similar problems and solutions out there, so I'd be 
 glad to 
 find some..

I would use WWW:Mechanize and repost when you get in trouble.
Some code would help us to get you over the next hump.

my $url = 'http://www.whatever.com/';
my $cookiefile = 'cookies.txt';

my $cookie_jar = HTTP::Cookies-new(File = $cookiefile, autosave = 1);

my $Mech = new WWW::Mechanize;
$Mech-cookie_jar($cookie_jar);
$Mech-agent('Mozilla/4.0');

my $res = $Mech-get($url);
...

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: problem posting form using HTML::Form and HTTP::Request

2004-05-20 Thread $Bill Luebkert
Charles Pelkey wrote:

 I may be off a little here, but when did the HTTP::Request natively
 become able to handle secure requests?? Last I knew, you could not
 submit to an HTTPS site using these modules unless you re-compiled them
 after installing a compatible SSL library (such as SSLeay).

As long as you've installed SSL (Net_SSLeay [IO-Socket-SSL]), you
shouldn't need to do anything to the HTTP::Request module (or
others in the family).  Then 'https://' will cause LWP to automatically
invoke the correct protocol.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help me please about Crypt::SSLeay

2004-04-30 Thread $Bill Luebkert
[EMAIL PROTECTED] wrote:

 Hello,
 
 I use the LWP and Crypt::SSLeay pakage in the next script:
 
 use strict;
 use warnings;
 
 use LWP::UserAgent;
 use strict;
 use warnings;
 
 use LWP::UserAgent;
 
 # xxx is a web server via HTTPS
 my $uri = 'https://www.xxx.com/';
 
 my $ua = LWP::UserAgent-new;
 my $req = HTTP::Request-new(GET = $uri);
 my $res = $ua-request($req);
 
 print Content-type: text/html\r\n\r\n;
 if ($res-is_success) {
 
 print $res-as_string;
 
 } else {
 
  print Failed to GET '$uri': , $res-status_line, \n;
 }
 
 
 It run in command line, but when I use it like a CGI script I have a mistake:
 
 Failed to GET 'https://logitelnet.socgen.com/': 501 Protocol scheme 'https' is not 
 supported (Crypt::SSLeay not installed) 
 
 Nevertheless the package Crypt::SSLeay is installed !!!
 
 Can you help me...
 
 I use Perl 5.8.0 build 806 by ActiveState, IIS 5.0 on Windows 2000 server.

You need to check the path to Perl used by IIS vs commandline.
Also try printing out @INC from IIS and the commandline and compare.
There may also be a permissions problem (I don't know IIS - I use Apache).

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: upload system

2004-03-17 Thread $Bill Luebkert
Marlon wrote:

 Hi, my name is Marlon and I'm a new perl programmer.

We'll be the judge of that.  ;)

   I have some questions
 about perl and I'dd like some help...
 1- How can I use apache with ActiveState ActivePerl 5.6 on windows?

Just get them both properly installed and have at it.

 2- I know perl is a cgi scripting language ok? But php, for example, may be
 used or if a cgi interpreter or as a module on apache. Is it possible to use
 perl as a apache module too?

Long before PHP.

 3- I need a simple upload system, which sends one file with extension .mpg
 from the client machine via ftp to a ftp server. This system must have a
 progress bar to indicate the persent progress of the download. I've tryed
 doing this in php, but it's impossible and some people tould me to try perl
 ... But I have no idea about how start it ... How can I start it? Is it
 possible?

Depends on whether you want to use FTP or CGI.  Both can uplaod the
file.  FTP can do the status bar - might be able to do it in CGI with
some JavaScript help, but I can't think of an obvious solution.

 Well, I'm from Brazil so my english is a feew bad ... but I hope you
 anderstande me and I hope someone help ... I don't, know many things about
 perl, it's a feew strange still for me ...

You did ok so far - a lot better than my Spanish or Portuguese. :)

There's an upload script on my Tripod site (no status bar).

For FTP, you need an FTP server running on the machine you're uploading to.
If you have that, you can use Net::FTP module to do the upload and the
status bar, but you'd be working from a console interface (commandline)
rather than a web/HTML interface (browser).

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Execute and return immediately.

2004-02-09 Thread $Bill Luebkert
JulianL Brown wrote:

 My original question must have baffled you.  I want a perl script responding 
 to a cgi-form to execute another perl script yet return immediately.
 
 I have tried system and Win32::Process::Create to no avail, regardless of 
 which or how I have used it, the cgi script only returns when the child 
 process has finished.
 
 Has anyone done this before?

If the 5th arg is DETACHED_PROCESS, you should be fine.  Then you can
poll it for completion using Wait method with a timeout.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: LWP and redirects

2004-02-03 Thread $Bill Luebkert
Thomas, Mark - BLS CTR wrote:
 How do I get the base URL of a page I request that has been redirected
 (multiple times) to another page? In other words, I'm requesting a page, LWP
 follows multiple redirects, and I get the contents of the page. I need to
 know the base URL that the contents actually came from, after following all
 the redirects.

Dump the request or response object with Data::Dumper and that should
give you the URL you need.  Then if there is no method to retrieve it,
just figure out the correct hash reference into the object and retrieve
it yourself.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Strange Problem

2004-01-22 Thread $Bill Luebkert
Chuck Lee wrote:
 So I'm using ` to execute a system command because I want to examine the
 output of the command.
 
 my $var = `c:\windows\blah.exe`;
 
 If I run the command from the command line I get:
 
 This ran fine.
 
 Now if I look at the variable $var I get:
 
 T h i s   r a n   f i n e.
 
 So this is strange.  See what happens if I strip out the spaces:
 
 $var =~s/\s+//;
 
 or
 
 $var =~s/ //g;
 
 And the out is the same.  Perl doesn't seem to recognize the spaces.
 
 Any ideas of what can be going on here?

Not yet, try dumping $var in hex to see what's really there.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Strange Problem

2004-01-22 Thread $Bill Luebkert
Chuck Lee wrote:
 my $real = hex($var);
 print $real;
 
 returns 0.

Not exactly what I had in mind - try:

foreach (split //, $var) {
printf %02x , ord $_;
}


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Strange Problem

2004-01-22 Thread $Bill Luebkert
Chuck Lee wrote:
 ff fe 0a 00 53 00 74 00 61 00 72 00 74 00 69 00 6e 00 67 00 20 00 69 00 6e
 00 73
  00 74 00 61 00 6c 00 6c 00 2c 00 20 00 70 00 6f 00 72 00 74 00 3a 00 20 00
 38 0
 0 30 00 2e 00 0a 00 0a 00 43 00 72 00 65 00 61 00 74 00 69 00 6e 00 67 00 20
 00
 77 00 65 00 62 00 20 00 68 00 74 00 74 00 70 00 3a 00 2f 00 2f 00 63 00 68
 00 75
  00 63 00 6b 00 30 00 35 00 2e 00 63 00 6f 00 6d 00 2e 00 0a 00 49 00 6e 00
 73 0
 0 74 00 61 00 6c 00 6c 00 20 00 63 00 6f 00 6d 00 70 00 6c 00 65 00 74 00 65
 00
 64 00 2e 00 0a 00
 
 I take it the 00 means space?

No, 00 is a null character - 20 would be a space.  You'll need to
remove the null chars$var =~ s/\x00//g;

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl/iPlanet/use loading

2003-11-13 Thread $Bill Luebkert
JulianL Brown wrote:

 Bill
 
 I am not sure how what you are proposing would help me reduce resources.  It 
 seems your code would load all my modules regardless, and I am already doing 
 that now.

The code was for another purpose and was only to give you an idea
on how to do a use conditionally.

 But your code did give me an idea:
 
 Something along the lines of ...
 
 if (I need Module1)
 {
eval qq~
 use Module1;
 
 call Module1 stuff.
 
 ~;
 }
 
 Here what is in the eval script would NOT get compiled or executed until it 
 is needed, am I correct in this assumption?
 
 What do you people thing?

You can play with the eval, but in this case the require (and
optional import) would be easier for you.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: How to get the last line of data from a log file on win2000 server

2003-08-26 Thread $Bill Luebkert
Wilson, Douglas wrote:

Is there a way to read the file and get the last line, first data -
 
 101700
 
using perl script?
 
 
 Go to CPAN and get File::ReadBackwards, this is just the sort
 of thing it is for.

Or just seek to the end minus the length of at least one line (or more
to be safe) and then read until you get EOF (saving last line each time).

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: RegExp resource help

2003-08-14 Thread $Bill Luebkert
Gert Lombard wrote:

 It's under the PODS section:
 http://www.perldoc.com/perl5.8.0/pod/perlre.html
  
 Also look at the regexp section under perlop.

There's also perlretut (tutorial) and perlrequick (quickstart).

 If you're using ActivePerl, you can of course view the Documentation
 locally too.
 
 -Original Message-
 From: [e]agLØrT [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 13, 2003 11:17 AM
 To: [EMAIL PROTECTED]
 Subject: RegExp resource help
 
 hi there..
 anybody knows a web site about RegExp?
 you know, like www.perldoc.com http://www.perldoc.com/ (i couldnt
 find regexp help section like perlfunc, etc.. there)
 thanks a lot...
  


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Processes and hash references

2003-07-29 Thread $Bill Luebkert
Hanson, Rob wrote:

Is there another module you would
recommend using for Win32 threading?
 
 
 Nothing that comes to mind other than mapping to a file (DB_File, and
 others).  I do recall a memory mapping module for Windows floating around
 several years ago, can't remember the name or if it was ever uploaded to
 CPAN.

Isn't there a shared memory module for Win32 ?

That and a semaphore should cover it.

I know Amine had Win32::MamMap (Jenda's site) - someone should get the
source or re-write it for the masses.

Barring that, the threads package should handle it if disk is too slow.

 -Original Message-
 From: Chuck Lee [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 29, 2003 10:53 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Processes and hash references
 
 
 snip
 
Another alternative is using threads, but they are only available in Perl
5.8, so I'm not sure if you will have them available.  Threads
allow your to
create another thread for the same process instead of forking a whole new
one.  It allows for locking and sharing of variables, which seems to be
exactly what you need.
 
 /snip
 
 Thanks for the reply.  I am developing in the win32 environment, so I would
 like to use Win32::Process to thread the process.  However, I don't know if
 there's a way to send a hash ref to the threaded process or does it share
 the same memory space as the original process?  Is there another module you
 would recommend using for Win32 threading?
 
 thanks
 Chuck
 
 
 
-Original Message-
From: Hanson, Rob [mailto:[EMAIL PROTECTED]
Sent: July 29, 2003 10:46 AM
To: 'Chuck Lee'; [EMAIL PROTECTED]
Subject: RE: Processes and hash references


I don't have much experience with forking, but I don't believe you will be
able to update the has ref easily.  When you fork you are creating a new
copy of the app, including variable storage... so the hash in the forked
process would be different from the original.

You should be able to use a shared hash though.  You should look
for memory
mapping modules and tied databases on CPAN, there are a few.

Another alternative is using threads, but they are only available in Perl
5.8, so I'm not sure if you will have them available.  Threads
allow your to
create another thread for the same process instead of forking a whole new
one.  It allows for locking and sharing of variables, which seems to be
exactly what you need.

But like I said, I have little experience with forking, just bits of
knowledge I have picked up here and there.  So hopefully someone can give
you a good recommendation.

Rob

-Original Message-
From: Chuck Lee [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 4:24 PM
To: [EMAIL PROTECTED]
Subject: Processes and hash references


Hi I'm not too familiar with spawning multiple processes in Perl,
but I was
looking for the best method to spawn a new process that will
inherit a hash
reference (ie: XML request object), process the request and will
update the
hash reference when finished.  So basically it will need to share the same
memory space as the calling process.  Is this possible?  If so, would fork
be the best method for doing this?


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers)

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Problems with socket / post data

2003-06-02 Thread $Bill Luebkert
Burba Galaxy wrote:
 I am trying to post some data to a web site to avoid filling out some forms
 on a given web site every time with a web browser. Unfortunately it is not
 working in the right manner. I've two problems:
 
 I am sending the following file 
 1.txt:
 POST /login.php HTTP/1.1
 Accept: image/gif[...]
 
 Content-Length: 127
 Connection: Keep-Alive
 Cache-Control: no-cache
 
 LoginName=xFomData=Request_new_Data.
 
 with this script:
 
 use Socket;
  my $proto = getprotobyname('tcp');
  socket(F, 'www.xy.z', SOCK_STREAM, $proto);
  my $sin = sockaddr_in(80,inet_aton('www.xy.z'));
  connect(F,$sin) || return undef;
  my $old_fh = select(F);
  $| = 1; 
  select($old_fh);
 
  $fn = 1.txt;  # input File
  open fn or die Can't find File $fn: $!\n;
  while (fn) {
   print F $_;
  }
  close fn;  # this should send the header and the post data
 
   while (F) {#print the received header and body
 print fn_out $_;
   }
 #  now I'd like to process the received header and data, change 1.txt and do
 it again:
  $fn = 1.txt;  # input File
  open fn or die Can't find File $fn: $!\n;
  while (fn) {
   print F $_;
  }
  close fn;  # this should send the header and the post data
 
   while (F) {#should print the received header and body, but
 unfortunately does not work
 print fn_out $_;
   }
 
 Now my first problem is that my request is split up into two ip packets:
 
 First packet contains 'POST /login.php HTTP/1.1'
 Second packet contains 'Accept: image.'
 I don't know if this is a problem but as it does not work (I do not get the
 same response as I did with the web browser) it seems to me that is (the
 browser sent only one packet).
 
 My second problem is that the second request does not work at all. It seems
 to me that the while (F) is waiting till the connection is closed and then
 the second request is not sent.
 
 Please help me.

Sockets are not the thing to use here.  Try LWP.  EG to get you started:

use strict;
use LWP::UserAgent;
use HTTP::Cookies;
use URI::Escape;
use Data::Dumper; $Data::Dumper::Indent=1;

my $ua = new LWP::UserAgent or die new UA: $!;
$ua-agent(testclient/1.0);

$ua-cookie_jar(HTTP::Cookies::Netscape-new);  # if any cookies in use

my $url = 'http://localhost/cgi-bin/test.pl';

my $req = new HTTP::Request('POST', $url) or
  die new HTTP::Request POST '$url': $!;
$req-content_type('application/x-www-form-urlencoded');
$req-content(uri_escape('arg1=val1arg2=val2'));
my $res = $ua-request($req);
print $res-content;

#print Data::Dumper-Dump([$req, $res], [qw($req $res)]);

__END__

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers)


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Regex Doubt

2003-06-02 Thread $Bill Luebkert
karthikeyan.balasubramanian wrote:
 Hi,
 
   I have 2 set of strings :
 
 String A
 ==
 
 MC200 - 19 IBM Std, Rackmount computer
 
 String B
 ==
 
 TABLE border='0' cellpadding='2' cellspacing='2'
   TR
 TD
   input type='checkbox' name = '8' value = '501'
 
501nbsp;nbsp;/input
 
 /TD
 TDMC505 - 10.4 LCD Touch Display/TD
   /TR
   TR
 TD
   input type='checkbox' name = '8' value = '502'
 
502nbsp;nbsp;/input
 
 /TD
 TDMC510 - 10.4 LCD  Display/TD
   /TR
   TR
 TD
   input type='checkbox' name = '9' value = '512'
 
512nbsp;nbsp;/input
 
 /TD
 TDMC640 - Shielded Video cable - 6'/TD
   /TR
   TR
 TD
   input type='checkbox' name = '9' value = '517'
 
512nbsp;nbsp;/input
 
 /TD
 TDMC652 - RS-232 Serial Cable - 10'/TD
   /TR
 /TABLE
 
 Now if there is any MC2xx, or MC3xx in String A then i need to add DIABLED
 to
 1. Touch Display
 2. Serial Cable.
 
 i.e. input type='checkbox' name='8' value='501' DISABLED
 
 Now searching should not be a problem in RegEx i believe.  I can issue
 
 MC[23..] how about finding out Touch Display and Serial Cable and adding
 DISABLED to it INPUT Type.
 
 Can somebody help me out in this.

If you can determine the need prior to creating the B string, you could
insert it thusly:

 TDMC652 - RS-232 Serial Cable - 10' $disabled/TD

and $disabled could default to '' when not needed.  If string B already
exists, you could still split the string into pieces and insert $disabled
at the appropriate spots, eg:

$stringb = 'stuff here' . 'more stuff' . $disabled . 'still more stuff';

If the string already exists and you can't split it up like that, you could
insert a special code to look for and replace it with either a null expression
or the deleted HTML code.

$stringb = 'stuff here more stuff ZYXYZ still more stuff';

and replace ZYXYZ with whatever.
-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers)


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl, Apache and Htpasswd

2003-05-30 Thread $Bill Luebkert
Rush, Thomas wrote:
 Hi,
 
 I'm struggling with the Apache-Htpasswd 1.5.3 CPAN module.
 
 I've used the Apache-Htgroup module and it works fine.
 
 When I attempt to create a new user and password using the following code:
 
 use strict;
 use Apache::Htgroup;
 use Apache::Htpasswd;
 my($htdir, $htgroup, $htpass);
 my($username, $password1, $password2, $name);
 $username = 'smith';
 $password1 = 'passin';
 $htpass= new Apache::Htpasswd(passwords);
 $htpass-htpasswd($username, $password1);
 
 It returns a username and password in the password file as:
 
smith:paFRj3ff4n1Vw:
 
 The above username/password combination can not be used as a valid login.
 However all the other entries are created from the command prompt are as
 follows:
 
guest:$apr1$AE0.$QA7jSdM61M4Ue.Si5jHUN.
 
 These entries work fine as expected.
 In my mind this implies that the perl based module is not using MD5
 encryption ...or something which I've not yet thought about.

The Win32 Apache used to use crypt and then there were some issues and they
switched to MD5.  UNIX always used crypt (they might have other options now).

Looks like the module is using crypt and you're running on Win32.

You could always shell out and use htpasswd.exe (eg: untested) :

system C:/path/htpasswd -b $passwd_file $user $passwd;
or maybe capture it:
my enc_passwd = `C:/path/htpasswd -s -b $passwd_file $user $passwd`;

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers)


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Perl, Apache and Htpasswd

2003-05-30 Thread $Bill Luebkert
Rush, Thomas wrote:
 Correct, sorry I should have stated I was using Apache/2.0.44(Win32) on an
 NT workstation.
 
 Does anyone know if MD5 encryption will be added to Apache-Htpasswd for
 Win32 systems as it's quite a nice little module and I like it. Even if it
 doesn't work on my Win32 System. :^)
 
 shelling out is always a good answer however being a VAX/VMS systems
 programmer from way back where everybody over used the lib$spawn call I sort
 of like a cute 'little' routine to do the task. However in the short term
  
 
 Thanks to all,
 
 -Tom
 
 -Original Message-
 From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
 Sent: 30 May 2003 12:05
 To: Rush, Thomas
 Cc: [EMAIL PROTECTED]
 Subject: Re: Perl, Apache and Htpasswd
 
 
 Rush, Thomas wrote:
 
Hi,

I'm struggling with the Apache-Htpasswd 1.5.3 CPAN module.

I've used the Apache-Htgroup module and it works fine.

When I attempt to create a new user and password using the following code:

use strict;
use Apache::Htgroup;
use Apache::Htpasswd;
my($htdir, $htgroup, $htpass);
my($username, $password1, $password2, $name);
$username = 'smith';
$password1 = 'passin';
$htpass= new Apache::Htpasswd(passwords);
$htpass-htpasswd($username, $password1);

It returns a username and password in the password file as:

   smith:paFRj3ff4n1Vw:

The above username/password combination can not be used as a valid login.
However all the other entries are created from the command prompt are as
follows:

   guest:$apr1$AE0.$QA7jSdM61M4Ue.Si5jHUN.

These entries work fine as expected.
In my mind this implies that the perl based module is not using MD5
encryption ...or something which I've not yet thought about.
 
 
 The Win32 Apache used to use crypt and then there were some issues and they
 switched to MD5.  UNIX always used crypt (they might have other options
 now).
 
 Looks like the module is using crypt and you're running on Win32.
 
 You could always shell out and use htpasswd.exe (eg: untested) :
 
   system C:/path/htpasswd -b $passwd_file $user $passwd;
 or maybe capture it:
   my enc_passwd = `C:/path/htpasswd -s -b $passwd_file $user
 $passwd`;

You can try using Digest::MD5, but I don't know the htpasswd format for
their MD5 version (maybe a look at Apache source ?) :

use Digest::MD5;

my $md5 = Digest::MD5-new;
$md5-add('fubar');
my $digest = $md5-b64digest;
print Digest is $digest\n;

This generates stuff like:
   UYXouP2KcfyAVF4UT5H68g
which lines up with the last part of the htpasswd version after the second $:
$apr1$Qg/.$.wj1CVzOnp4Y/A3f7wY/5/

I don't know what the '$apr1$Qg/.$' part is.
These three letters  ^^^   seem to change too.

You might find this interesting from htpasswd docs:

The MD5 algorithm used by htpasswd is specific to the Apache software;
passwords encrypted using it will not be usable with other Web servers.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (Free site for Perl/Lakers)


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: precedence?

2003-03-28 Thread $Bill Luebkert
Ember Normand wrote:
We're getting an error in Fraction.pm, which we've used for years 
without a problem.  It's in line 123.  I noticed that he put 1 line of 
code over 2 lines.  He also did not put parentheses around the if 
clause.  I'm not sure if these are allowed in Perl or allowed in the 
more recent releases of Active State perl  perlEx?  I've included the 
errors we're getting below his code and my interpretation of what I 
think the precedence should be below that.  Does this seem like a 
reasonable fix?  Is anybody familiar with this module?
Thanks,
Ember
 
118:if ( _tag($REDUCE, [EMAIL PROTECTED]) ne 'NO_REDUCE'
119:   and _tag($RED_STATE, [EMAIL PROTECTED]) ne 'IS_REDUCED' )
120:  {
121:my $not_reduced;
122:($not_reduced, @frac) = _reduce(@frac);
123:@frac = _fix_auto('DOWN',[EMAIL PROTECTED], @frac) if $not_reduced
124:   and _tag($AUTO, [EMAIL PROTECTED]) 
eq 'AUTO';
125:  }
This looks fine to me without seeing the rest of the code.

--
 
*** 'C:\Inetpub\cgi\my.cgi' [27] error message at: 2003/03/27 13:33:18
Precompiler: Execute called with [C:\Inetpub\cgi\my.cgi]
Precompiler: Checking for existence of C:\Inetpub\cgi\my.cgi in Cache
Precompiler: Script C:\Inetpub\cgi\my.cgi is compiled and 1722 minutes old.
Precompiler: Eval Error:
 Package:[PerlEx::Precompiler::c_::inetpub::cgi::my_cgi]
 File:[C:\Inetpub\cgi\my.cgi]
 Error:[syntax error at C:/Perl/lib/Math/Fraction.pm line 123, at EOF
Missing right curly or square bracket at F:/Perl/lib/Math/Fraction.pm 
line 123, at end of line
Compilation failed in require at (eval 1) line 125.
BEGIN failed--compilation aborted at lib/Test.pm line 74.
Compilation failed in require at (eval 1) line 125.
BEGIN failed--compilation aborted at (eval 2) line 176.
]
Precompiler: Returning -1 at
514
 
---
 if ( (_tag($REDUCE, [EMAIL PROTECTED]) ne 'NO_REDUCE') and (_tag($RED_STATE, 
[EMAIL PROTECTED]) ne 'IS_REDUCED' ))
Making this one line does nothing nor does adding unecessary parens.

  {
my $not_reduced;
($not_reduced, @frac) = _reduce(@frac);
@frac = _fix_auto('DOWN',[EMAIL PROTECTED], @frac) 
if ($not_reduced and (_tag($AUTO, [EMAIL PROTECTED]) eq 'AUTO'));
Same here.

  }
 
The original code looks fine - there may be something prior to that that
is throwing it off.  Did changing the code make any difference ?
--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Cant get rand to work on asp

2003-02-13 Thread $Bill Luebkert
Allegakoen, Justin Devanandan wrote:

Hi all,

I cant get rand to work in my asp.

All I want is a random number between 1 and 12:-

int rand(1 + 12 - 1); # This gives me a page cant be displayed


perlfunc was mumbling on about srand, so I put this in:-

srand (time ^ ($$ + ($$  15)));
my $Temp = rand(1 + 12 - 1);

Now all I get is 3, no matter how many times I refresh.

I don't see the need to call srand as perlfunc says that rand Automatically
calls srand unless srand has already been called.

What should I do?


Your orig code should have been fine - try:

for (1 .. 10) {
	my $Temp = int rand (1 + 12 - 1);
	print $Temp, \n;
}

and see what you get.

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Cant get rand to work on asp

2003-02-13 Thread $Bill Luebkert
$Bill Luebkert wrote:

Allegakoen, Justin Devanandan wrote:


Hi all,

I cant get rand to work in my asp.

All I want is a random number between 1 and 12:-

int rand(1 + 12 - 1); # This gives me a page cant be displayed


perlfunc was mumbling on about srand, so I put this in:-

srand (time ^ ($$ + ($$  15)));
my $Temp = rand(1 + 12 - 1);

Now all I get is 3, no matter how many times I refresh.

I don't see the need to call srand as perlfunc says that rand 
Automatically
calls srand unless srand has already been called.

What should I do?


Your orig code should have been fine - try:

for (1 .. 10) {
my $Temp = int rand (1 + 12 - 1);
print $Temp, \n;
}

and see what you get.


PS:  I ignored any ASP repercussions since that's not in my scope.
I have no idea what changes might be needed to actually print in ASP.

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Cant get rand to work on asp

2003-02-13 Thread $Bill Luebkert
Eric Robertson wrote:

$Bill Luebkert wrote:
Your orig code should have been fine - try:

for (1 .. 10) {
   my $Temp = int rand (1 + 12 - 1);
   print $Temp, \n;
}

and see what you get.



Bill

Since Justin wanted a number between 1 and 12 shouldn't it have been:

 for (1 .. 10) {
 my $Temp = int rand (11) + 1;
 print $Temp, \n;
 }


I wasn't really looking at the rand value since that didn't seem to be
his problem - I just left it the way he had it.

If that's the range he wanted, then it should be:

	my $Temp = int rand (12) + 1;

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/


___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: example / tutorial for listing files?

2002-11-25 Thread $Bill Luebkert
Mark Bergeron wrote:

I've come up with this work snippet:

chdir( C:\\files\\ ); 
local( @files ) = *.plx; 
foreach $file( @files ) { 
	if( !-d $file ) { 
		print bra href=\$file\$file/a \n; 
	} 
}

how would I add dir to this in addition to the files?

What does that mean ?  Do you mean you want to recurse down through the subdirs ?

If so, I would use File::Find.

Untested:

use strict;
use File::Find;

find (\wanted, 'C:/files');

sub wanted {
return if -d or not /\.plx/i;
	print qq{bra href=$_$_/a\n};
}

__END__

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: example / tutorial for listing files?

2002-11-25 Thread $Bill Luebkert
Mark Bergeron wrote:

Basically I want to create a component that I can use for creating a file management type listing. Something along the lines of if it's an html file, show its size, date created and an icon denoting the file type. I want to do the same with other files in the directory. I'm getting closer. Taking more work then I thought.

Is File:Find a type of module like this? Thanks again.


File::Find is a module that recurses through directory trees.
If you had run the below snippet (assuming there are no errors),
you would see what it does.  A stat of each file will get it's
size and creation date and you can get icons from the Apache
webserver or Windoze.

Change /\.plx$/i to /\.html?$/i in snippet to get only html files.

This is simple stuff - if you can't write a little snippet and
try to debug it, then have someone do it for you.  Don't forget
to pay them. :)

Write a script - try testing/debuggin it - if it fails, post it.


use strict;
use File::Find;

find (\wanted, 'C:/files');

sub wanted {
   return if -d or not /\.plx/i;
	print qq{bra href=$_$_/a\n};
}

__END__


If you're a newbie - try:  http://groups.yahoo.com/group/perl-beginner

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: example / tutorial for listing files?

2002-11-23 Thread $Bill Luebkert
Mark Bergeron wrote:

I being lazy here but, how would I look in a directory, create a list of all of the files there and assign a link with the file name: a href=filename.plfilename/a and display it on say an index page for that directory?

Any help? Any sites I can get a quick and easy answer to this question? I want to do something similar to using the FileSystemObject through ASP. And I know I'm asking for it by saying that but, that's where I got the idea from.


Less cross-posting please.

There are several ways to do it.  I would use opendir/readdir to
get the files and a regular expr. to eliminate the ones I don't
want.

opendir DIR, $dir or die ...;
my @files = readdir DIR;	# slurp them into an array unless there are lots of them
closedir DIR;

foreach (@files) {
	next if /^\.{1,2}$/;	# drop . and ..
	if (/\.html$/) {	# or whatever your criteria is
			# do your thing
	}
}

Code something up and come back if you can't get it to work.

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: NEWBIE question - FindBin error

2002-10-07 Thread $Bill Luebkert

John Graves wrote:
 I have just installed ActivePerl on my win2k system.  It has passed 
 several simple install tests.  ie, I can print to scream and pul data.  
 However...
 
 When I invoke a script that includes FindBin  either as PERL cfgmaker 
 public@localhost or
 perl ./cfgmaker public@localhost
 I get the following error:
 
 C:\mrtg-2.9.22\binperl cfgmaker public@localhost
 use not allowed in expression at C:/Perl/lib/FindBin.pm line 14, at 
 end of lin
 e
 syntax error at C:/Perl/lib/FindBin.pm line 14, near head1 SYNOPSIS
 
  use FindBin
 BEGIN not safe after errors--compilation aborted at 
 C:/Perl/lib/FindBin.pm line
 15.
 Compilation failed in require at cfgmaker line 40.
 BEGIN failed--compilation aborted at cfgmaker line 40.
 
 Am I missing something in my environment or have I missed something in 
 the install??

Create a small failing test script and post.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: URL decode

2002-10-05 Thread $Bill Luebkert

Kevin wrote:
 Hello,
 
 I need to progrmatically decode the following UTF-8 data via CGI:
 
 q=%D7%91%D7%A8%D7%99%D7%AA
 
 Can this be done?

You didn't say what form you wanted the results in.

use strict;
use URI::Escape;
use HTML::Entities;

my $q = '%D7%91%D7%A8%D7%99%D7%AA';
print $q\n;

# unescape the CGI data

my $str  = uri_unescape ($q);
print $str\n;

# if you like, you can convert to HTML entities

print HTML::Entities::encode_entities ($str), \n;
print \n;

__END__

or some other intent ??

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Starting GUI application on the server using perl

2002-10-05 Thread $Bill Luebkert

Juri Artamonov wrote:
 Hi All,
 
 could anyone advice how to start on the server
 application through the web using perl?
 
 I have installed Apache 1.3.22 and ActiveState perl
 5.6.1.
 
 I would like to connect from client to the WebServer
 and press some button in IE window (just simple html
 code) and in result invoke perl script which will run
 GUI application on the server. 
 
 Now if use just system command (system
 path\some.exe) inside of perl script then it won't
 work. Long time page is loading but then appears Page
 not found message. 
 
 How to start external program (perhaps in hide mode)
 and just see in the processes list that it's running?
 
 Is it possible?

Either use 'start' command to BG the app or use Win32::Process::Create
with the DETACHED_PROCESS flag.

eg:
system start path/someapp;

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: IIS website creation using Perl Win-32 ?

2002-10-01 Thread $Bill Luebkert

Tony Ding wrote:
 Hi all,
looking for some help if possible with a project I'm working on,
 I'm trying to put together a perl script that will create a website in IIS on win32 
platform (e.g. NT4 / Win2k). I know that it can be done by using MS ADSI/WSH but want 
to avoid that as the machines we run all have an antivirus scanner that prevents VBS 
running. If I can do the leg work in Perl I can then port/convert to our Linux / 
Solaris boxes as we run Activestate 5.6 on all the boxes. I need to be able to just 
create the website in the metabase - the rest of the admin I'll work on some other 
time :) The request came from all our techies that are getting fed up with creating 
web sites manually. The perl script will run locally on the box and not thru IIS 
itself so no CGI problems.
 Any Ideas ??
 I have to admit I'm not up to speed on the latest win-32 perl libs so hence the 
quesion

Why not use Apache on Windoze instead of IIS - should make porting easier to
UNIX (assuming Apache server there).

You would want to avoid the Win32 libs if possible (unless they wouldn't be needed
on the code you plan to upload).

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Piping system calls Win32

2002-09-30 Thread $Bill Luebkert

Wood Family wrote:
 I'm using Active Perl on Windows 98. I would expect the syntax below to open
 a valid file handle.
 
   open(FILEHANDLE, system(ipconfig)|) or die Cannot open;
 
 Instead I get the Cannot open message. Can someone throw any light on
 this?

open FH, 'ipconfig|' or die ipconfig: $!;

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Any help appreciated - unusual cookie request

2002-09-26 Thread $Bill Luebkert

Norris, Joseph wrote:
 Here is the situation: I am on an network of windows boxes with apache
 running on one of the boxes. I have my web apps there with perl/mysql etc..
 I want to build a script that will be run in the users login script that
 will take the username via $ENV{USERNAME} and build a cookie do a request to
 the server so that the cookie will be built on the users box containing the
 user's USERNAME, so that I can use cgi-cookie and know who is there. What I
 have attempted so far. I have a cookie built on the opening page of my
 intranet site. The cookie contains a bogus value. In the login script I had
 a script that runs out and finds the cookie file no matter where it is on
 the user's disk, slurps it and writes it back out with the $ENV{USERNAME}. I
 use all the same delimiters for records etc and the file looks exactly the
 same (or so I think) as the original cookie file. However the browser spots
 the different fast - won't access the cookie and then trashes even when I
 set expire to 01/01/2045. Any and all observations appreciated. 

I would just use HTTP basic authentication - they only have to login once
and they can have their browser remember the login if they wish (for later
instantiations of the browser).

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Question about $ENV{} Apache CGI

2002-09-25 Thread $Bill Luebkert

Norris, Joseph wrote:
 Hello,
 
 I am trying to get the $ENV{USERNAME} with my perl Cgi script. I did some
 testing and got the following:
 
...
 Notice:  there is not AUTH_USER OR USERNAME.  

REMOTE_USER is set only after the user has been authenticated.

 What am I doing wrong.  Do I need to change something in Apache
 configuration?

Put the script in a protected area and log in first.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: FTP using Win32:Internet

2002-09-19 Thread $Bill Luebkert

Nakamura, Hisashi wrote:
 Thank you, Trevor.
 Your sample is helpful.
 However, the timeout value I set doesn't do.
 The timeout occurs in 45 seconds regardless of the timeout value.
 I wonder what's wrong.
 
 Apart from this, how can we change the directory of local host, which we can
 do it by lcd command when executing FTP by windows/NT commands?

Have you tried 'chdir' ?

Net::FTP is usually a better choice for FTP for several reasons including
portability.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: error of sample perl codes

2002-08-26 Thread $Bill Luebkert

liming zhao wrote:
 hey, my cgi in perl have some problems. I need help so much .
 
 Thanks in advance.
 
 
   CGI Error
 
 The specified CGI application misbehaved by not returning a complete set 
 of HTTP headers. The headers it did return are:
 
 Bareword found where operator expected at C:\website\cgi-shl\guest-book.cgi line 29, 
near Email: pre http://127.0.0.1/cgi-shl/mailto
 
 ===
 
 I runs activeperl on winXP pro with IIS 5.0.
 
 the form is as following:
 
 html
 titleguest-book.html/title
 h1forum/h1
 form method=post action=/cgi-shl/guest-book.cgi
 pname?input name=name size=20
 pemail:input name=email size=30
 psuggestion?textarea name=suggest cols=30 rows=4/textarea
 /textareap
 input type=submit value=submit
 input type=reset value=cancel
 /form/html
 
 form method=post action=/cgi-shl/guest-book.cgi
 
 ==
 
 the following is the cgi written in perl.
 
 #! perl
 
 printContent-type:text/html\n\n;
 read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
 @pairs=split(//,$buffer);
 foreach $pair(@pairs){
 ($name,$value)=split(/=/,$pair);
 $value=~tr/+//;
 $value=~s/%([a-f A-F 0-9][a-f A-F 0-9])/pack(C,hex($1))/eg;
 $FORM{$name}=$value;
 }
 printtitleforum/title;
 printh1forum/h1;
 
 foreach $check(values%FORM){
 if($check eq){
 printhr size=3;
 printh2forum;
 exit(0);
 }
 }
 
 $FORM{'suggest'}=~s/cM\n/br\n/g;
 
 $filename=c:/website/htdocs/book.html;
 
 open(FILE, $filename);
 print FILE ???$FORM{'name'}br\n;
 print FILE Email:a href=mailto:$FORM{'email'} 
 $FORM{'email'}/abr\n};

You have quotes embedded in quotes.  Either escape the inner quotes (\) or
replace the outer quotes with something like:

print FILE qq!Email:a href=mailto:$FORM{'email'}$FORM{'email'}/abr\n}!;
or
print FILE EOD;
Email:a href=mailto:$FORM{'email'}$FORM{'email'}/abr
EOD
 print FILE suggestions?$FORM{'suggest'};
 close{FILE};
 
 print h2thanks for your suggestion/h2;
 
 printa href=\book.html\please observe the forum/a;
 
 
 exit(0);

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: PPM

2002-08-11 Thread $Bill Luebkert

Robert M. Free wrote:
 PPM doesn't seem to recognize that various modules have been installed.
 CGI, LWP, etc are all installed and functioning, but PPM doesn't seem to be
 aware of them.
 
 Is installing a PPM package different from installing a perl module?

Not really - just a mechanism to do it for you.

 If so, what's the best way to upgrade my modules, such as LWP?

The verify command in PPM has an upgrade arg - try that:

verify [--location=location] [--upgrade] [--force] [package1 ... packageN]

perl ppm
PPM verify --upgrade

should upgrade them all.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Configuring @INC

2002-08-11 Thread $Bill Luebkert

Robert M. Free wrote:
 How do I configure ActivePerl to include additional paths in @INC?

Easiest would be to set PERL5LIB or PERLLIB in your environment.

Or use 'use lib' syntax to include.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Perl modules on Win2K

2002-08-09 Thread $Bill Luebkert

David Kent wrote:
 Hi,
  
 I am running win2k server with Apache 2.0.39 and Activestate's active 
 perl 5.6.  I am trying to configure my webserver to be my own 
 live journal server for the fun of it.  It requires some Perl modules 
 before I can get in to though.  I am not very knowledgeable in Perl 
 unfortunately.  I have all the pre-requisites installed except 5.  Now 
 is where it comes down to two questions.  The first question goes to the 
 libwww-perl-5.65 module.  I run the perl makefile.pl command and all 
 goes well.  I then run make and I get a error of:
 makefile:822: *** missing separator. stop.
  
 Now what I did was download the file and unzipped it to a folder and am 
 running the make commands from just the command prompt in this folder.  
 Is this wrong?  Is libwww-perl not compiled properly for win32? 
  
 The other problem I have is I know that the other four perl modules need 
 to be compiled but I do not know how to do so.  Is there a good 
 reference how to compile modules for win32?  Or could someone give me 
 directions.  I have the make utility for win32 as well as a c and a c++ 
 compiler.  Do I need anything else? 
  
 Any help given would be greatly appreciated.  I am at wits end here. 

If you don't need to compile your own Perl, download your modules from
the AS repository using PPM.

cd c:/perl/bin
perl ppm# or use ppm.bat

Follow the help instructions - basically 'install modulename',
'search partialname', etc.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: LWP::UserAgent -- Class Info

2002-07-11 Thread $Bill Luebkert

Paul Holder wrote:
 
 The previous topic on LWP::UserAgent begs the question of
 class information for the UserAgent.
 
 For example what other arguments can be passed to 'header' object?
 
 Any documentation pointers would be welcome.

Not sure exactly what you are asking, but I would think any valid HTTP
header.  From HTTP::Headers module (a list of headers in the order they
are processed):

my @header_order = qw(
Cache-Control Connection Date Pragma Transfer-Encoding Upgrade Trailer Via

Accept Accept-Charset Accept-Encoding Accept-Language
Authorization Expect From Host
If-Modified-Since If-Match If-None-Match If-Range If-Unmodified-Since
Max-Forwards Proxy-Authorization Range Referer TE User-Agent

Accept-Ranges Age Location Proxy-Authenticate Retry-After Server Vary
Warning WWW-Authenticate

Allow Content-Base Content-Encoding Content-Language Content-Length
Content-Location Content-MD5 Content-Range Content-Type
ETag Expires Last-Modified
);

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: forwarding an email address to a perl program and saving themessage!!!

2002-07-10 Thread $Bill Luebkert

[e]agLrT wrote:
 
 so, can you tell me what to write into the .forward file? i do not know what
 to write into my program, either, i mean i do not know how to set the STDIN
 and the other things.. thanks again...
 PS: i havent bought any server yet, it may be unix, linux or maybe win...

.foward is a NIX thing - not Windoze.  You'll have to read the NIX man pages
to get the full syntax - but it's similar to the alias syntax.

You should be able to pipe each message to a perl script with something like:

|/usr/bin/perl /home/you/bin/handle_my_mail.pl

The message should be on STDIN for the script.  You'll need to do some
testing to double check the functionality.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: LWP::UserAgent-- how to load ?

2002-07-10 Thread $Bill Luebkert

Yeoh Yiu wrote:
From the new PERL LWP book:
 The first example I tried doesn't work.
 
 Should I 
   use LWP;
 or
   use LWP::UserAgent;
 ?
 The both failed.
 
 ##
 # ex 1-2, p11;
 use strict;
 use LWP;
 
 my $url = http://use.perl.org/;;
 my $browser = LWP::UserAgent-new();
 my $response = $browser-get($url);
 print $response-header(Server), \n;
 
 
 H:\perlperl -w up.pl
 Can't locate object method get via package LWP::UserAgent (perhaps 
 you forgot to load LWP::UserAgent?)
  at up.pl line 8.
 
 H:\perl
 
 H:\perlperl -MLWP -le print(LWP-VERSION)
 5.51

This should do if you just want the server:

use LWP::UserAgent;

my $ua = LWP::UserAgent-new();

my $url = http://use.perl.org/;;
my $req = new HTTP::Request 'HEAD', $url or die new Request: $!;

my $res = $ua-request($req) or die request: $!;
if ($res-is_success) {
print Server=, $res-header(Server), \n;
} else {
print HEAD request failed to $url\n;
}

__END__



-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: [Perl-unix-users] Perl with Java - ONCE AGAIN

2002-06-29 Thread $Bill Luebkert

karthikeyan wrote:
 Dear Bill,
 
   First of all thank you for your response.
 
   Hmmm as you know basically I am calling a java program and the output
 generated by it is what I am putting inside the variable $line so that I can
 get better solution to my problem.  Hmm the output generated by it is in
 this format :
 
 output generated by [ cctest.java ]
 ~
 output
 Using ClearCommerce SSL API Version:  release-3-8-3-17 Thu Mar 15 10:33:06
 CST 2001
 Charge Total: 20.00
 Time - Sat Jun 29 15:32:19 2002
 Ref# - 12345678
 Appr - APPROVED
 Code - 12345612345678
 Err  -
 Ord# - 12.45.92.15-1025382739-376645-13757-21
 output
 
 I just copied that block and put it into variable.  From what I see I can
 say that there is newline, not so sure about tab spacing.

If there are newlines in $line, this should work:

use strict;

print Content-type:text/html\n\n;

my $line = 'Using ClearCommerce SSL API Version:  release-3-8-3-17 Thu Mar 15 10:33:06 
CST 2001
Charge Total: 20.00
Time - Sat Jun 29 15:32:19 2002
Ref# - 12345678
Appr - APPROVED
Code - 12345612345678
Err  -
Ord# - 12.45.92.15-1025382739-376645-13757-21';

my %hash;
while ($line =~ /\G.*?([^ :-]+)\s*[:-]\s*([^\n]+|)\n/g) {
$hash{$1} = $2;
}

for (sort keys %hash) {
print $_ = $hash{$_}\n
}
exit 0;

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: force ssi to utc ???

2002-05-30 Thread $Bill Luebkert

Michael D. Schleif wrote:

 Jing Wee wrote:
 
How can I force an ssi to use utc, rather than system localtime?

!-- #echo var = DATE_GMT --

 
 I guess I was not as clear as I might be.
 
 I am particularly interested in the `flastmod' and LAST_MODIFIED
 constructs.  I would like to be able to do this in utc:
 
   !--#config timefmt=%Y%m%d%H%M$%S--
 
   !--#flastmod virtual=./index.html--
 --OR--
   !--#echo var=LAST_MODIFIED--
 


I though this might work, but it didn't:


!--#set var=TZ value=GMT--

You can always write your own script to handle the GMT times using
something like this:

   !--#include virtual=/cgi-bin/myscript.pl?zone=GMTflastmod=./index.html--

and then just parse the args in your script to determine what to send back.
-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: The reuqested file size (fwd)

2002-05-24 Thread $Bill Luebkert

evgeny tsurkin wrote:

 On Thu, 23 May 2002 [EMAIL PROTECTED] wrote:
 Thanks.
 Is there an interface for this in  
 HTTP/HTTP::Request modules  is there something to do the same
 for respones created on the fly?


Very poorly worded, but I think you mean more like this:

my $ua = LWP::UserAgent-new or die new UserAgent: $!;
my $req = new HTTP::Request 'HEAD', $url or die new Request: $!;

You should be able to handle a dialog with a server useing LWP UA.
-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: CGI-Lite and uploads

2002-05-13 Thread $Bill Luebkert

Chad Wallace wrote:

 Hello,
 
 I've been trying to get a file upload to work.  I was first using CGI.pm, but it was 
giving me problems, and I couldn't figure it out.  
 
 I decided to switch to CGI::Lite, and the uploads seemed to work.  However, they 
never were working.  The $form-{'upload'} variable was simply returning the name of 
the file on the client machine, which just happened to be the server machine... so 
when I opened the file, it was opening the original file, and bypassing the upload 
entirely.  Of course, when I then tried to upload something from another machine, it 
wouldn't work.
 
 Now, I changed my script to use a filehandle instead of a filename, and put in 
$cgi-set_file_type('handle') before the parse_form_data...  But it still returns 
the CLIENT-SIDE FILENAME in $form-{'upload'}, which gives an error when I try to use 
it as a filehandle!!
 
 'upload' is the name of my input type=file.  Is there another, undocumented, 
method to access the filehandles of uploaded files?
 
 Any ideas here?


Looks to me like CGI-Lite has Win32 bugs in it.  I made the following changes and it 
seemed to work:


466a467,468
  use vars qw(print_form_data print_cookie_data); # $Bill 5/13/02
 
980a983
  binmode STDIN;# $Bill 05/13/02
1064,1065c1067,1071

 $self-{web_data}-{$field} = $new_name;
---
  if ($seen-{$field}  1) {# $Bill 05/13/02
push @{$self-{web_data}-{$field}}, $new_name; # $Bill
05/13/02
} else {# $Bill 05/13/02
$self-{web_data}-{$field} = $new_name;
}   # $Bill 05/13/02
1071a1078
  binmode $handle;  # $Bill 05/13/02
1159a1167
  binmode $handle;  # $Bill 05/13/02 (may not be needed)


RCS format:


a466 2
use vars qw(print_form_data print_cookie_data);

a980 1
 binmode STDIN;
d1064 2
a1065 5
 if ($seen-{$field}  1) {  # $Bill 05/13/02
 push @{$self-{web_data}-{$field}}, $new_name;
 } else {
 $self-{web_data}-{$field} = $new_name;
 }
a1071 1
 binmode $handle;
a1159 1
 binmode $handle;


My test script (Win98/Apache) - handles mult file uploads:

#!perl -w --

use strict;
use File::Copy;
use CGI::Lite;
use Data::Dumper; $Data::Dumper::Indent=1;

my $tmpdir = C:/temp; # place to store files - change me if you like
my $use_rename = 1; # set to use rename instead of file copy
my $use_tmpfilename = 0;# use tmpFileName method (not working in 2.752)
my $d = 0;  # set to 1 for debug prints
$| = 1 if $d;

sub print_error;

# Sample calling form:

# FORM METHOD=POST ENCTYPE=multipart/form-data ACTION=/cgi-bin/upload.pl
#   File to uploadINPUT TYPE=FILE NAME=filename SIZE=32
#   File to uploadINPUT TYPE=FILE NAME=filename SIZE=32
# 
...more of above if needed
#   INPUT TYPE=SUBMIT VALUE=Upload
# /FORM

# output content header

BEGIN {
print Content-type: text/html\n\n;
 use CGI::Carp qw(carpout fatalsToBrowser);
 carpout (\*STDOUT);
}

# get filename args

my $cgi = new CGI::Lite or die new CGI: $!\n;
$cgi-set_platform ('UNIX');# PC|UNIX|Mac line endings (I use UNIX on PC)
$cgi-set_file_type ('handle'); # 'handle' or 'file'
$cgi-add_timestamp (1);# 0=noTS, 1=TS all files, 2=TS only if exists
$cgi-set_directory ($tmpdir) or die set_directory($tmpdir) error: $!;

my %F = $cgi-parse_form_data;
$d = 1 if $F{debug};
print Data::Dumper-Dump([\%F], [qw(%F)]) if $d;

my @filename = $cgi-get_multiple_values($F{filename}); # must match form name
print PB\@filename=@filename/B/P\n if $d;
print_error (Missing filename arg\n) if @filename  1;

# start HTML

print EOD;
HTML
BODY
CENTER
H1Results of file upload/H1

EOD

# do for each file to upload

foreach (@filename) {

# skip empty slots

next if length $_  1;

# extract just the filename

print PBfilename=$_/B/P\n;
(my $file = $_) =~ s/^.*?([^\\\/]+)$/$1/;
my $tmppath = $tmpdir/$file;
print PBfile=$file, tmppath=$tmppath/B/P\n if $d;

# check file size on disk

my $size = -s $tmppath;

print PBFile '$_' uploaded to '$tmppath', size=$size/B/P\n;
}

print EOD;
/CENTER
/BODY
/HTML
EOD

$cgi-close_all_files;

exit 0;

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub print_error {

print EOD;
HTML
BODY
CENTERH1$_[0]/H1/CENTER
/BODY
/HTML
EOD

exit 0;

}

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

__END__



-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com

Re: Net::SMTP and HTML

2002-04-25 Thread $Bill Luebkert

Jenda Krynicky wrote:

 From: Kevin James [EMAIL PROTECTED]
 
Is it possible to send HTML mail with Net::SMTP? Is there a snippet
anywhere?

 
 I do not use Net::SMTP so I can't provide a real snippet. You just 
 need to add
 
   MIME-version: 1.0
   Content-type: text/html
 
 to the message headers.


Only if you want it to render as HTML.  :)


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: File upload from inside perl script

2002-04-21 Thread $Bill Luebkert

Erik A wrote:

 
 I normally use a html form to manually upload zip files to a web server. 
 A perl script on the server takes care of the form/files submitted.
 
 I now would like to upload the files automatically from a perl script 
 instead. Hence I would like to send my files from a perl http client for 
 acceptance by the perl script on the server.
 
 Can someone please guide me on this or point me to info on some web 
 page? I already have a perl http client which handles GET/POST ok. But I 
 am lost on what headers to specify etc in order to make the two perl 
 scripts communicate and the files to be sent.


Easiest thing to do is dump the data that is sent by the client browser
on an upload.  Then try to duplicate it either with sockets or LWP.  I
think LWP should be able to replicate it close enough.  If I get a chance,
I'll try to make a snippet.

This is what the data stream looks like from Netscape for a jpg (comments
are mine and the data is truncate in the middle):

POST /cgi-bin/upload.pl HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (Win98; U)
Host: localhost2:81
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en,en-GB
Accept-Charset: iso-8859-1,*,utf-8
Content-type: multipart/form-data; boundary=---15194274615570
Content-Length: 4910
blank line then start of body:
-15194274615570
Content-Disposition: form-data; name=ACTUAL   1st form arg name

sample.jpg 
1st form arg value
-15194274615570
Content-Disposition: form-data; name=FILE; filename=C:\Tmp\ddprev.jpg
Content-Type: image/jpeg

ÿØÿàJFIF 
truncated data sample
...
Ûþ=ÿ¯ÿÙ
-15194274615570--

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

MSIE version of above:

POST /cgi-bin/upload.pl HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---7d00385b4
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Host: localhost2:81
Content-Length: 4897
Connection: Keep-Alive
blank line then start of body:
-7d00385b4
Content-Disposition: form-data; name=ACTUAL   1st form arg name

sample.jpg 
1st form arg value
-7d00385b4
Content-Disposition: form-data; name=FILE; filename=C:\Tmp\ddprev.jpg
Content-Type: image/pjpeg

ÿØÿàJFIF 
truncated data sample
...
¯ÿÙ
-7d00385b4--


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: File upload from inside perl script

2002-04-21 Thread $Bill Luebkert

Erik A wrote:

 
 I normally use a html form to manually upload zip files to a web server. 
 A perl script on the server takes care of the form/files submitted.
 
 I now would like to upload the files automatically from a perl script 
 instead. Hence I would like to send my files from a perl http client for 
 acceptance by the perl script on the server.
 
 Can someone please guide me on this or point me to info on some web 
 page? I already have a perl http client which handles GET/POST ok. But I 
 am lost on what headers to specify etc in order to make the two perl 
 scripts communicate and the files to be sent.


This script should handle the upload.  THere are two versions.  One passes
an additional argument called ACTUAL (to rename the file to after upload -
in addition to the 'filename' arg) which should give you an idea of handling
more than just the upload file as an arg.


use strict;
use Data::Dumper; $Data::Dumper::Indent=1;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);

my $use_actual = 0; # one script has an ACTUAL name arg to send
my $URL = 'http://l4/cgi-bin/ul.pl';
$URL = 'http://l4/cgi-bin/upload.pl' if $use_actual;
my $actual = 'First_56k.gif';   # name I will rename to
my $File = './56k.gif'; # local path to file

my $ua = new LWP::UserAgent;
my $req;
if ($use_actual) {
$req = POST $URL, Content_Type = 'form-data',
  Content = [ ACTUAL = $actual, filename = [ $File ] ];
} else {
$req = POST $URL, Content_Type = 'form-data',
  Content = [ filename = [ $File ] ];
}
print Data::Dumper-Dump([$req], [qw(req)]) if $debug;

my $res = $ua-request($req) or die request: $!;
if ($res-is_success) {
print $res-content();
print Data::Dumper-Dump([$res], [qw(res)]) if $debug;
}

__END__


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: howto display text file as it is

2002-04-11 Thread $Bill Luebkert

Bro Ji wrote:

 1. Your file contains \r\r\n (\015\015\012) sequences. It occurs when a file with 
\r\ns is read into Perl script some binary way and then written out in a text 
mode. In text mode all \n are changed to \r\n (and so \r\n are changed to 
\r\r\n)


Not that I saw - it contains \r\n as normal when downloaded via the Perl script
URL he provided.


 2. The file contains some HTML tags and tag-like parts too. The IE forces to parse 
it as HTML then for M$ applications use to think they are ever smarter then you are.  
 
 If you want to show *this* file like is *intended* (not like it realy is) you have 
to use something like this:
 
 if (open TXT1,G:/Dropbox/SMatte/WebRoot/test/bs.txt) {
   $buffer = join '', (TXT1);
   $buffer =~ s/([^]+)/lt;$1gt;/g;# it converts tags to text
   $buffer =~ s/\r\n/\n/g; # \r\r\n are changed back to \r\n if the 
file is read in text mode
   print Content-type: text/html\n\n;
   print pre$buffer/pre; # white spaces are preserved 
 }


In Windoze, the \r\n is converted to \n on reading and back to \r\n on writing
(assuming you are not in binary mode), so there should be no need for the s/// above.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: the hash is empty

2002-04-10 Thread $Bill Luebkert

Flowers, Jay wrote:

 In the Komodo debugger and the command line debbuger and on the command line
 this script does exeactly what it looks like it would do.  But in a browser
 the hashref $scan is empty and I have no idea why.
 
 Here is the cgi script:
 
 
 use Hotfix;
...



 sub scan_results {
 my $host = shift;
 $host =~ s/(.*)/$1/;
 my $scan = Hotfix::Scan($host); #returns a hashref
 my @n = (keys %{$scan}); #how many keys

...


What is Hotfix and is it available to the CGI script when run under a
webserver ?

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: howto display text file as it is

2002-04-10 Thread $Bill Luebkert

Enye Software wrote:

 I think what you looking to do is this:
 
 if (open(TXT, G:/Dropbox/SMatte/WebRoot/test/bs.txt)) {
  print join('',TXT);
  close(TXT);
 }
 
 Check out the ActivePerl documentation file in C:\Perl\Docs\ActivePerl.chm
 provided you installed Perl on your C: drive.
 
 Also get the Perl Cookbook and  Programming Perl from O'Reilly.
 Indespensible for newbies.


I think you missed the point.  THe problem is that MSIE refuses to
use the content-type and uses the file ext (or who knows what else)
instead.

Fix: use Netscape or another non-M$ browser. :)
-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: How to do FTP using Win32:Internet

2002-03-13 Thread $Bill Luebkert

Eric Sun wrote:

 Hi, Experts,
 
 I try to the following:
   a). Log on to a subdirectory of FTP server, get some files from there;
   b). log on to another FTP server, upload those files I got.
 Is Win32:Internet a good choice?
 
 Please direct me to right resource or send me sample code. I never do it
 before, need a lot of help.


I would think that Net::FTP is more portable.


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: System Command Hangs Perl

2002-03-12 Thread $Bill Luebkert

Forward Design wrote:

 I have Windows 2000, latest Apache installed for Windows, and latest 
 Active Perl installed.
 

Please read my Apache mini-FAQ on my Tripod site (address in .sig).

 
 I am very new to this, but this is what I can already do and have working:
 
  
 
 I can access a webpage that I placed in the htdocs folder from my IP 
 address.
 
  
 
 I can run a simple perl script.
 
  
 
 Here is what I want to do:
 
  
 
 I want to have a webpage, when a user clicks on a button, it runs a perl 
 script
 
  
 
 on my server (my machine), that then runs a Windows program on the 
 server, which
 
  
 
 spits out a file, that the user can then download.
 
  
 
 No, I am not trying for the user to see the GUI of the windows program.
 
  
 
 The windows program, will eventually have no interface, just run, do its 
 work, and exit.
 
  
 
 My problem is this, I have an HTML page with a button, that calls my 
 perl script.
 
  
 
 The perl script is using the command:
 
  
 
 system('d:\myprog.exe');


Try using the built-in 'unlink' function instead.



 When that command is executed, my machine just sits there.
 
  
 
 I see that 'myprog.exe' is listed in the Task Manager, but I cannot end 
 that process, permission denied.
 
  
 
 I can type into a dos window 'perl myperlscript.pl', which contains the 
 system
 
  
 
 command above, and sure enough, my program pops up (right now, the windows
 
  
 
 program does have a GUI).
 
  
 
 The GUI is not a problem, I have tried this, and others, something 
 simple, and it still hangs:
 
  
 
 system('delete d:\crap.txt');
 
  
 
 The Apache error logs never gets filled in, because the script never 
 stops, it hangs.
 
  
 
 What am I doing wrong?
 
  
 
 I know this must be a stupid problem/answer, but I need help.
 
  
 
 How does one have a perl script, called from an HTML page, run a windows 
 exe?


One normally avoids this sort of thing.  If you really must, try more 

like this (untested in this form):

my $shell = 'C:\\windows\\command.com /C';
my @systemargs = ($shell, 'delete', 'd:\crap.txt');
my $ret = system (@systemargs);

delete is part of your shell functionality (use cmd.exe vs command.com if
not on 9x).

Sample download script:

use strict;

my $path = 'c:/rootdir';# example path to download files
my $file = 'image.gif'; # example (or get from args)
my $mimetype = 'image/gif'; # example (or create hash for .ext)
my $size = -s $path/$file;# get file size
$size or die $path/$file: empty file;

open IN, $path/$file or die $path/$file download: $!;
binmode IN; # needed on Win32 for binary files

# these headers in one combination or another should handle the popup getting
# the right filename on the download (instead of script name)

print EOD;
Content-type: $mimetype; name=$file
Content-disposition: attachment; filename=$file
Content-length: $size

EOD
# I'm told no quotes around $file on Content-Disposition header for MSIE ??

binmode STDOUT; # needed on Win32 for binary files
#print IN;# this would be fine for text vs sysread/write

# using block read/write instead of above print (better for binary data)

while (sysread (IN, my $buf, 4096)) {   # 4096 is arbitrary choice for blksize
syswrite STDOUT, $buf, length $buf;
}

close IN;

__END__


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Net::Ftp Perl gives error msg when calling get()

2002-02-08 Thread $Bill Luebkert

[EMAIL PROTECTED] wrote:

 Hi,
 
 I am writing a small script that uses Net::FTP module to get/put a file
 to/from a FTP server running on NT.
 Everything works fine, but when I try to get the file perl gives the
 following error message:
 
 
Can't use string (1) as a symbol ref while strict refs in use at

 C:/Perl/site/lib/Net/FTP.pm line 474. 
 
 Even the file is created localy with the length 0!
 I am using Perl 5.6.1 on NT 4.0 sp6a.
 
 Here is the script:
 
---
 use Net::FTP;
 #
 # FTP DownLoad  #
 #
 
 sub MyFTPDownLoad
 {
  my ($ip,$userid,$password,$dir,$filename) = @_;
  $ftp = Net::FTP-new($ip, Debug = 1, Hash = 1);
  $ftp-login($userid,$password);
  $ftp-cwd($dir);
  $ftp-binary();
  $ftp-get($filename,$filename);
  $ftp-quit;
  undef $ftp;
 }
 
 MyFTPDownLoad('secret','secret','**','/Dir1/Dir2','filename.zip');
 
---
 
 What is the problem here? Can any body help me???
 Regards,


There's a bug in the Hash logic.  You could replace line 90:

  $ftp-hash(exists $arg{Hash} ? $arg{Hash} : 0, 1024);

with:

  $ftp-hash(exists $arg{Hash} ? (\*STDERR, 1024) : (0, 0));

to fix the module or leave Hash = 1 off your new call.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: last number

2001-12-18 Thread $Bill Luebkert

Zol Bes wrote:

 Hi Lists,
 
 I've got a whole (unsigned integer 0-x) number (decimal)  how can I get
 simply the last (ones) char.
 
 eg.
 $numb=456;
 I need
 $last=6 ; ##how can I get the last (charakter/number) simply;


Quickest would probably be:

my $last = substr $numb, -1, 1;


-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: regular expression question

2001-12-11 Thread $Bill Luebkert

Roee Rubin wrote:

 Hello,
 
 This question involves splitting up a paragraph, take for example the
 following paragraph:
 
 Nine state attorneys general argued Friday that Microsoft must offer a
 stripped-down version of its Windows operating system and make its leading
 Office software compatible with competing operating systems
 
 I would like to split the paragraph into two parts (which ultimately will be
 displayed in two pages). The trick, however is that I do not wish to split
 in the middle of the word. I have a budget of, lets say 99 characters which
 will split the word its right in the middle. I would like page to
 essentially display up to character 99 minus first (or last) white space (I
 think that makes sense).
 
 The second page will display from character 99 (minus the white space) until
 the end.
 
 The end result in this case should look like this:
 
 Page 1
 
 Nine state attorneys general argued Friday that Microsoft must offer a
 stripped-down version of
 
 Page 2
 
 its Windows operating system and make its leading Office software
 compatible with competing operating systems


Try Text::Wrap

or maybe try RE like this:

$_ = Nine state attorneys general argued Friday that Microsoft must offer a 
stripped-down version of its Windows operating system and make its leading Office 
software compatible with competing operating systems;

$_ = wrap_text ($_, 99);
print;
exit;

sub wrap_text { # returns line count and modifies string in place
local $_ = shift;
my $len = defined $_[1] ? $_[1] : 72;
s/(.{1,$len}\s)/$1\n/gs;
$_;
}

__END__

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: env problems ... please help

2001-12-07 Thread $Bill Luebkert

Kristofer Wolff wrote:

 hi folks,
 
 i write a tiny webserver in perl, and have a problem with the Query_String.
 in the server i set up this:
 
   if ($r-method eq 'GET')
   {
   my $get = print $r-url();


$get will have the return from print in it (undef or 1 I believe), not
the URL.  Something like this may be more to your needs:

my $get = $r-url();
print $get;

If you aren't using strict at the start, you're probably making a mistake. :)


   ($url, $ENV{QUERY_STRING}) = split(/\?/, $get);
   }
 
 to get the string behind the '?' as the Query. than i open a .pl given by
 the url:
 
   if($INTERPRETER{$inter})
   {
   $out = `$INTERPRETER{$inter} $file`;
   $c-send_response($out);
   }
 
 it runs fine ! BUT:
 if I run a env.pl like
 $serversystem = $^O;
 print SERVERSYSTEM = $serversystem;
 print hr;
 print env:hr;
 @key = keys %ENV;
 print table;
 foreach (@key)
 {
   print trtd$_ /tdtd$ENV{$_}/td/tr;
 }
 print /table;
 print hr;
 exit;
 
 there is no query at all !
 
 My problem is, i have a website with many forms ( Get AND post ) how can i
 use it in my perl server ?



-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
  (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/

___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: non-blocking sockets that work in Perl?

2001-11-08 Thread $Bill Luebkert

Tim Valdez wrote:
 
 Is there a Perl module that allows you to open and use non-blocking TCP
 sockets that actually works? Every time IO::Socket opens a non-blocking
 socket it immediatly returns an error when I try to use it. any suggestions?

You need to use IO::Selct along with IO::Socket.  Then only read a socket 
that can_read says has data and only read data till you get less bytes than 
what you ask for before going back to can_read to check for more.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Passing by name to a sub

2001-10-11 Thread $Bill Luebkert

Boyd, David wrote:
 
 after a bit of though on this, I changed the interface to the function to
 only accept the hash.  I then put a die in there if the eval failed.  this
 does the trick.
 
 but what is the correct way for me to call a sub with a reference so the sub
 can change the value of the reference and the caller can see that change?

The sub can change the referenced value by dereferencing that 'pointer'.
Check out perlref and perlreftut pod/man pages.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Passing by name to a sub

2001-10-10 Thread $Bill Luebkert

Boyd, David wrote:
 
 Hello All
 
 I would like to do the following.  I have created a .pm.  I am passing it a
 hash table.  the .pm file takes the information from the hash, executes a
 query and then sends back the results.  What I was also trying to do was
 have the sub send back a message string also.  So I tried the following:
 
 IRS_Util::getOptions(%myHash,*errMsg)

Normally this would pass vrbl refs like (\%myHash, \$errmsg);
But not sure what you are doing in there.

 inside getOptions I have
 local(%localHash,*localMsg) = @_;
 
 $localMsg = just a test;
 
 and then after the call to this function i print out this message, and I get
 nothing but a blank.
 
 So, what the heck am I doing wrong here?

Need more code.

--
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: cookies n stuff...

2001-10-10 Thread $Bill Luebkert

 Franki wrote:
 
 
 Hi all,
 
 I am trying to get a perl script that sets and retrieves cookies working in 
activeperl...
 
 The script works great on linux, but win2000, activeperl 5.6 and IIS5 doesn't like 
it, no cookie set or retrieved...
 
 The script used the old cookie-lib.pl, and I thought that might somehow be the cause 
of the problem, so I am trying to port it over to CGI::Cookie.
 I am looking at the documentation for CGI::Cookie, and I have tried to make it 
work as follows..
 
 Here is the code I have so far, (again, on a linux box, this sets the cookie, 
(although I have somehow clagged it from retrieving it..)
 
 Anyway, none of this works in win2000,,, and the retrival doesn't work properly in 
Linux.
 
 Any ideas anyone ???
 
 Kindest regards
 
 frank
 
 The Nasty code in Question...
 
 sub SetCookies
 {
 use CGI qw/:standard/;
 use CGI::Cookie;
 
 
 
 $cookie{'cart_id'} = $cart_id;
 
 # Set the domain to be correct for your domain
 
 $domain = $sc_domain_name_for_cookie;
 $secureDomain = $sc_secure_domain_name_for_cookie;
 
 # The path to your 'store' directory
 
 $path = $sc_path_for_cookie;
 $securePath = $sc_secure_path_for_cookie;
 
 # Leave this as is.
 
 $secure = ;
 
 # Cookie will expire in 24 hours
 
 $now = time;
 
 # Second in twenty four hours
 
 $twenty_four_hours = 86400;
 
 $expiration = $now+$twenty_four_hours;#number of days until cookie expires
 
 
 if(!$form_data{'secure'})
 {
 set_cookie($expiration,$domain,$path,$secure);
 }
 else
 {
 set_cookie($expiration,$secureDomain,$securePath,$secure);
 }
 
 }
 
##
 # Here we define the subs to replace cookie-lib.pl
 # Sub set-cookie and sub get-cookie.
 
 sub set_cookie {
   $cookie1  = new CGI::Cookie(-name=  'cart_id',
   -value   =  $cart_id,
   -expires =  $expiration,
   -domain  =  $domain,
   -path=  $path,
   -secure  =   $secure
);
 
 print Content-type: text/html\n\n;
 print Set-Cookie: $cookie1 \n;

1) Don't post in HTML - I almost didn't answer.

2) There may be other problems, but you can start by reversing the above two lines -
   the cookie must come before the blank line.

 }
 
 sub get_cookie {
   %cookies = fetch CGI::Cookie;
   foreach (keys %cookies){
  $cookie{'cart_id'} = ($cookies{'value'});
 }
  }


-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: cookies n stuff... humble html apologies...

2001-10-10 Thread $Bill Luebkert

Franki wrote:
 
 My humble apologies,
 
 I just checked, and outlook is set to send to this list only has txt..
 
 in fact, I have the default message format set to txt as well,
 (I am on a lot of mailing lists, and I would get flamed into oblivion
 if I posted html alot.)
 
 So Its another case of M$ saying one thing and doing another...
 Strange that It doesn't seem to be predictable as to when it sends
 as html, and why i can't tell from this end(looks the same either way there)
 
 I think I might do all my email from the linux box from now on.

Apology not necessary, but accepted.  :)

Did reversing those lines make any difference to your script working ?

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: cookies n stuff... humble html apologies...

2001-10-10 Thread $Bill Luebkert

Franki wrote:
 
 Thankyou,
 
 As for the cookie script,
 
 Nope, no difference..
 
 So I took this section out of the big script and make a test script out of
 it..
 
 Then I tried stuff like this:
 
 print header(-cookie=[$cookie1]);
 
 and still it doesn't work (you can tell I read the CGI::Cookie doc, as most
 of this is cut and pasted straight from
 it.. and I can't get it to work... I have 10,00 less hairs then I did to
 start with tonight...)

This works for me (ignoring domain during testing):

use strict;

use CGI qw(:standard);

my $cart_id = '12345.67890';
my $domain = 'laptop.com.au';
#$domain = '';
my $path = '/';
my $secure = '';
my $expiration = time + 86400;

my %cookie;

get_cookie ();

if ($cookie{cart_id}) {
print header();
print Cookie set to $cookie{cart_id}\n;
} else {
set_cookie ();
}
exit 0;

sub set_cookie {

my $cookie1 = new CGI::Cookie(-name = 'cart_id', -value = $cart_id, 
  -path = $path, -domain = $domain, -expires = $expiration, 
  -secure = $secure);

print header(-cookie = [$cookie1]);
print Cookie set to $cookie1\n;

}

sub get_cookie {

my %cookies = fetch CGI::Cookie;
if (defined $cookies{'cart_id'}) {
$cookie{'cart_id'} = $cookies{'cart_id'}-value;
} else {
$cookie{'cart_id'} = '';
}

}

__END__

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: file downloading

2001-09-27 Thread Bill Luebkert

Gert Lombard wrote:
 
 Hi Edward,
 
 When downloading files, I use these headers:
 
 Content-Disposition: inline; filename=MyName.exe
 Content-Length: $filesize
 Content-Type: application/octet-stream
 
 the Content-Disposition tells the browser which name 
to use...

You could also try:

Content-type: $mimetype; name=$file

-- 
  ,-/-  __  _  _ $Bill Luebkert   
ICQ=14439852
 (_/   /  )// //   DBE Collectibles   
Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ 
(Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic 
http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: MIME::Lite on Linux

2001-09-26 Thread $Bill Luebkert

[EMAIL PROTECTED] wrote:
 
 I am experience a problem with the following code when I
 try to run it on a Linux server. The script runs fine in
 the Windows environment. On Linux is gives me a message:
The server encountered an internal error or
 misconfiguration and was unable to complete your
 request.
 I have worked with the ISP (there server appears
 configured correctly). I changed all permissions to 777,
 still get same error. I have other cgi scripts on this
 server that use sendmail and they work fine. Any
 Ideas???

1) Start with using 'use strict;' at the top (uncomment first print also).
2) Check the error log to see what the error is that you are getting.
3) Run it from the command line if possible (may need to fake a few things).

 #!/usr/bin/perl
 #print Content-type:text/html\n\n;
 
 #Parse the form data
 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 @pairs = split(//,$buffer);
 foreach $pair (@pairs){
 ($name, $value) = split(/=/, $pair);
 $value =~ tr/+/ /;
 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack
 (C,hex($1))/eg;
 $value =~ s/\n/ /g;
 $value =~ s/\r/ /g;
 $value =~ s/\cM/ /g;
 $name =~ tr/+/ /;
 $name =~ tr/_/ /;
 $FORM{$name} = $value;
   }
 $name1 = ($FORM{$name});
 
 use lib home/sites/site3/web/lib;
 use MIME::Lite;
 use strict;
 
 # for Win32 use SMTP (default is /usr/bin/sendmail)
 
 my $server = #Server path
 #my $server2 = 'ns.Zexas.com';
  if ($^O =~ /win32/i) {
 MIME::Lite-send('smtp', $server, Timeout = 90);
 } else {
 MIME::Lite-send('sendmail', /usr/sbin/sendmail -t -oi -
 oem);
 }
 
 form_select ($name1);
 
 sub form_select {
 my ($name1) =@_;
 if ($name1 eq visit)  {
   $subject1 =  'Club Visit Report';
   $info1 = 'Attached is the Club Visitation
 Report you requested';
   $path1
 = 'home/sites/site3/web/reports/visitation.txt';
   $file1 = 'visitation.txt';
 mail_it ($subject1, $info1, $path1, $file1);
 } else {
   $subject1 =  'Project Time Report';
   $info1 = 'Attached is the Project Time Report
 you requested';
   $path1
 = 'home/sites/site3/web/reports/timereport.txt';
   $file1 = 'timereport.txt';
 mail_it ($subject1, $info1, $path1, $file1);
   }
 }
 
 sub mail_it {
 my ($subject1, $info1, $path1, $file1) = @_;
 
 # create a message and send file attachment
 
 # Message body
 my $me = #my email address
 my $subject = $subject1;
 my $msg = MIME::Lite-new(To = $me, From = $me,
 Subject = $subject, Type = 'multipart/mixed',);
 
 my $info =$info1;
 $msg-attach(Type = 'text/plain', Data = $info);
 
 # Create attachment
 
 $msg-attach(Type  = TEXT,
Disposition = 'attachment',
Path = $path1,
Filename = $file1
);
 
 $msg-send;
 }
 
 #Acknowledge receiving form
 
 print EndHTML;
 htmlheadtitleRequested Reports/title/head
 body
 h2Thank You!!/h2
 The report you requested is being sent as a e-mail
 attachment to you.p
 Please select one of the options below.
 a href=../members/options.htmlReturn to options menu!
 /ap
 or
 a href=../members/reports.htmlReturn to select
 additional reports/ap
 or
 a href=../index.htmlReturn to home page/ap
 /body/html
 
 EndHTML
 
 #The dienice subroutine after this

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: A perl solution for MAILTO.EXE failure?

2001-09-26 Thread $Bill Luebkert
 to do 
about it.  Include the redirect status and URL for reference.

 Etc. Provided that you have MIME::Lite (and maybe Net::SMTP, I forget), or
 can get what you need, this is running code. You should be able to modify
 the parameters grabbed, and the format they're translated into (everything
 that gets put into $message_body) so suit your needs.

Net::SMTP could be used if sendmail isn't available (you would need to override 
the default mailer).

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Help

2001-07-05 Thread $Bill Luebkert

Syed Anwaruddin wrote:
 
 Hi ALL,
 
 I have a minor problem. I am using the statement printLocation: $zipfile
 for downloading the file to my client system. After downloading I am
 deleting the file from the Server.
 
 The code logic is, I have a parent process which starts a child process.
 Child Process does the tar and zip of files and returns it to Parent
 process. Mean While Parent Process keeps the browser busy(Not letting the
 timeout problem to occur).
 
 the part of code is:
 
 my $zipfile = assembly$now_id.tar.gz;
 
 if (($zipfile)  (-e $zipfile)) {
if (($userAgent =~ /MSIE/i)  ($current_status ne $last_status)){
 $last_status = $current_status;
 $initial_delay = 0;
 }
 elsif ( open( ZIP, $zipfile) ) {
 # print zip file
 if ( $Platform =~ /W./ ) {
 
 $file = \$zipfile;
 print Location: $temp$file\n\n;
 
 }
 else {
 
 $sitename = file:;
 print Location: $sitename$temp/$zipfile\n\n;
# print Content-type: application/x-zip-compressed\n\n;
 
 }
 #print Content-type: application/x-zip-compressed\n\n;
 
 binmode(STDOUT);
 binmode(ZIP);
 while (ZIP) {
print $_;
 }
 close(ZIP);
 unlink($zipfile);
 
 When I am trying to delete the file, I am getting error as File not found
 on the Server.
 
 How to control deleting the file($zipfile) from Server using Location
 Statement???
 
 If I use  printContent-type: aplication/x-zip-compressed MIME type I am
 getting Save As Dialog Box. but my  zipfile is not coming as default in
 Dialog Boz Selection field. No Problem Server file gets deleted and NO
 error.
 
 Code works well when  the $zipfile is not deleted from Server( I mean print
 Location: $zipfile works). Any How I am using unlink command after print
 Location: Then WHy this is giving me as FILE NOT
 FOUND
 
 Please help me controlling this scenario!!

1) You could change your location to point to a Perl script that would do the 
download and delete the file after.

2) You could have the next execution of the script remove any left over files 
from previous runs that are more than an hour or two old.

3) You could have a cron job do the same as 2).

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: How to get the given file as a Default in SaveAs Dialog Box of an application.

2001-07-03 Thread $Bill Luebkert

Syed Anwaruddin wrote:
 
 Hi ALL,
 
 I have an application where I get a *.tar.gz file. Now I want this file to
 save it on my client System. I am using an application:
 print Content-Type: application/x-zip-compressed\n\n; to save the file.
 
 This application will pop up a Save As dialog box. In this Dialog Box there
 is a Selection field.
 
 Right now, when I am trying to save the file, my URL location path ( say
 /users/syed/assembly.pl)is coming as default in Selection field of the
 application Dialog Box. I want my file say /users/syed/*.tar.gz in the
 Selection field of Appliaction Dialog Box(x-zip-compressed).
 
 Pardon me If I am wrong. I don't know how to get my file in Selection Dialog
 Box. Please help me on this.
 
 I want this to work on both UNIX and NT.

It's not the OS, it's the browser.  Try this for the download portion 
(I assume you're downloading from the Perl script - note the headers):

... code...

my $path = 'c:/rootdir';# example path to files
my $file = 'image.gif'; # example (or get from args)
my $mimetype = 'image/gif'; # example (or create hash for .ext)
my $attach = 'attachment';  # or 'inline' for an image
my $size = -s $path/$file;
$size or die $path/$file: empty file;

open IN, $path/$file or die $path/$file download: $!;
binmode IN;

# the 3 headers below are important in the scheme of things since MSIE 
# likes to use the file ext to determine the content-type

print EOD;
Content-type: $mimetype; name=$file
Content-disposition: $attach; filename=$file
Content-length: $size

EOD
# no quotes around $file after Content-Disposition header for MSIE ?

binmode STDOUT;
print IN;
close IN;

... more code...

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: AW: regexp question

2001-07-02 Thread $Bill Luebkert

Kristofer Wolff wrote:
 
 i fixed thet problem with :
 
 $subjectNF =~ s/\n//g;
 $subjectNF =~ s/^(.*)title(.*)\/title(.*)$/$2/i;
 
 why regexp has problems with newlines in the string ???

Try adding an s after the /i eg: ... =~ s/.../.../is;

You won't need to remove the newlines then.
-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Help!!Client Address

2001-07-02 Thread $Bill Luebkert

Syed Anwaruddin wrote:
 
 Hi ALL,
 
 How to get the Client IP address from the Server Ip Address???

That makes no sense - they're two different addresses.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Fixing a URL...

2001-07-01 Thread $Bill Luebkert

Franki wrote:
 
 Hi all,
 
 I have a problem I was hoping someone could help me with,
 
 I have this loop:

use URI::Escape;

foreach $tag ( sort ( keys %form ) )
 {
 
 $redirect .=  . $tag . = . $form{ $tag };
 }
 # Now re-direct the browser
print Location: $redirect\n\n;

my $url = uri_escape ($redirect);
print Location: $url\n\n;


  Basically, it is creating a post url with all the keypairs in it..
 
 I need to add a line or two to it, to check the values, and if they contain
 any spaces.. to swap the spaces to something like
 %20  so that the spaces don't cause everything after the first one to be
 ignored and not added to the url...
 
 Think I am alittle over my head here, I am still new to this but I am
 guessing that I need to add a line above:
 $redirect .=  . $tag . = . $form{ $tag };
 something to take $form{ $tag } check if it contains spaces  , and if so,
 replace them with  %20
 
 just not sure how to test the string for spaces anywhere, I think I might
 know the replace method though..





-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: ftp error

2001-06-28 Thread $Bill Luebkert

Kristofer Wolff wrote:
 
 hi folks,
 
 quik questions:
 where are the errors form the Net:FTP module ?? i can'T get there in $!.
 
 ex:
 if($ftp = Net::FTP-new($IN{ftp_server}))
 {
 #...
 }
 else
 {
 print ERR = $!
 }
 
 it prints out :
 ERR =

This works for me:

my $ftp = Net::FTP-new ($host) or die Error connecting to $host: $!\n;

You could replace the die ... with a compound stmt including a print I suppose.
-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: this list

2001-06-27 Thread $Bill Luebkert

Matt Williams wrote:
 
 How the hell do I got off this mailing list??

Read the headers of this message or the one you posted:

List-Help: mailto:[EMAIL PROTECTED]?subject=help
List-Post: mailto:[EMAIL PROTECTED]
List-Subscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web,
mailto:[EMAIL PROTECTED]?subject=subscribe
List-Id: perl-win32-web.listserv.ActiveState.com
List-Unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web,
mailto:[EMAIL PROTECTED]?subject=unsubscribe
List-Archive: http://mailarchive.activestate.com/browse/perl-win32-web/

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Problem with Form Post

2001-06-27 Thread $Bill Luebkert

Ben Wheeler wrote:
 
 I checked my references and you are correct, Mark.  $ENV{'QUERY_STRING'}
 will contain the name value pairs for all input tags in the post just as it
 does in a get.  My mistake.

QUERY_STRING does not contain the form name/value pairs from a POST.
QUERY_STRING does contain the form name/value pairs from a GET.
QUERY_STRING does contain the name=value pairs after the ? on the ACTION tag 
on both GET and POST.

 Who is this Thomas Gutenburg, by the way and what does he have to do with
 this?

Don't know.  I've heard of Johann Gutenburg - famous for his invention of the 
printing press and the Bible from same ? 

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: get directory create date

2001-06-18 Thread $Bill Luebkert

Kwan Ng wrote:
 
 i have a bunch of sub-directories that i want to parse if they were created
 within a two week period.  i know how to get the modified date on a file
 using stat, but stat doesn't work on directories.  is there a way to get the
 create date on a directory?  thanks.

Does for me.  The atime has no hh:mm:ss field, but the mod/create times are accurate.

atime=Mon Jun 18 00:00:00 2001
mtime=Mon Jun 18 09:30:38 2001
ctime=Mon Jun 18 09:30:36 2001


-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: regex question...

2001-06-13 Thread $Bill Luebkert

Schiza, Apostolia (ISS Atlanta) wrote:
 
 Hi,
 in one of my perl scripts I am trying to check for a valid ip address,
 ie in the format of XXX.XXX.XXX.XXX where x of course is digit,
 and you can have ips with each feild having 1-3 digits
 This is the regex I am using:
 
 $ip_addr =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
 (I am basically trying to say, that the given string should have 3 dots and
 the
 characters between the dots should be integers, and everything between two
 dots should have
 from 1 up to 3 characters)
 
 that's not quite working, for example it still matches strings like:
 1234.123.12.1
 12.34.23.5.60
 12.13.456.23.
 
 I have a hard time understanding regex

Try anchoring your RE at both ends (assuming all WS is gone):

$ip_addr =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;# or add \s* on both ends if WS

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Link checker

2001-06-11 Thread $Bill Luebkert

[EMAIL PROTECTED] wrote:
 
 Some small questions about security when using tools like this:
 
 Does other people get access to the web server too? If not, how are they
 kept out? Using the localhost IP-number 127.0.0.1 or (is this secure)? Are
 there other more reliable ways?

I've never used MicroWeb server, so you'll have to check it's docs.
Most servers allow at least basic authentication for security.  
The Directory command in Apache for example would allow you to 
restrict access to your site and you would need to check microweb 
docs for similar.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   Mailto:[EMAIL PROTECTED] 
  / ) /--  o // //  http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/__/_/_ Castle of Medieval Myth  Magic http://www.todbe.com/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: help w/ NT variable name(s)

2001-06-06 Thread $Bill Luebkert

Chris Van Vleet wrote:
 
 All,
 
 I would appreciate any help in where/how to reference a variable within the 
operating system (Registry Editor?) of Windows NT?
 
 I'm writing a Perl script that checks the time a file was last modified and 
determines if time is gt 24 hours. The output is simply the path/filename. Pretty 
straight forward.
 
 I need to reference the variable(s) unto which a files' 'time last modified' is 
stored, determine if scalar, array, etc. (i think the variable contains date  time 
info.) See sample code below as reference. Any advice is appreciated.
 
 $time = time;  # time function returns number of non-leap sec since 1/1/70
 $mtime, # LAST MODIFY TIME SINCE THE EPOCH (1/1/70)
 
 # subtract last modification time from current time and divide by number of
 # seconds in 24 hours
 
 $days = ($time - $mtime)/86400;

use strict;

my $dir = '.';
my $file = 'fubar.txt';

# using stat

my $mtime = (stat $dir/$_)[9];
if (time - $mtime  86400) {
# file is more than 1 day old
}

# using -M

if (-M $dir/$_  1.0) {
# file is more than 1 day old
}


-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Aliasing

2001-06-04 Thread $Bill Luebkert

raptor wrote:
 
 hi,
 
 What this DO ?
 
 %a = %b;
 
 1. %a become a copy of the whole hash %b !!

Yes.

 2. Aliasing the hashes i.e. $a{xxx} is the same as $b{xxx} and changing
 $b{xxx} will change $a{xxx} too  and vs. versa !!

Changing contents of %a won't change %b or vice versa.

 I think it is the first can U confirm ? And if it is that, how can I make
 ALIAS of var ? (not reference)

I can't think of an answer to your last question, if I understand it correctly.
I would think using a reference would be the logical way to alias the hash.
Why is an alias necessary ?

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: OT RE: Web

2001-05-24 Thread $Bill Luebkert

James Coyle wrote:
 
 I'm with the prior response by Ed - DON'T DICK WITH FONT SIZES.
 Users have their browsers set the way they want them - don't screw with it.
 
 Please take this off list.. im on other web design lists and this is the
 biggest flame troll subject. I would be great to not have to hear it again.

Well, excuse us for taking up so much of your time with a subject 
that to my knowledge hasn't come up on THIS list and isn't really that 
much off topic on the web list.

All I know on the subject is that's it's extremely frustrating when some 
ass thinks they know better than I what size font I need in HTML markup 
both in email/website.

My last post on the subject.
-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Fwd: RE: OT RE: Web

2001-05-24 Thread $Bill Luebkert

Steve Sotis wrote:
 
 Use Netscape 6, select View and set text size by percentage!

Drives me crazy - I hate it.  Got comfortable over the years with NS 
and then 6 came out and it made backwards advances (at least UI wise).

I'll stick with 4.7 until maybe 7 comes out and fixes things back to 
the way they worked on 4.x.  :)

If they could just keep the lock-ups and crashes down ...
-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: OT RE: Web

2001-05-23 Thread $Bill Luebkert

Lee Goddard wrote:
 
 Use Cascading Style Sheets, inline or linked: inline, for eg:
 
 P style=font-size:10px
 
 where 'px' is pixels; could be 'pt' for points, and there's more.
 
 Check out www.zvon.org.

I'm with the prior response by Ed - DON'T DICK WITH FONT SIZES.
Users have their browsers set the way they want them - don't screw with it.

If you must, then use relative and never go below FONT_SIZE=-1.
The way I'm set up, I can't read -2 and have trouble with -1, and 
I doubt I'm alone.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Link checker

2001-05-20 Thread $Bill Luebkert

Marcus wrote:
 
 Has anybody already created a link checker using Perl and would share
 their approach or some code?

I modified one of these (maybe 2nd) for my own use:

http://www.stonehenge.com/merlyn/WebTechniques/col14.listing.txt
http://www.stonehenge.com/merlyn/WebTechniques/col27.listing.txt
http://www.stonehenge.com/merlyn/WebTechniques/col35.listing.txt

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Link checker

2001-05-20 Thread $Bill Luebkert

Marcus wrote:
 
 On 20.05.01 at 19:24 $Bill Luebkert wrote:
 What's an internal link ?
 
 Aren't we talking HTML here ?  If so, there is no difference between
 an
 external/internal link (to my mind) - they're just links
 (IMG/HREF/etc).
 
 Yes, internal/external is something else. What I was looking for was
 the URL on a workstation. You helped me to remember that it's this:
 
 file://localhost/C:/webs/index.html
 
 The above format seems to work sofar :-)

I personally would never use that form.  If you have a webserver 
running on your PC, why not just use http://localhost/index.html
assuming c:/webs is where your htdocs dir is.  It's silly (IMO) 
to use filesystem links instead of http links since they're not 
portable.  Even so, if they are indeed links and appear in HTML 
docs, I don't see why the aforementioned scripts couldn't be used.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Fwd: $ENV doesn't have the CGI env variables it's supposed tohave

2001-05-11 Thread $Bill Luebkert

Janet Ciavarelli wrote:
 
 I have an HTML form, and call a cgi perl script. I've set the SUBMIT method to GET 
in the HTML file. I was expecting to have values populated in all the standard CGI 
environment variables, but in my perl script, when I try to print out the values, 
these variables don't even exist. In particular I was interested in QUERYSTRING and 
REQUESTMETHOD. But when I look at the contents of these in my Perl script, they're 
null. Not sure what I'm doing wrong.
 
 OS is WinNT and I'm using PWS. Do I have to set something up in PWS to get the form 
values and the CGI environment passed to my CGI script?
 
 Here's a clipping from my HTML file:
 
form name=sv_pnt method=GET ENCTYPE=text/html 
action=http://ipciavj/cgi-bin/sv_pnt.pl;
   p
input type=hidden name=map value=c:\Inetpub\wwwroot\ms_demo\example8.map
input type=hidden name=imgext value=687293.939691 5614446.916486 
688184.907107 5615339.262450
input type=hidden name=imgbox value=-1 -1 -1 -1
input type=hidden name=imgxy value=299.5 299.5
input type=hidden name=img value=/tmp/example8989602241691.gif
input type=text name=mapx value=687739.423399
input type=text name=mapy value=5614893.089468
input type=text name=map_mypoint_feature value=new
input type=text name=map_mypoint_feature_points value=687739.423399 
5614893.089468
input type=text name=layer value=mypoint br
INPUT TYPE=SUBMIT VALUE=Append
a 
href=http://ipciavj/cgi-bin/sv_pnt.pl?mapx=687739.423399mapy=5614893.089468;help/a
  /p
 /form
 
 Here's my Perl script:
 
 print $#ARGV \n; #prints the number of arguments

Actually it prints the number of the last element.  To print the actual number 
you either need to add 1 or use something like:

print scalar @ARGV, \n;

 print @_\n;
 print $ENV{QUERY_STRING}\n;
 print $ENV{REQUEST_METHOD}\n;
 print $SCRIPTNAME\n;
 
 foreach $key (keys %ENV) {
 print qq|The value of $key is $ENV{$key}\n|;
 sleep(1);
 }

 sleep(1);
 print point a\n;
 print $ENV\n;
 print $ENV{REQUEST_METHOD}\n;
 if ($#ARGV == -1  $ENV{REQUEST_METHOD} eq 'GET')
 {

Why bother to test $#ARGV ?

 print point b\n;
 GetGetArgs();
 }
 
 The output is pretty bleak. I would highlight and paste it in here, but my window 
disappears too quickly. Let's put it this way, It never gets to point b cause the 
value of REQUEST_METHOD is null and it thinks there are no arguments being passed in 
even though in the clipping of the html source, I am clearly passing arguments in. 
Any ideas?

I would consider installing Apache from apache.org (binary for Win32).
This is a much better server and has all of the bells and whistles that 
your ISP would normally have.
If you do, read my install FAQ on my Freeyellow or Webjump sites.

-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: Problem with $sock = new IO::Socket::INET

2001-05-04 Thread $Bill Luebkert

 Greg A. Anderson wrote:
 
 I am trying to run the following on an NT server to check and see if a page is there 
before linking to it:
 
 #!/usr/local/bin/perl
 
 my ($checker, $slow, %ok_status, %fail_status);
 %ok_status = (
   200, OK 200,
   201, CREATED 201,
   202, Accepted 202,
   203, Partial Information 203,
   204, No Response 204,
 );
 
 %fail_status = (
   -1,  Could not lookup server,
   -2,  Could not open socket,
   -3,  Could not bind socket,
   -4,  Could not connect,
   301, Found, but moved,
   302, Found, but data resides under different URL (add a /),
   303, Method,
   304, Not Modified,
   400, Bad request,
   401, Unauthorized,
   402, PaymentRequired,
   403, Forbidden,
   404, File Not found,
   500, Internal Error,
   501, Not implemented,
   502, Service temporarily overloaded,
   503, Gateway timeout ,
   600, Bad request,
   601, Not implemented,
   602, Connection failed (host not found?),
   603, Timed out,
 );
 
 $query = $ENV{'QUERY_STRING'};
 ($input_url) = split(/=/, $query);
 
 my ($url) = $input_url;
 my ($host, $port, $path, $sock, $line);
 my $cr = \015\012;
 
 ($url =~ m,^http://([^:/]+):?(\d*)(.*),i) and (($host, $port, $path) = ($1, $2, $3));
 $path ||= '/';
 $port ||= 80;
 $path =~ s/#.*//;
 print $port . br\n;
 print $path . br\n;
 print $host . br\n;
 $host or return undef, Can't parse host from url: $url;
 use IO::Socket;
 $sock = new IO::Socket::INET ( PeerAddr = $host,
PeerPort = 80,
Proto= 'tcp',
Type = SOCK_STREAM,
) or return undef, $@;

You're doing a return when you aren't in a sub.  Try die instead of return 
or inclose it in a sub.

 print $sock . br\n;
 $sock-autoflush(1);
 $sock-timeout(5);
 
 print $sock GET $path HTTP/1.0$cr;
 print $sock Host: $host$cr;
 my $response = $sock;
 ($protocol, $status) = split / /, $response;
 close $sock;
 
 if (exists $ok_status{$status}) {
   print Location: $url\n\n;
   exit;
 }
 else {
   print qq|html
 head
 titleWasn't there/title
 /head
 
 body bgcolor=#FF link=#FF6600 alink=#FF6600 vlink=#FF6600 
text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0
 
 center
  h1Wasn't there/h1
  $fail_status{$status}
 /center
 
 /body
 /html
 |;
   exit;
 }
 When I run it on a Linux or Unix box it runs fine but when I run it on NT I get the 
following error message:
 
 CGI Error
 
 The specified CGI application misbehaved by not returning a complete set of HTTP 
headers. The headers it did return are:
 
 Can't return outside a subroutine at d:\Inetpub\wwwroot\cgi-bin\test.cgi line 52.
 
 80
 
 /nothere


-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



Re: sending $vars to sub

2001-05-02 Thread $Bill Luebkert

Stephen A. Shaffer wrote:
 
 Bill Luebkert, might I make a suggestion?  If you want to help someone, then
 help them.  If you don't, then don't.  But keep the editorial comments
 (e.g., You should be ashamed of yourself...) to yourself.  Like Perl,
 where there is always a dozen ways to accomplish something, there are a
 dozen ways for newbies to learn things.  One of those ways is to ask
 experienced people how you do something.  There is nothing wrong with that,
 and certainly nothing to be ashamed of.  You, on the other hand, ought to be
 ashamed of youself for criticizing others just because they ask for help
 before exhausting every other possible course for finding an answer.

I beg to differ with you.  I've earned the right to answer questions pretty 
much any way I want (within reason).  There are newbie lists that may not object 
to a question like this since it's so basic, but just the smallest bit of 
reading should have gotten the poster the answer to this question.

It's not the perview of this list to replace the docs that are readily available 
with the distribution.  The poster is presumed to have read the FAQ and the 
basic core docs (at least to some extent).

Furthermore, since the poster didn't seem to object to my language, I don't 
see why you should.  After all, I wasn't abusive, just a mild chastisement 
the purpose of which was to get the poster to spend a little more time learning 
from the books/docs before posting trivial questions.  I'm sure he'll be back 
with more complicated problems as he ventures into the world of Perl.

Since this is your first post (as near as I can tell), I'll just ignore your 
suggestion till you've made a meaningful contribution yourself.

PS: Not to mention that the post was to the wrong list - should have gone to 
Win32-users.
-- 
  ,-/-  __  _  _ $Bill Luebkert   ICQ=14439852
 (_/   /  )// //   DBE Collectibles   http://www.todbe.com/
  / ) /--  o // //  Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/__/_/_http://www.freeyellow.com/members/dbecoll/
___
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web



  1   2   >