[18538] in Perl-Users-Digest
Perl-Users Digest, Issue: 706 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 18 18:20:54 2001
Date: Wed, 18 Apr 2001 15:20:32 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <987632432-v10-i706@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 18 Apr 2001 Volume: 10 Number: 706
Today's topics:
Filehandle problem (glob) you_smell@fuckyou.co.uk
Re: Filehandle problem (glob) less@rude.not
Re: Filehandle problem (glob) less@rude.gibblets
Re: Filehandle problem (glob) less@rude.not
Re: Filehandle problem (glob) nobull@mail.com
Filenames from Windows OS <pratt@biop.ox.ac.uk>
Re: Filenames from Windows OS <abe@ztreet.demon.nl>
fork test on Win32 platform (SH Chang)
fork() on windows....! <cernava@itexas.net>
format must be in scope of 'my'? ugh. <webmaster@webdragon.unmunge.net>
Re: Getting and using dates from user entry <sb@mcasia.imperia.net>
Re: hash references (Mark Jason Dominus)
Re: help for a basic hash value access question <Francis.Derive@wanadoo.fr>
Re: Help: how to install getpwuid and getlogin? <abe@ztreet.demon.nl>
Re: hex to binary conversion, more <rayj00@yahoo.com>
hex to binary conversion <rayj00@yahoo.com>
Re: hex to binary conversion <rayj00@yahoo.com>
Re: hex to binary conversion (Abigail)
Re: hex to binary conversion (Jay Tilton)
Re: How do I get Main Directory? CORRECTION (BUCK NAKED1)
Re: How do I get Main Directory? CORRECTION (Randal L. Schwartz)
Re: how do i suppress STDOUT <clarke@hyperformix.com>
How to deal with function pointers? <johnlin@chttl.com.tw>
How to extract numbers from a string <tobias.ruehle@de.bosch.com>
Re: How to extract numbers from a string (Bernard El-Hagin)
Re: How to extract numbers from a string (Peter J. Acklam)
htaccess question <plop740@mail.ru>
Re: htaccess question <robbie@DONTgoofymouseSPAM.freeserve.co.uk>
Re: htaccess question <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Apr 2001 15:37:49 GMT
From: you_smell@fuckyou.co.uk
Subject: Filehandle problem (glob)
Message-Id: <9bho0d$e9s$1@news.netmar.com>
Hi,
I am having a problem with filehandles as typeglobs.
To simplify my code, it looks like this:
#!/use/bin/perl
packge FOO;
sub handle_file
{
my $self = shift;
my $file = IO::File( ">/tmp/bar" ) or die ("Could not open
file.\n");
my $msg_line = "Some foo in bar diddly.\n";
$self->process_message_line ($msg_line, $file);
$file->close;
}
sub process_message_line
{
my ($self, $msg_line, $file) = @_;
print $file "$msg_line";
}
Why is /tmp/bar empty? What am I doing wrong?
Cheers.
TCB
PS: Apologies for the email address, but I needed to find one
that this web-based usenet reader allows.
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 18 Apr 2001 10:39:55 GMT
From: less@rude.not
Subject: Re: Filehandle problem (glob)
Message-Id: <9bjqtr$u0$1@news.netmar.com>
Thanks for your replies, and apologies for the email address.
I have still not found an address that I can use other than this one.
(Normally I would use my deja account, but..)
[Anyway, for completeness]
Here is a working snippet (as suggested by Ren):
package FILEGLOB;
use IO::File;
my $foo = {};
bless $foo, FILEGLOB;
$foo->handle_file;
sub handle_file{
my $self = shift;
my $file = new IO::File( ">/tmp/bar" ) or die ("Could not open file.\n");
my $msg_line = "Some foo in bar diddly.\n";
$self->process_message_line ($msg_line, $file);
$file->close;
}
sub process_message_line {
my ($self, $msg_line, $file) = @_;
print $file "$msg_line";
}
Which works fine.
It also gave me the 'confidence' to assume that certain parts of the code
was correct. Based on that assumption I found my error, which was in the
use of IO::File.pm
Thanks for all your help.
TCB
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 18 Apr 2001 10:38:43 GMT
From: less@rude.gibblets
Subject: Re: Filehandle problem (glob)
Message-Id: <9bjqrj$st$1@news.netmar.com>
Thanks for your replies, and apologies for the email address.
I have still not found an address that I can use other than this one.
(Normally I would use my deja account, but..)
[Anyway, for completeness]
Here is a working snippet (as suggested by Ren):
package FILEGLOB;
use IO::File;
my $foo = {};
bless $foo, FILEGLOB;
$foo->handle_file;
sub handle_file{
my $self = shift;
my $file = new IO::File( ">/tmp/bar" ) or die ("Could not open file.\n");
my $msg_line = "Some foo in bar diddly.\n";
$self->process_message_line ($msg_line, $file);
$file->close;
}
sub process_message_line {
my ($self, $msg_line, $file) = @_;
print $file "$msg_line";
}
Which works fine.
It also gave me the 'confidence' to assume that certain parts of the code
was correct. Based on that assumption I found my error, which was in the
use of IO::File.pm
Thanks for all your help.
TCB
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 18 Apr 2001 12:32:09 GMT
From: less@rude.not
Subject: Re: Filehandle problem (glob)
Message-Id: <9bk1g9$7ip$1@news.netmar.com>
Thanks for your replies, and apologies for the email address.
I have still not found an address that I can use other than this one.
(Normally I would use my deja account, but..)
[Anyway, for completeness]
Here is a working snippet (as suggested by Ren):
package FILEGLOB;
use IO::File;
my $foo = {};
bless $foo, FILEGLOB;
$foo->handle_file;
sub handle_file{
my $self = shift;
my $file = new IO::File( ">/tmp/bar" ) or die ("Could not open file.\n");
my $msg_line = "Some foo in bar diddly.\n";
$self->process_message_line ($msg_line, $file);
$file->close;
}
sub process_message_line {
my ($self, $msg_line, $file) = @_;
print $file "$msg_line";
}
Which works fine.
It also gave me the 'confidence' to assume that certain parts of the code
was correct. Based on that assumption I found my error, which was in the
use of IO::File.pm
Thanks for all your help.
TCB
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 17 Apr 2001 17:23:43 +0100
From: nobull@mail.com
Subject: Re: Filehandle problem (glob)
Message-Id: <u94rvnjy0g.fsf@wcl-l.bham.ac.uk>
you_smell@fuckyou.co.uk writes:
> To simplify my code, it looks like this:
> my $file = IO::File( ">/tmp/bar" ) or die ("Could not open
> file.\n");
That will generate error "Undefined subroutine &IO::File called".
Simplifying your code before you post is a good thing but you must
remember to check _after_ you simplfy your code that it still
compiles, runs and displays the behaviour you are posting about.
> PS: Apologies for the email address, but I needed to find one
> that this web-based usenet reader allows.
I doubt it was necessary to choose such an offensive one.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 17 Apr 2001 14:26:55 -0500
From: "David Pratt" <pratt@biop.ox.ac.uk>
Subject: Filenames from Windows OS
Message-Id: <9bhfpf$2dj$1@news.ox.ac.uk>
Dear all,
My CGI script is accepting files from both UNIX and Windows (and potentially
MacOS). The problem with Windows is the returned file name is of the type
C:\Docs\newstuff\thisfile.txt
A simple regex to extract thisfile.txt is falling over at the " \t " and "
\n" etc are being interpreted as special characters. I've looked on the web
and my perl book but can find an obvious way to "turn off" the special
meaning of " \".
Any ideas would be greatfully received.
Thanks
Dave
------------------------------
Date: Tue, 17 Apr 2001 17:36:42 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Filenames from Windows OS
Message-Id: <8hoodtcdp8ammdns3dqqrsen5roi6tngln@4ax.com>
On Tue, 17 Apr 2001 14:26:55 -0500, "David Pratt" <pratt@biop.ox.ac.uk>
wrote:
> Dear all,
>
> My CGI script is accepting files from both UNIX and Windows (and potentially
> MacOS). The problem with Windows is the returned file name is of the type
>
> C:\Docs\newstuff\thisfile.txt
>
> A simple regex to extract thisfile.txt is falling over at the " \t " and "
> \n" etc are being interpreted as special characters. I've looked on the web
> and my perl book but can find an obvious way to "turn off" the special
> meaning of " \".
You could have a look at File::Basename, it allows you to set an OS,
before parsing the filename.
perldoc File::Basename
--
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'
------------------------------
Date: Tue, 17 Apr 2001 08:46:02 +0000 (UTC)
From: black@gngidc.net (SH Chang)
Subject: fork test on Win32 platform
Message-Id: <Xns9086B4BD3C3C5testfoocom@211.115.194.10>
kkHi, all...
I'm testing a server module on Windows 2000.
Below is an example source code from Dave Roth's book.
I modified some code for testing.
It works fine except 'session close' part.
Here is my problem :
After I make two connection at the same time and disconnect one of them,
the session is closed successfully. And, if I try to disconnect the other
session, it could not be closed until another connection is made.
It's difficult for me to explain what it is in english. Sorry...
Is there another way to accomplish the fork or concurrent connection on
Win32 platform ?
Please, give me any clue for this problem.
Thanks in advance,
Regards,
-------------< Cut Here >-------------------------------
# SocketDaemon2.pl
# Example: 7.24
# ----------------------------------------
# From "Win32 Perl Scripting: Administrators Handbook" by Dave Roth
# Published by New Riders Publishing.
# ISBN # 1-57870-215-1
#
# This script uses Perl v5.6's fork() function to implement a more
efficient
# version of Example_11_22.pl.
# Forking for Win32 starts with version 5.006
require 5.006;
use IO::Socket;
$iProcessCount = 0;
$Port = 8080;
if( $Socket = IO::Socket::INET->new( LocalPort => $Port, Listen => 5 ) )
{
while( 1 )
{
print "\nListening for a connection...\n";
last unless ( $Connection = $Socket->accept() );
$iProcessCount++;
print STDERR "Server: Connection $iProcessCount\n";
MyFork( $Connection );
$Connection->close();
}
}
sub ProcessAsChild
{
my( $Socket ) = @_;
my ( $line ) = '';
$Socket->send( "Child process $iProcessCount has started at " .
localtime() . "\r\n" );
while (1) {
while(1) {
$Socket->recv( $In, 100 );
last if( $In eq "\r\n" );
$line .= $In ;
}
$line =~ s/[\r\n]*$//g;
chomp $line;
if ( $line =~ m/^quit/ ) {
$Socket->send( "1.You entered: $line\r\n" );
last;
}
$Socket->send( "2.You entered: $line\r\n" );
$line = '';
}
print "\tChild $iProcessCount is closing.\r\n";
$Socket->close();
}
sub MyFork
{
my( $Socket ) = @_;
my $Pid = fork();
if( 0 == $Pid )
{
# We get here only if we are a child process
$| = 1;
ProcessAsChild( $Socket );
print "End of socket\n";
exit();
}
}
------------------------------
Date: Wed, 18 Apr 2001 11:12:00 -0500
From: "Itexas" <cernava@itexas.net>
Subject: fork() on windows....!
Message-Id: <9bkec701b55@enews4.newsguy.com>
Hi,
I have a problem with fork on windows. When I fork off and try to open a
porgram in the child with IPC open3 it seems to send the out put to STDOUT
and my child is not blocked at all it can do a while loop as the open 3
sends the programs out put STDOUT. It seems the open3 is doing some kind of
fork or is it just windows? I've tryed this program on linux and it worked
just fine.. I think it has to do with the hacked fork on ActiveState.....
use Strict;
use FileHandle;
use IPC::Open3;
$| = 1;
my $kid = fork();
if ($kid)
{
my $i = 5;
#loop for 5 time and print main to STDOUT
while($i--)
{
print "Main\n";
sleep 2;
}
#Wait for child if.
$child = wait;
print "$child closed";
#end main
exit(0);
}
else
{
#New file handles
my $READ = FileHandle->new();
my $WRITE = FileHandle->new();
my $ERROR = FileHandle->new();
#turn off buffering
$READ->autoflush(1);
$WRITE->autoflush(1);
$ERROR->autoflush(1);
my $pid = open3( $WRITE, $READ, $ERROR, "ping localhost" );
my $i = 8;
while($i--)
{
print "Child -- open 3 pid = $pid\n";
sysread($READ, $data, 1024);
print "PING:$data\n";
sleep 2;
}
#close child
exit(0);
}
Thanks.
Richard
------------------------------
Date: 18 Apr 2001 07:51:06 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: format must be in scope of 'my'? ugh.
Message-Id: <9bjh1a$hq1$0@216.155.33.84>
Consider an excerpt from a DBI-based script I hacked together to do a
quick search on a CSV file.. I decided to use format/write to prettify
the output and get some practice with the format command. Unfortunately,
formats must be within the scope of a my declaration, and in this
instance not even a closure is going to help me. Does anyone know a
better way to write this? It seems like a LOT of useless overhead if the
DB returns a large result.
[begin fragment]
while (my @row = $sth->fetchrow )
{
# need to do this in here because of the "my @row" --
# formats MUST be within the my's scope. *ugh*
format STDOUT_TOP =
Search Results
Gametype File Size Review
-------------------------------------------------------------
.
format STDOUT =
@<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>> @>>>>
$row[0], $row[1], $row[2], $row[3]
.
$row[3] = $1 if $row[3] =~ m|.*/(.*)$|;
$row[3] = "" if $row[3] eq "-1";
write;
}
print "\n\n";
[end fragment]
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 17 Apr 2001 10:53:35 GMT
From: Steffen Beyer <sb@mcasia.imperia.net>
Subject: Re: Getting and using dates from user entry
Message-Id: <9bh7bf$frq$1@swifty.westend.com>
In comp.lang.perl.misc Glenn & Pam <glenn&pam@desertdoghouse.com> wrote:
> Where is a good source of information on dealing with date information
> from user entry. I'm trying to reformat and compare date entries
> without being overly restrictive to the user input. I know there are
> date functions in perl and would like to know where to find detailed
> information on them.
See the Perl FAQ (man perlfaq or perldoc perlfaq) on your system, or
on the Net.
See also Time::Parse, Date::Manip etc. on CPAN.
Consult section 6 (data types) of The Perl 5 Module List at
http://www.perl.com/CPAN/modules/00modlist.long.html
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/whoami/ (Who am I)
http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)
------------------------------
Date: Tue, 17 Apr 2001 11:59:16 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: hash references
Message-Id: <3adc3019.40b7$2ae@news.op.net>
In article <slrn9dnv4k.e61.damian@puma.qimr.edu.au>,
Damian James <damian@qimr.edu.au> wrote:
>David Millman chose Mon, 16 Apr 2001 13:40:04 -0400 to say this:
>>if i'm passing in references to a hash in a subroutine, how
>>do i get the actual hash data.
>>
>>...
>>$r = dostuff(%$foo,%$bar);
>>...
>>why doesn't that work?
>>
>
>Because you're NOT passing references -- you are explicitly dereferencing
>them first, and passing the resulting list.
But he had the (\%\%) prototype on the function. If the declarations
had been in the correct order, he would have gotten what he wanted.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 18 Apr 2001 21:54:31 +0200
From: "Francis Derive" <Francis.Derive@wanadoo.fr>
To: "Gwyn Judd" <tjla@guvfybir.qlaqaf.bet>
Subject: Re: help for a basic hash value access question
Message-Id: <B703BDA1-806F8@193.248.253.197>
hello Wyn,
I had two solutions to start with this morning and yours made me remember
the point I missed under the load of syntax I face since I started - on my
good will - to learn and use Perl.
I left aside your approach for the day because I was not too clever with
the "qw" and other "qq".
Just now, I see it !
I was curious about having NO commas separating the 'a' and 'b' and 'c'. I
thought you had forgotten them ! (I come from Lisp and I appreciate !).
So , I can do this :
$hash{2}= [qw/a b c/];
print $hash{2}[1];
It's OK.
However I would prefer to see a reference to a list more than to an array :
$hash{2}= (qw/a b c/); # does not work
Merci.
On Tue, Apr 17, 2001 11:31 PM, Gwyn Judd <mailto:tjla@guvfybir.qlaqaf.bet>
wrote:
>In article <B7027493-9190C@193.248.254.195>,
>Francis Derive <Francis.Derive@wanadoo.fr> wrote:
>>I want a value associated to some key to be a list.
>>With %hash = ();
>>I would say @hash{2} = ("a","b","c"); # '@' for the list context, and the
>>list.
>>
>>But print @hash{2} says only "a".
>
>That's because a hash value (or an array value) can only be a scalar. An
>array is not a scalar. Fortunately, a reference to an array is a scalar:
>
>$hash{2} = [qw(a b c)];
>
>--
>Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
>Better dead than mellow.
>
------------------------------
Date: Tue, 17 Apr 2001 20:53:24 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Help: how to install getpwuid and getlogin?
Message-Id: <nn3pdto58jf7nip11lig4stknn7s4icgnc@4ax.com>
On 17 Apr 2001 18:18:29 +0100, nobull@mail.com wrote:
> u518615722@spawnkill.ip-mobilphone.net writes:
>
> > I am an Oracle DBA. I installed perl 5.06
> > on my NT 2000, but when I run a program
> > defrag.pl,I got an error message that getpwuid
> > and getlogin are not implemented,
> > and I am so new to perl, I do not know
> > how I can get these two functions.
>
> Get a real OS :-)
>
> Sorry, couldn't resist.
>
> Those functions are part of the OS specific API to the Unix
> authentication/session model. Any program that uses them (whether
> written n Perl or C or whatever) is Unix specific.
But getlogin() _is_ implemented on Win32.
C:>perl -le print+getlogin
a.timmerman
--
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'
------------------------------
Date: Wed, 18 Apr 2001 14:45:17 -0400
From: RayJ <rayj00@yahoo.com>
Subject: Re: hex to binary conversion, more
Message-Id: <3ADDE0BD.1030008@yahoo.com>
Actually a better example is turning ab into 10101011
Note m/l significant.....
Thanks,
Ray
RayJ wrote:
> How can I turn 99(hex) into 10011001??
>
> Thanks,
>
> Ray
------------------------------
Date: Wed, 18 Apr 2001 14:16:51 -0400
From: RayJ <rayj00@yahoo.com>
Subject: hex to binary conversion
Message-Id: <3ADDDA13.6070906@yahoo.com>
How can I turn 99(hex) into 10011001??
Thanks,
Ray
------------------------------
Date: Wed, 18 Apr 2001 16:01:10 -0400
From: RayJ <rayj00@yahoo.com>
Subject: Re: hex to binary conversion
Message-Id: <3ADDF286.9090302@yahoo.com>
I have this code:
# @values[0] = 85
$string = sprintf("%8b",@values[0]);
print "$string\n";
the print statement returns: 1010101
What gives?
Ray
RayJ wrote:
> How can I turn 99(hex) into 10011001??
>
> Thanks,
>
> Ray
------------------------------
Date: Wed, 18 Apr 2001 18:42:28 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: hex to binary conversion
Message-Id: <slrn9dro0k.fe1.abigail@tsathoggua.rlyeh.net>
RayJ (rayj00@yahoo.com) wrote on MMDCCLXXXVII September MCMXCIII in
<URL:news:3ADDDA13.6070906@yahoo.com>:
$$ How can I turn 99(hex) into 10011001??
Use sprintf.
Abigail
--
BEGIN {my $x = "Knuth heals rare project\n";
$^H {integer} = sub {my $y = shift; $_ = substr $x => $y & 0x1F, 1;
$y > 32 ? uc : lc}; $^H = hex join "" => 2, 1, 1, 0, 0}
print 52,2,10,23,16,8,1,19,3,6,15,12,5,49,21,14,9,11,36,13,22,32,7,18,24;
------------------------------
Date: Wed, 18 Apr 2001 21:31:07 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: hex to binary conversion
Message-Id: <3ade04a3.382225328@news.erols.com>
On Wed, 18 Apr 2001 16:01:10 -0400, RayJ <rayj00@yahoo.com> wrote:
>I have this code:
># @values[0] = 85
>$string = sprintf("%8b",@values[0]);
^
You probably want a $ there to access one scalar element of the array
instead of a one-element slice of it. Either way produces the same
end result in this case, but the difference is something to be aware
of.
>print "$string\n";
>
>the print statement returns: 1010101
>
>What gives?
What's the problem? That is correct.
If you meant to ask "How can I get leading zeros?"
$string = sprintf('%08b',$values[0]);
^
^
If that's not the answer you need, try asking a different question.
------------------------------
Date: Wed, 18 Apr 2001 13:34:52 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: How do I get Main Directory? CORRECTION
Message-Id: <8480-3ADDDE4C-4@storefull-248.iap.bryant.webtv.net>
BuckNaked wrote:
> but I have a feeling that "prison-blues"
> Schwartz could do it. :-) Did you read
> that URL I posted where he even tells
> how to change someone's password.
I totally misunderstood that script of Randall Schwartz's that I
referred to earlier. I've been informed that it is NOT about changing
passwords. My sincere apologies for jokingly referring to Randall as
"prison-blues", and for misinforming the readers of this group about one
of his scripts. In no way, did I mean to imply that Randall was doing
anything wrong or illegal. I've already apologized to Randal.
Kind Regards,
--Dennis
------------------------------
Date: 18 Apr 2001 13:20:37 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How do I get Main Directory? CORRECTION
Message-Id: <m1y9syhsdm.fsf@halfdome.holdit.com>
>>>>> "BUCK" == BUCK NAKED1 <dennis100@webtv.net> writes:
BUCK> BuckNaked wrote:
>> but I have a feeling that "prison-blues"
>> Schwartz could do it. :-) Did you read
>> that URL I posted where he even tells
>> how to change someone's password.
BUCK> I totally misunderstood that script of Randall Schwartz's that I
BUCK> referred to earlier. I've been informed that it is NOT about changing
BUCK> passwords. My sincere apologies for jokingly referring to Randall as
BUCK> "prison-blues", and for misinforming the readers of this group about one
BUCK> of his scripts. In no way, did I mean to imply that Randall was doing
BUCK> anything wrong or illegal. I've already apologized to Randal.
And I appreciate the followup. It's tough enough to keep people
straight about my ongoing legal case to also have to deal with
misinformation injected by people quoting my columns. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 18 Apr 2001 08:04:15 -0500
From: "ac" <clarke@hyperformix.com>
Subject: Re: how do i suppress STDOUT
Message-Id: <eggD6.218$AJ.35879@news.uswest.net>
This did indeed remap STDOUT to null (I also did this to STDERR).
But the code in DragAcceptFiles() must be in a non-perl module
because the error messages still made it to the console. I'm giving up.
:(
"ac" <clarke@hyperformix.com> wrote in message
news:9TXC6.151$Lt.85965@news.uswest.net...
> Thanks, Jay and Jonathan. I'll give this a shot.
>
> Allan
>
>
>
------------------------------
Date: Wed, 18 Apr 2001 18:25:37 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: How to deal with function pointers?
Message-Id: <9bjpvb$sql@netnews.hinet.net>
Dear all,
In "MyDLL.dll" the function "foo" returns a function pointer.
typedef int (*fun_ptr)();
int bar() { return 3; }
fun_ptr foo() { return bar; }
The following Perl program try to deal with the function pointer
use Win32::API;
my $caller = new Win32::API('MyDLL','foo',[],P) or die $!;
my $bar = $caller->Call;
my $three = $bar->(); # This is not the code
Then, how to do it?
Not only Win32::API has the chance to deal with function pointers
but also unpack, unpacking a struct containing function pointers.
struct S { long data; fun_ptr pointer; };
my $struct = get_some_struct_from_Win32_API;
my ($data,$pointer) = unpack("L P",$struct);
my $result = $pointer->(); # This is not the code
Hmm... How to deal with function pointers that I get from
a return value of a function call, or a returned struct?
Thank you very much.
John Lin
------------------------------
Date: Wed, 18 Apr 2001 13:17:21 +0200
From: "Tobias Ruehle" <tobias.ruehle@de.bosch.com>
Subject: How to extract numbers from a string
Message-Id: <9bjt42$2ho$1@proxy2.fe.internet.bosch.com>
Hello,
I have the following string:
Used space MB = 1635.10546875
Now i want to exctract all numbers before the '.' in a variable let's say
$used_space.
I read something about pattern matching but i can't get it working.
Thank you in advance
Tobias
------------------------------
Date: Wed, 18 Apr 2001 11:34:11 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: How to extract numbers from a string
Message-Id: <slrn9dqujr.3vvnt95.bernard.el-hagin@gdndev25.dev.lido-tech>
Tobias Ruehle <tobias.ruehle@de.bosch.com> wrote:
::Hello,
::
::I have the following string:
::Used space MB = 1635.10546875
$_ = 'Used space MB = 1635.10546875';
my ($mb) = /(\d+)\./;
print "$mb\n";
::Now i want to exctract all numbers before the '.' in a variable let's say
::$used_space.
::I read something about pattern matching but i can't get it working.
You didn't read enough, then.
perldoc perlre
Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'
------------------------------
Date: 18 Apr 2001 13:41:50 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: How to extract numbers from a string
Message-Id: <cxc7l0i5ta9.fsf@janus.uio.no>
"Tobias Ruehle" <tobias.ruehle@de.bosch.com> writes:
> I have the following string:
> Used space MB = 1635.10546875
>
> Now i want to exctract all numbers before the '.' in a variable
> let's say $used_space.
($num) = $str =~ /(\d+)\./;
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
------------------------------
Date: Wed, 18 Apr 2001 11:08:36 +0000
From: Plop <plop740@mail.ru>
Subject: htaccess question
Message-Id: <edtqdt8c7vmpa9u04i124bjl2chda9kjst@4ax.com>
Hi,
Sorry if I am not at the right place...
I know how to deny an IP or IP range with the .htaccess file on an
Apache server.
But is it possible to redirect the visitor to a special page (or
script, etc), according to his IP, instead of "denyng" him ?
I know there are some cgi scripts for that, but I "feel' there's a way
with the .htaccess file !
Thanks !
Igor
------------------------------
Date: Wed, 18 Apr 2001 21:44:48 +0100
From: "Robb Meade" <robbie@DONTgoofymouseSPAM.freeserve.co.uk>
Subject: Re: htaccess question
Message-Id: <9bkuab$sah$1@newsg1.svr.pol.co.uk>
I dont know much at all about Perl (looked to hard so I walked away
:D)...but I've done a fair bit with ASP recently, and I'm guessing it has
some similar features?
If so, you should be able to get the IP of the user on any page, ie when the
page loads, it runs the script, and then does something depending on its
value.
What of course you may want to think about is whether a user would 'always'
have the same IP? cable modems/ISP's and so on...
--
Robb Meade
GoofyMouse Designs
www.goofymouse.com
"Plop" <plop740@mail.ru> wrote in message
news:edtqdt8c7vmpa9u04i124bjl2chda9kjst@4ax.com...
> Hi,
>
> Sorry if I am not at the right place...
>
> I know how to deny an IP or IP range with the .htaccess file on an
> Apache server.
>
> But is it possible to redirect the visitor to a special page (or
> script, etc), according to his IP, instead of "denyng" him ?
>
> I know there are some cgi scripts for that, but I "feel' there's a way
> with the .htaccess file !
>
> Thanks !
>
> Igor
------------------------------
Date: Wed, 18 Apr 2001 22:52:13 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: htaccess question
Message-Id: <Pine.LNX.4.30.0104182248540.4437-100000@lxplus003.cern.ch>
On Wed, 18 Apr 2001, Robb Meade jeopardized:
> I dont know much at all about Perl (looked to hard so I walked away
> :D)...but I've done a fair bit with ASP recently, and I'm guessing it has
> some similar features?
ASP is a programming interface. Perl is a programming language.
As similar as a banana and digestive juice, I guess. Or vice versa.
> If so, you should be able to get the IP of the user on any page,
Ahem.
Good thing that you're still supplying the bogosity alert, I suppose.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 706
**************************************