= 99
See in-line.
Gary Hawkins [EMAIL PROTECTED] wrote in message
01c2ae44$16e12c20$0201a8c0@garyha1">news:01c2ae44$16e12c20$0201a8c0@garyha1...
I have a variable using module Win32::API that would be a pointer to a
pointer
in C.
If I do:
$var = $lplpBuffer;
I have a variable using module Win32::API that would be a pointer to a pointer
in C.
If I do:
$var = $lplpBuffer;
print \$var $var\n;
$var = \$lplpBuffer;
print \$var $var\n;
$var = \$lplpBuffer[0];
print \$var $var\n;
...it prints:
$varÆ╢☺
$var
So why won't a multi-line match work with Unicode?
This from perldoc perlunicode probably applies:
WARNING: As of the 5.6.1 release, the implementation of Unicode
support in Perl is incomplete, and continues to be highly experimental.
Tried installing 5.8 but it did not go
This is an effort to write filever.exe in Perl. Filever extracts file version
information and is available in the later Windows resource kits I think, or maybe as
early as NT4. In verbose mode it prints info like this:
D:\filever.exe /v c:\windows\system32\kernel32.dll
--a-- W32i DLL ENU
=~ /VS_VERSION_INFO.*StringFileInfo/ would return nothing to $.
So why won't a multi-line match work with Unicode?
-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 08, 2002 8:00 AM
To: 'Gary Hawkins'; [EMAIL
http://www.xml.com/pub/a/2002/05/08/ws-easy.html
It is supposed to be able to compare two XML files. Has anyone used it?
Can you tell me how to install the module(s)?
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
I'm going to be working with XML files on Windows. Notice that in Notepad (on
W2K+) you can save a file with different encodings, including Unicode. These
XML files are Unicode. Opened directly in Notepad, they take on an appearance
of having extra spaces between characters.
Grep and diff
This evidently is going to be addressed in Perl6 (with respect to
here-docs).
cf. http://dev.perl.org/perl6/apocalypse/2
Pretty entertaining stuff. Something uncanny about it. Cool to watch a
programming language being designed or influence it.
... we won't make the mistake of
If you declare a variable with my() its scope will be from the
declaration to the end of the enclosing block. Which for variables
declared outside any {} block or eval means ... to the end of the
file.
Wrong.
You forgot about 'package'.
What do you mean:
#!perl -w
How many things can packages be? Is this foo a file?
No this foo doesn't have to be a file. You can have several
packages in one file and switch between them.
I don't know how to explain what ARE packages though.
Try if
perldoc perlmod
makes sense to you.
After reading perldoc
-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 11:58 AM
To: Gary Hawkins
Cc: [EMAIL PROTECTED]
Subject: RE: Scope of variables. Lost in subs
Perhaps you're missing the point.
Gee, maybe that was the reason for the question
From within perl:
-Original Message-
From: Scott Burks [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 11:56 AM
To: [EMAIL PROTECTED]
Subject: Find Files Based on Age
This might be simple, but I haven't found a solution yet. I have a
script that I use on our Unix
From within perl using built-in functions:
$modification_time = (stat($file))[9]; # seconds since epoch
$time = time; # now
$age = $time - $modification_time; # age in seconds
Gary
-Original Message-
From: Scott Burks [mailto:[EMAIL PROTECTED]]
Sent:
Is there a way to set up for starting a CMD window using a right click within
that folder somehow, so the prompt is already in that folder? This routine of
'Start Run cmd' and then D: and cd foo etc can be a little monotonous.
This is Windows 2000.
Gary
--
To unsubscribe, e-mail: [EMAIL
I have pulled the seach.html file as follows:
I went to link http://srch.overture.com) then search for word help,
then I save the result as file named search.html
Then I wrote the script below to extract and find the URLs in this
saved web page (which is not working very well).
Part II
I
Indeed I want to locate the LinkExtor.pm module.
Cheers
Bruce
Assuming you have ActivePerl installed, try these two commands:
D:\ppm search link
Packages available from
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer:
ASP-NextLink[0.11] Perl
In a private correspondence someone wrote:
The application is called FastCommandPrompt. At
http://www.webattack.com, if you enter fast command,
it is the first one which shows up on your screen.
After installation, it is a right click and the
option 'Launch Command Prompt' and you are
print CGI::header();
print hello\n;
print foo\n;
print bar\n;
foreach my $line (FILE) {
my $result = do_something($line);
}
use LWP::Simple;
my $credit_card_server = secure.mybank.com;
my $username = my_secret_username;
my $password = my_password;
for $name
Web form element names automatically become script variable names and are
assigned their values...
use CGI 'param';
for $name (param()) {
$$name = param($name);
}
The double $$ is not a typo. Your question resulting in this solution has
reduced the script I'm working on, by about 2000
;
print OUT $img;
close OUT;
print OK.\n;
} else {
print FAIL.\n;
}
Gary
-Original Message-
From: Gary Hawkins [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 6:10 PM
To: [EMAIL PROTECTED]
Subject: FW: Save
Do have a Win32 version of wget working but not use a Perl module? It's like
not breathing.
You probably don't need a perl script for this, there's this command
call wget
in linux which you can use to mirror a site, and using the -A option you can
make it download file with specified
Worked fine on the remote system, but, can someone give me the ppm install ...
url line to install LWP::Simple?
-Original Message-
From:
Sent: Thursday, March 14, 2002 8:16 AM
To: 'Gary Hawkins'
Subject: RE: Save image to disk
It looks like you didn't get a straight answer. You
Would like to save images to disk using their URL's. Hoping someone can give
me a jump start on it.
Gary
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
So __LINE__ is tricky eh? Wants to be an array?
Tried tracking(__LINE__); and got only '1'. Resorted to:
@line = __LINE__; tracking(@line);
at the end of each line in the script ending with ';' or '}', and had to
receive it in the sub like this:
$line = $_[0];
The sub reads and writes
How do I truncate a string to a particular number of characters?
You can use the substr() function, or optimize your regex:
#!/usr/bin/perl -w
use strict;
my $string;
# with substr
$string = hello word;
$string = substr($string,0,4);
print substr: $string\n;
# with a regex
-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 05, 2002 9:25 AM
To: 'Jonathan E. Paton'; [EMAIL PROTECTED]
Subject: RE: select text
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a life
Perl Dev Kit's key new features include:
PerlApp - turns your Perl programs into ready-to-run executables,
which can now be built on Win 9x and HP-UX in addition to Linux and
Solaris
He was asking, what's the difference if my file has a .pl extension or .cgi
extension.
Answer, no difference as far as Perl itself is concerned. It is the webserver
settings that matter.
To give you a couple of examples of where the difference is useful:
My ISP requires CGI scripts (whether
If you want to loop over all the form fields, you'd do:
for $field (param()) {
print $field = , param($field), br\n;
}
How can the param's be placed into a new hash?
CGI.pm has a Vars() method, I believe, which returns a hash.
use CGI;
my $q = CGI-new;
$data =
using the Perl4 cgi-lib.pl. However, I can think of no other
legitimate use. Here's a nice,
clean method of dealing with this:
use strict;
use CGI qw/:standard/;
my %form_data = map { $_, get_data($_) } param;
sub get_data
{
my $name = shift;
my
If you want to loop over all the form fields, you'd do:
for $field (param()) {
print $field = , param($field), br\n;
}
How can the param's be placed into a new hash?
I'm working with a script that uses a lot of $data{'each_thing'} from %data. I
tried replacing all instances with
CommerceSQL uses Perl and needs https, secure server. I already asked this on
their list with no reply. I don't know the first thing about secure servers.
Can somebody point me in the general direction of how to set one up on NT4?
Thx,
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
http://search.cpan.org/doc/JENDA/Mail-Sender-0.7.10/Sender.pm.html
and sending mail took a bit of code like this:
Implied... use Mail::Sender;
ref ($sender = new Mail::Sender({from = '[EMAIL PROTECTED]', smtp
= 'company.com'})) or die $Mail::Sender::Error\n;
(ref ($sender-MailMsg(
{
#!perl
@driveletters = (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z);
for (@driveletters) {
s#$#:\\#;
print $_\n if ! -e;
print $_ found\n if -e;
}
If you need to do different things based on different versions of Windows, one
way to find the particular version is
How can I check whether the system is connected?
Want to pause the script if connection is lost.
snip
Instead of trying to check whether there is an Internet connection, just
see whether you can do whatever it is your program is using the Internet
for.
snip
Peter Scott
[EMAIL
I'm a big fan of s###. Easy for me to read.
/g
-Original Message-
From: Troy May [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 19, 2002 11:45 PM
To: Perl Beginners
Subject: Substitution formats
Hello,
I only knew of one way to do them: s///
But japhy once answered
Maybe the file name has a .cgi extension? .cgi is not set for exeeute by
default. Try renaming it .pl assuming you installed ActivePerl. Or in
Internet Services Manager right click the scripts folder, and take a look at
the instructions in the attached mail of few days ago. I'm figuring
http://www.commercesql.com/ is one.
If on Winders you'll have some surgery to do, like adding a new spleen to their
code, the sendmail module. Since you have that deadline, recommend *nix.
/g
Federal Reserve needs a free package? Whew! That's some recession.
-Original Message-
1. A Virtual Directory called cgi-bin within your web site.
That was great. Just a couple points, the directory can be called cgi-bin but
doesn't need to be. I made the same changes to one called 'store' tonight on
NT4 and it works.
Secondly for security reasons I've heard it generally
Maybe the file name has a .cgi extension? .cgi is not set for exeeute by
default. Try renaming it .pl assuming you installed ActivePerl. Or in
Internet Services Manager right click the scripts folder, and take a look at
the instructions in the attached mail of few days ago. I'm figuring
I mentioned the perl debugger before but I guess some people would not have had
the GUI version available. It comes with the Perl Development Kit, so I should
clarify.
Don't know about *n*x but if you installed ActivePerl on Windows, then install
the Perl Development Kit and try:
perl -d
Uh-huh, ok. Here are the results of your query. Your search found 824,000
results:
http://www.google.com/search?num=100hl=enq=How+to+create+a+file+in+cgi
Pretty broad topic.
-Original Message-
From: Dragos Dorin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 17, 2002 7:37 PM
Here's a fairly simple little script to list directories and files recursively.
Couple questions:
-- Is it fairly simple to make it list everything in a properly indented
heirarchy? (Somewhat similar to what windows explorer would look like if every
level were expanded).
-- In the sub, how can
im wondering how i can make a subroutine that will return all text
lines between certain marks such as START and STOP:
text file:
START
text
is here
and there
is
a
lot of it
STOP
so i would like to call the subroutine with the arguments START and
STOP (because i may need more
Read through 'preprocess' subsection of the File::Find docs
(perldoc File::Find).
This might be of help to you.
I already read the fantastic manual and was hoping for something that conveys
understanding.
preprocess
The value should be a code reference. This code reference
That works.
It became tweaked a little, $page = shift to be able to alter the result, and a
'/' b/c a top-level URL without file name and without trailing forward slash
gets redirected on the server to the version with the trailing forward slash.
A little quicker. In detail, I think that
However the script continues
print @list3;
my $var1='META';
@lista= grep{$var1} @list3;## not picked up at all
print @lista
anyone any clues
Suppose I'm a little confused but perhaps you meant:
print @list3;
@lista= grep(/META/, @list3);
print @lista;
/g
--
To unsubscribe, e-mail:
with @data = sort
@data:
http://www.eskimo.com/~ghawk/temp/randplotsorted.png
Gary
-Original Message-
From: Wagner-David [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 13, 2002 9:20 PM
To: 'Roger C Haslock'; Gary Hawkins
Cc: [EMAIL PROTECTED]
Subject: RE: rand() function
Is there a script that can trace dependencies?
Something like:
trace.pl myscript.pl
myscript.pl: 'use LWP'
found /usr/local/lib/perl5/LWP
myscript.pl: $ua = new LWP::UserAgent
found /usr/local/lib/perl5/LWP/UserAgent.pm
UserAgent.pm: 'require LWP::MemberMixin'
In private correspondence, the esteemed bcc'd entity penned:
hi again.
i work with perl,
but I dont know,for what purpose you want to do that ?
for which puepose?
If you are on Windows, check out http://www.dependencywalker.com/, and open an
exe or dll in it. That provides a tree view of
Or you can install the Devel::Modlist module, and just type:
perl -d:Modlist myscript.pl
And have all the use'd and require'd modules and files needed by the
script printed.
http://search.cpan.org/search?dist=Devel-Modlist
Thank you. Sounds evil but it works. Copy to existing
1) Double clicking my Perl file within Windows Explorer opens within the DOS
window, but then closes immediately after execution.
It flashes up on the screen and closes itself. Can I prevent this auto
termination?
`pause`;
or:
system pause;
Although pause is not documented in either cmd
use LWP. it can be as simple as this :
use LWP::Simple;
print get(http://www.mit.edu;);
Tor.
Neat.
Along that line, I would like to be able to wind up with pages after retrieval
as plain text without html tags, hopefully using a module.
/g
--
To unsubscribe, e-mail: [EMAIL
Seems a good example of how every little question has some merit. You just
never know.
I've had the same problem on Windows 2000 and have been using edit.com to find
line numbers in my scripts, and it isn't real handy; it opens a small window,
navigation is slow, etc. There is probably a
system(rm -rf $file);
But if you copied this from another source, that source was totally
unaware that deletion of files like THAT is TOTALLY unsafe. A safer
approach is:
system(rm, -rf, $file);
I'm not aware of the reason for it.
What's a good way to find which perl doc contains
This newsgroup is great. I am learning alot from just reading the post
here. I hope someone will be able to help with this query.
Me too. But I learned a new word yesterday, pedantic. Just wanted to try it
out, here goes. :
Listserves: Email lists are read in an email program or on the
Example: http://www.roth.net/perl/packages/ has some packages. How can I
permanently add such a location so ppm will include it in searches.
Mainly want to install win32-registry used by GetIP.pl.
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
If the original line is testing\n, the new line will be tested\n\n.
No,
If the original line is testing\n, the new line will be tested.
If the original line is testing, the new line will be tested.
on my machine.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
to take successive pairs, and plot them on a graph. Bad generators would
show distinct lines after a while.
eg
for (0..1) {
plot rand(), read()
}
What would it require to make that do something?
ppm search plot
Packages available from
-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 2:28 PM
To: [EMAIL PROTECTED]
Subject: Re: pull line #1 from a file
Ronald Yacketta wrote:
Can someone help me fix this? I know I am on the right track (I hope)
but not sure
Recommend replacing the parsing routine, mainly because it is said to have a
bunch of security holes:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs=split(//, $buffer);
foreach $pair (@pairs)
{
($name, $value)=split(/=/,$pair);
Stuart I have a few perl files that I need to send out to a
Stuart client. However, we do not want them seeing what are in the
Stuart files for obvious reason.
What obvious reason?
That would be so the client doesn't walk away from the guys who do the work
once they have the goods.
Stuart
Is there a statistically better solution for generating random numbers than
Perl's built in rand() function? I noticed a couple modules on CSPAN, but
are they any better? I haven't done a true test of the spread
regular rand()
gives, but it seems to me to give numbers closer to the top
Unbelievably, I'm actually walking around not fully understanding one or more
of these:
Blessed variables
Class methods
Class variables
Classes
Fubars
Functions
Global variables
Instance methods
Methods
Objects
Package variables
Packages
Properties
Subroutines
Zebras
Is there a simple yet
That'll work, but on a finer point, if you need to be thinking about
optimization at the moment:
($substring1 = $string) =~ s/.*\\(.*)/$1/;
is about 4 times slower than:
($substring2 = $string) =~ s/.*\\//;
because the second one doesn't have to store the matched value inside the
How can I check whether the system is connected?
Want to pause the script if connection is lost.
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
that, but if the ping to the router fails, then you
are definetly without connection) then you could assume you've lost
connection.
John
-Original Message-
From: Gary Hawkins [mailto:[EMAIL PROTECTED]]
Sent: 04 January 2002 12:24
To: [EMAIL PROTECTED]
Subject: Computer connected
GH How can I check whether the system is connected?
your OS? and your connection type?
Well, everything in the world preferably (I'm only asking for the world), if
others are going to be able to run it, but W2K and DSL for humble starters.
Maybe check whether a particular port is open?
Thx
things are beginning to sink into my thick skull. And to think,
wasn't that long ago I was wondering what $a =~ s/this/that/ was all about.
/g
-Original Message-
From: Gary Hawkins [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 30, 2001 8:11 AM
To: [EMAIL PROTECTED]
Subject: Detect
How can I clear a line before replacing it?
Am doing \r and overwriting, but sometimes the text that was there previously
is longer than the new text.
gary
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Cool...
http://www.rexswain.com/httpview.html
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I want to scan a list of URL's for bad ones. The following is largely from
'perldoc lwp'. The particular bad URL is being redirected to a custom 404
page, so it returns 200 instead. Is there some way to know if the request has
been redirected? If so, is there a way to know *why* it was
Question strikes me as a great idea Jeff.
Well I'm still afflicted by the awful leperous backtick habit so this might not
be right but it was fast, and the result sure looks like a duck.
Cheers,
/g
#!perl.exe -w
# Collect perldoc results into a single file.
# Keys in on '^=' to determine if
With tcsh I just use backticks (below the tilde) because it's simple and
reliable and no worry about resources and they are not repetitive tasks and I
don't care if Santa brings me anything. So:
`cp thisfile thatfile`;
bing, done.
Cron for example, a scheduled task, can start the script
Anyone using this?
http://aspn.activestate.com/ASPN/Reference/Products/PerlMx/FAQ.html
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Looks like you are running Windows based on Outlook in header. So something
like this ought to do it:
BASIC
#!perl.exe -w
@files = `dir /s /b C:\\*.expect`;
chomp @files;
for (@files) {
s#\\##g;
$newfile = $_ . .bak;
`move \$_\
PROBLEM - unresolved error messages...
$line= 1,6.944,methane,29.6576,70617.28,*BB,8533.32,2381.0883,0.21
I use split (/,/,$line) to send each of the nine elements to an array.
Try quotes enclosing the entire string and a semicolon at the end of the line,
and 'use diagnostics -verbose;'.
I know Perl is used in C and C++ but is there a way to do the same in Visual
Basic?
/g
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
my
$line=qw(1,6.944,methane,29.6576,70617.28,*BB,8533.32,2381.0883,0.21);
Bonk. When using qw (quote words) I thought they had to be separated by white
space:
$line=qw(1 6.944 methane 29.6576 70617.28 *BB 8533.32 2381.0883 0.21);
which brings up a question, what if one of the elements
Rather, use:
if ($input =~ /^y$/i)
unless you want yellow and okay to work too.
-Original Message-
From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 5:16 PM
To: Daniel Falkenberg; [EMAIL PROTECTED]
Subject: Re: Default variable for
That being said, you should never, never try to parse CGI form
data by hand.
What do you use John.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I'm reading a 25 meg file that contains the content of web pages and their
urls. The entire content of the file is placed in an array and then
worked-over from there. (I know there are faster ways but ran into a loop snag
with $/ redefine).
The problem is that when I run the script the array
When that's done, type 'pktsh' at the command-line, and you get a little
interactive shell to play with stuff.
That's 'ptksh', rather.
Type 'widget' for cool demos. Text Hypertext 4. Arrows' for example.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
The overall problem is not if grep works or not, but why the
output from the backticks does not show up in the cgi. I only put
the grep in there to make the code read easier. $results does not
have anything in the cgi with or without the grep. Below is the code
again. Am I not
Pipe not working with /usr/bin/grep. Why is that?
Notice...
print `/usr/bin/dig -x $ip | grep PTR`;
works, but:
print `/usr/bin/dig -x $ip | /usr/bin/grep PTR`;
does not.
Another alternative:
$results = join(, grep(/PTR/, `/usr/bin/dig -x $ip`));
/g
print `/usr/bin/dig -x $ip | /usr/bin/grep PTR`;
does not.
Works fine on my system, as it should. Are you sure your grep
is in /usr/bin?
whereis grep
grep: /usr/5bin/grep /usr/bin/grep /usr/man/man1/grep.1v
/usr/5bin/grep also does not work.
g
--
To unsubscribe, e-mail:
#!perl.exe
$name=C:\\perl test\\perl text.txt;
`$name`;
runs Notepad with the txt file under Windows 2000.
The double quotes in `$name`; are needed for cmd.exe due to the spaces.
/g
-Original Message-
From: Rubiniec, Krzysztof [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October
o The Camel Book Programming Perl (3rd Edition) by O'Reilly Associates
has a section in the back about making Perl code faster, as far as I
remember
Second edition:
http://www.bluesreview.com/Oreilly/perl/prog/index.htm
8.3 Efficiency
When we're done with the terrorists I suggest we go after these people cheating
their unwelcome ads onto our systems and stealing our time for their selfish
purposes.
-Original Message-
From: Luinrandir Hernson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 28, 2001 8:53 AM
To:
89 matches
Mail list logo