[17486] in Perl-Users-Digest
Perl-Users Digest, Issue: 4906 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 16 18:15:54 2000
Date: Thu, 16 Nov 2000 15:15:28 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974416528-v9-i4906@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 16 Nov 2000 Volume: 9 Number: 4906
Today's topics:
pos() and global pattern matching guthrie_linck@my-deja.com
Re: pos() and global pattern matching <bart.lateur@skynet.be>
Re: raw ethernet <nward@nfmail.com>
Re: raw ethernet (Martien Verbruggen)
Re: retrieve URL from text file (=?ISO-8859-1?Q?Test_v=B9_T~D~T_Coalition=AE?=)
Running stored procedure joseph_vieira@dmr.com
Re: Running stored procedure (John J. Trammell)
Re: Running stored procedure jvieira13@my-deja.com
Searching files <robert@genie.co.uk>
Re: Security Problem (Gwyn Judd)
Size of symbolic links eggrock@my-deja.com
Re: Size of symbolic links <jeffp@crusoe.net>
Re: Size of symbolic links <jmcnair@avienda.com>
Re: Size of symbolic links eggrock@my-deja.com
Re: That IxHash ordered Data::Dump again ... <caesura@freenetname.co.uk>
Why are references useful? andrew338@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Nov 2000 21:44:31 GMT
From: guthrie_linck@my-deja.com
Subject: pos() and global pattern matching
Message-Id: <8v1kfu$3fd$1@nnrp1.deja.com>
does anyone know why global pattern matching in assignment to a list
screws up the pos() function? this strange behavior has confounded me
for hours until i finally realized where the bug was coming from.
#!/usr/local/bin/perl
$_ = shift;
# assignment here seems to wipe out pos() ???? why???
($a, $b) =~ /(\w+):(\w+)/g;
# if you do it this way, pos() is preserved correctly
#/(\w+):(\w+)/g;
#($a, $b) = ($1, $2);
print "a='$a'\n";
print "b='$b'\n";
print "pos=", pos(), "\n";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 22:00:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: pos() and global pattern matching
Message-Id: <48m81tsg1dihr6v9f5qud6d0ai0pbd89dh@4ax.com>
guthrie_linck@my-deja.com wrote:
>($a, $b) =~ /(\w+):(\w+)/g;
I think you have a twiddle too many.
And yes, the /g modifier and pos() are connected.
--
Bart.
------------------------------
Date: Fri, 17 Nov 2000 10:15:20 +1300
From: "Nathan Ward" <nward@nfmail.com>
Subject: Re: raw ethernet
Message-Id: <DdYQ5.3277$gVqd.58327078@news.xtra.co.nz>
> >> > is there anyone here who has some code avail to help me send raw
> > ethernet
> >> > packets? an esp interested in sending arp packets...
> >>
> >> http://search.cpan.org/search?mode=module&query=ethernet
> >
> > just comes up with NetPacket::* stuff, i tried that but none of the
packet
> > encoding (as it is called) is done yet. and as i dont know how to do it,
i
> > cant... unless someone can point me to some code? then mabee i'll make
some
> > generation things for NetPacket::*
>
> Honestly? I thought those modules were fairly complete. But not that
> I've actually downloaded and unpacked them I see they aren't.
just says 'unimplemented as yet'
> I don't know of any other code, so I guess the only thing I can advise
> you is get the relevant RFCs and specs, and get cracking :). Or maybe
> you can find some other implementation...
yeah looks like im guna havta huh?
> It shouldn't be too hard to do, just tedious :)
mmm
i'll keep y'all posted
------------------------------
Date: Thu, 16 Nov 2000 23:03:48 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: raw ethernet
Message-Id: <slrn918prm.425.mgjv@verbruggen.comdyn.com.au>
On Fri, 17 Nov 2000 10:15:20 +1300,
Nathan Ward <nward@nfmail.com> wrote:
[slightly reformatted]
>> >> > is there anyone here who has some code avail to help me send
>> >> > raw
>> > ethernet
>> >> > packets? an esp interested in sending arp packets...
>> >>
>> >> http://search.cpan.org/search?mode=module&query=ethernet
>> >
>> > just comes up with NetPacket::* stuff, i tried that but none of
>> > the packet encoding (as it is called) is done yet. and as i dont
>> > know how to do it, i cant... unless someone can point me to some
>> > code? then mabee i'll make some generation things for
>> > NetPacket::*
>>
>> Honestly? I thought those modules were fairly complete. But not
^^^
now
>> that I've actually downloaded and unpacked them I see they aren't.
>
> just says 'unimplemented as yet'
I mistyped that. I meant to say 'now that I have downloaded'. I hope
that makes more sense :)
>> I don't know of any other code, so I guess the only thing I can
>> advise you is get the relevant RFCs and specs, and get cracking :).
>> Or maybe you can find some other implementation...
>
> yeah looks like im guna havta huh?
Well, someone will have to :), And since you're the one that needs it,
you seem to be the most likely candidate.
>> It shouldn't be too hard to do, just tedious :)
> mmm
>
> i'll keep y'all posted
It would probably be a good idea if you adapted the NetPacket stuff,
so it can be easily distributed back out to the world. That is, if you
want to share your efforts. The easies way to do that is normally by
starting to write a subclass, and then sending that to the module
author :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Thu, 16 Nov 2000 11:00:16 -0800 (PST)
From: testversion1@webtv.net (=?ISO-8859-1?Q?Test_v=B9_T~D~T_Coalition=AE?=)
Subject: Re: retrieve URL from text file
Message-Id: <25810-3A142EC0-28@storefull-627.iap.bryant.webtv.net>
{{Martien=A0Verbruggen:
[Your references header is broken. You should use a real usenet
reader.}}
lol, this is WebTV, we have no choice over what usenet reader we use,
unless we signed up for a web-based one like Deja or something. The
entire network is sub-par, WebTV doesn't support Java, or any of that
other good stuff comp users get, hell it doesn't really even support
JavaScript, yet we still pay the highest rates for internet access
around.
{{You should also provide a little bit of quoted context to show us what
you're responding to]}}
I'll remember that next time...
{{You have read only the first line of FILE into $_, unless you have
undefined $/, and you didn't show us that bit. }}
Thanks for pointing all that, and the rest, out. I'm no guru, i'm just
starting to really get into perl.
{{What is that /i doing there?}}
That's a habbit, i'm always matching specific words, not 'wildcards'....
-=86es=86 v=B9
------------------------------
Date: Thu, 16 Nov 2000 20:07:16 GMT
From: joseph_vieira@dmr.com
Subject: Running stored procedure
Message-Id: <8v1epd$u20$1@nnrp1.deja.com>
Hello,
I have a perl program using DBI to run an Oracle stored procedure which
returns data. But I seem to be getting an error which hopefully
someone can help me fix.
Here is the code:
use DBI;
my($vfname,$vlname,$vempnum);
$dbh = DBI->connect("DBI:Oracle:some_database_name", userid, password);
die "Unable to connect: $DBI::errstr\n" unless (defined $dbh);
my($sql) ="begin joe2(3500,?,?,?); end;";
my($sth) = $dbh->prepare($sql) or
die "Unable to prep our query:".$dbh->errstr."\n";
$rv = $sth->bind_param_inout(1,\$vfname,100);
$rc = $sth->bind_param_inout(2,\$vlname,100);
$rc = $sth->bind_param_inout(3,\$vempnum,8);
die $DBI::errstr if ($DBI::errstr);
$sth->execute;
die $DBI::errstr if ($DBI::errstr);
$sth->finish;
die $DBI::errstr if ($DBI::errstr);
$dbh->disconnect;
$rc = $sth->execute or die "Unable to execute our query:".$dbh-
>errstr."\n";
$aref_aref = $sth->fetchall_arrayref;
foreach $rowref (@$aref_aref){
for ($i = 0; $i < $sth->{NUM_OF_FIELDS}; $i++){
print $sth->{NAME}->[$i].": ".$rowref->[$i]."\n";
}
print '-'x30,"\n";
}
print "OK\n";
-------------
This is the stored procedure:
procedure joe2 (some_num number) as
vfname varchar2(100);
vlname varchar2(100);
vempnum number;
begin
select fname, lname, empnum
into vfname, vlname, vempnum
from ressum where empnum < some_num;
end;
----------------
This is the error:
DBD::Oracle::st execute failed: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'JOE2'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored (DBD: oexec error) at D:\code\dbiaccess.pl
line 20.
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'JOE2'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored (DBD: oexec error) at D:\code\dbiaccess.pl
line 21.
---------------
What did I do wrong?
Thanks,
Joe
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Nov 2000 20:56:38 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: Running stored procedure
Message-Id: <slrn917o4h.n51.trammell@nitz.hep.umn.edu>
On Thu, 16 Nov 2000 20:07:16 GMT, joseph_vieira@dmr.com
<joseph_vieira@dmr.com> wrote:
[snip]
>my($sql) ="begin joe2(3500,?,?,?); end;";
[snip]
> procedure joe2 (some_num number) as
[snip]
>PLS-00306: wrong number or types of arguments in call to 'JOE2'
My guess is that you're calling procedure JOE2 with the wrong
number of arguments. Of course, I could be wrong.
Also, don't you find
my $sql = q[ BEGIN joe2(3500,?,?,?); END; ];
more aesthetically pleasing? I sure do.
--
John J. Trammell
johntrammell@yahoo.com
------------------------------
Date: Thu, 16 Nov 2000 21:26:17 GMT
From: jvieira13@my-deja.com
Subject: Re: Running stored procedure
Message-Id: <8v1jdf$2f4$1@nnrp1.deja.com>
> My guess is that you're calling procedure JOE2 with the wrong
> number of arguments. Of course, I could be wrong.
>
The stored procedure takes one parameter (a number) and returns three
things, vfname, vlname, vempnum.
> Also, don't you find
>
> my $sql = q[ BEGIN joe2(3500,?,?,?); END; ];
>
> more aesthetically pleasing? I sure do.
>
Yes, but right now I'm just trying to get it to work.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 21:26:00 +0000
From: Robert <robert@genie.co.uk>
Subject: Searching files
Message-Id: <21k81tc518uvj9kp88o856rrn006iva7dm@4ax.com>
Just a quick question here,
Say I have a file file of URLs, in the format
<a href="http://websitesname.com/file.asp?name=john&phone=12345>Johns
details</a>
obviously they wont all be john, they will all have different names
and phone numbers.
What I want to do is search within this file for John and then display
the phone number for that url.
How easy is this and If someone could give me some pointers I would be
most happy.
Robert
------------------------------
Date: Thu, 16 Nov 2000 20:17:59 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Security Problem
Message-Id: <slrn918g7k.4ut.tjla@thislove.dyndns.org>
I was shocked! How could kangchenjunga@my-deja.com <kangchenjunga@my-deja.com>
say such a terrible thing:
><script LANGUAGE="Javascript">
>window.location.href="http://www.somesight.com/downloads/someexe.exe";
></script>
>
>gets left in the generated HTML which shows the exact location to
>get the exe.
>
>So what is the easiest way in perl to open up a dialog box that will
>enable a user to download a product without showing any traces of
>the exact location?
This doesn't really sound like a Perl question. You might have more
success asking in a Javascript newsgroup. That said I know a lot of
spammers attempt (note I say attempt) to hide the locations of their
webpages by encrypting the html and the decrypting on the fly. This
fails of course because anyone can do the same thing. What you might try
is having your download link point to a cgi script that has as it's
output the contents of the file.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
But soft you, the fair Ophelia:
Ope not thy ponderous and marble jaws,
But get thee to a nunnery -- go!
-- Mark "The Bard" Twain
------------------------------
Date: Thu, 16 Nov 2000 21:14:27 GMT
From: eggrock@my-deja.com
Subject: Size of symbolic links
Message-Id: <8v1inb$1rb$1@nnrp1.deja.com>
Unix command:
ls -l symlink
Returns:
lrwxrwxrwx 1 user group 30 (blah blah) symlink
Perl script:
$a = (stat "symlink")[7];
print $a;
Returns:
8192
WTF? Is this a Unix or a Perl thing? Is the only way to get the correct
Unix representation of the filesize parsing a "ls -l"?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 16:42:28 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Size of symbolic links
Message-Id: <Pine.GSO.4.21.0011161642050.265-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 16, eggrock@my-deja.com said:
>$a = (stat "symlink")[7];
>print $a;
>
>Returns:
>8192
>
>WTF? Is this a Unix or a Perl thing? Is the only way to get the correct
>Unix representation of the filesize parsing a "ls -l"?
Or, you use the lstat() function for reading links.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Thu, 16 Nov 2000 16:57:08 -0500
From: John McNair <jmcnair@avienda.com>
Subject: Re: Size of symbolic links
Message-Id: <3A145834.1050506@avienda.com>
I wrote a tst.pl and got the following results:
jmcnair@minipax: 0 $ ./tst.pl
stat: 4096
lstat: 14
jmcnair@minipax: 0 $ ls -l symlink/
lrwxrwxrwx 1 jmcnair users 14 Nov 16 16:52 symlink ->
/usr/local/src/
I just used lstat():
$size = (stat( "symlink" ))[7];
print "stat: $size\n";
$size = (lstat( "symlink" ))[7];
print "lstat: $size\n";
eggrock@my-deja.com wrote:
> Unix command:
> ls -l symlink
>
> Returns:
> lrwxrwxrwx 1 user group 30 (blah blah) symlink
>
> Perl script:
> $a = (stat "symlink")[7];
> print $a;
>
> Returns:
> 8192
>
> WTF? Is this a Unix or a Perl thing? Is the only way to get the correct
> Unix representation of the filesize parsing a "ls -l"?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
John McNair
JAPH
Avienda Technologies
jmcnair@avienda.com
------------------------------
Date: Thu, 16 Nov 2000 22:07:16 GMT
From: eggrock@my-deja.com
Subject: Re: Size of symbolic links
Message-Id: <8v1lqe$4lb$1@nnrp1.deja.com>
In article <Pine.GSO.4.21.0011161642050.265-100000@crusoe.crusoe.net>,
japhy@pobox.com wrote:
> [posted & mailed]
>
> On Nov 16, eggrock@my-deja.com said:
>
> >$a = (stat "symlink")[7];
> >print $a;
> >
> >Returns:
> >8192
> >
> >WTF? Is this a Unix or a Perl thing? Is the only way to get the
correct
> >Unix representation of the filesize parsing a "ls -l"?
>
> Or, you use the lstat() function for reading links.
>
> --
> Jeff "japhy" Pinyan japhy@pobox.com
http://www.pobox.com/~japhy/
> PerlMonth - An Online Perl Magazine
http://www.perlmonth.com/
> The Perl Archive - Articles, Forums, etc.
http://www.perlarchive.com/
> CPAN - #1 Perl Resource (my id: PINYAN)
http://search.cpan.org/
>
>
Ooooh, thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 19:20:18 -0000
From: "Andrew Cragg" <caesura@freenetname.co.uk>
Subject: Re: That IxHash ordered Data::Dump again ...
Message-Id: <8v1bva$s25$1@gxsn.com>
Jeff,
Thanks for reply. My script is on a Unix box (actually AIX) and I use the
latest version of everything for that (I think - I'll check). So maybe it's
a problem with the Unix versions?
Thanks,
Andy
Jeff Zucker <jeff@vpservices.com> wrote in message
news:3A0B4850.998C8AE0@vpservices.com...
> Andrew Cragg wrote:
> >
> > Anyone tried to Data::Dump a Tie::IxHash'ed hash reference?
> > ...
> > And this is wot I got in a_file.txt :
> >
> > $A_HashRef = {
> > 'Rock' => 'Rock',
> > 'Cary' => 'Cary',
> > 'Howard' => \$A_HashRef->{'Rock'},
> > 'Clint' => \$A_HashRef->{'Cary'},
> > 'Fred' => \$A_HashRef->{'Rock'},
> > 'Ginger' => \$A_HashRef->{'Cary'}
> > };
> >
>
> Hmm this is what mine looks like with same script cut and pasted (except
> using the installed version of Tie::IxHash rather than the lib):
>
> $A_HashRef = {
> 'Rock' => 'Rock',
> 'Cary' => 'Cary',
> 'Howard' => 'Howard',
> 'Clint' => 'Clint',
> 'Fred' => 'Fred',
> 'Ginger' => 'Ginger'
> };
>
> That's with Tie::IxHash 1.21, Data::Dumper 2.01, perl 5.6 (ActiveState
> build 618), on win98.
>
> --
> Jeff
------------------------------
Date: Thu, 16 Nov 2000 21:47:23 GMT
From: andrew338@my-deja.com
Subject: Why are references useful?
Message-Id: <8v1kl8$3j3$1@nnrp1.deja.com>
Perl is my first programming language. I can do most of the basic
things and have read about references but don't use them. I don't see
why to. A reference is "a piece of data that refers to another piece
of data, but I already use $variable to represent a value like "6".
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4906
**************************************