List with qw and without

2008-07-26 Thread William
package MyConfig;
use constant (DOCUMENT_ROOT = /var/www/);
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(DOCUMENT_ROOT); # This works
#our @EXPORT_OK = (DOCUMENT_ROOT); # But this does not work

1;

use MyConfig qw(DOCUMENT_ROOT);
print DOCUMENT_ROOT;

# If I do not use qw , I will get error of DOCUMENT_ROOT is not exported by 
the MyConfig module
# Why is qw importance is so significance here ?
# I thought qw is just a syntatic sugar of perl to make a list
# Thank you.


Send instant messages to your online friends http://uk.messenger.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: List with qw and without

2008-07-26 Thread Rob Dixon
William wrote:
 package MyConfig;
 use constant (DOCUMENT_ROOT = /var/www/);
 require Exporter;
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw(DOCUMENT_ROOT); # This works
 #our @EXPORT_OK = (DOCUMENT_ROOT); # But this does not work
 
 1;
 
 use MyConfig qw(DOCUMENT_ROOT);
 print DOCUMENT_ROOT;
 
 # If I do not use qw , I will get error of DOCUMENT_ROOT is not exported by 
 the MyConfig module
 # Why is qw importance is so significance here ?
 # I thought qw is just a syntatic sugar of perl to make a list
 # Thank you.

That's correct. qw splits its parameter on whitespace, so

  qw(A B C)

is similar to

  split ' ', 'A B C'


So if you write

  use MyConfig 'DOCUMENT_ROOT';

or

  use MyConfig ('DOCUMENT_ROOT');

then your program will work as expected. But because you've defined the constant
DOCUMENT_ROOT to be /var/www/

  use MyConfig (DOCUMENT_ROOT);

is the same as saying

  use MyConfig (/var/www/);

which is nonsense.

HTH,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




getting process id under NT

2008-07-26 Thread epanda
Hi,

I would like to know if it is possible to get win32 process ID under
Windows NT without using Win32::OLE because this one does not work
under NT.

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: while trying to learn pack

2008-07-26 Thread Richard Lee

John W. Krahn wrote:

Richard Lee wrote:
I am begining to read bit of low level(assembly) book to just gain 
some knoweldge on inner workings of memory.


My quesiton is, if machine is 32 bit, even if it's accessing string 
'A', it will have to fetch 32 bit (instead of 8 bit that requires to 
make that letter A ) ?


It depends on the CPU.  An Intel compatible CPU has instructions to 
access 8 bit values from memory but some CPUs can only access 32 bit 
aligned data.


I know this is not a mailing list for this but i figure since it's 
closely related to pack, i thought someone would clarify for me.


It is not really related to pack() as pack() is a high level function 
that can hide the details of the CPUs addressing problems.


I am reading step by step assembly language... I am not sure i will 
read the whole thing but i just want to get better inner working of 
memory as my c book didn't do enough justice.



John

thanks guys

Just one more question on the topic,
I am trying to understand how it works in binary world.
So, If let's say I take a pcap file. I am assuming here that 
ethereal/wireshark will take binaries on the wire and then decoding it 
based on pcap standard(? hex? ) and then present them in ascci ?


so which means in order to unpack pcap file, I have to know how ethereal 
pack on their own.. is this something similar to what happens when pcap 
file gets created?


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: while trying to learn pack

2008-07-26 Thread Richard Lee

John W. Krahn wrote:

Richard Lee wrote:
I am begining to read bit of low level(assembly) book to just gain 
some knoweldge on inner workings of memory.


My quesiton is, if machine is 32 bit, even if it's accessing string 
'A', it will have to fetch 32 bit (instead of 8 bit that requires to 
make that letter A ) ?


It depends on the CPU.  An Intel compatible CPU has instructions to 
access 8 bit values from memory but some CPUs can only access 32 bit 
aligned data.


I know this is not a mailing list for this but i figure since it's 
closely related to pack, i thought someone would clarify for me.


It is not really related to pack() as pack() is a high level function 
that can hide the details of the CPUs addressing problems.


I am reading step by step assembly language... I am not sure i will 
read the whole thing but i just want to get better inner working of 
memory as my c book didn't do enough justice.



John

Thanks guys,

One more question, How do I look at binary file using perl? ( I am 
assuming unpack will be able to handle it ).
I am trying to see if I can peak into pcap file w/ unpack... what will 
require? ( I am trying to not use modules to learn )
Idea is to learn the pcap structure and use it to unpack somehow? I am 
not asking for anything specific in order to solve the problem.

I guess just reaching out for general idea. if that's possible.

Meanwhile I will keep reading. thanks for help!!



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: while trying to learn pack

2008-07-26 Thread John W. Krahn

Richard Lee wrote:


Just one more question on the topic,
I am trying to understand how it works in binary world.
So, If let's say I take a pcap file. I am assuming here that 
ethereal/wireshark will take binaries on the wire and then decoding it 
based on pcap standard(? hex? ) and then present them in ascci ?


so which means in order to unpack pcap file, I have to know how ethereal 
pack on their own.. is this something similar to what happens when pcap 
file gets created?


According to the Wireshark man page:

   Wireshark’s native capture file format is libpcap format, which
   is also the format used by tcpdump and various other tools.

   Wireshark can read / import the following file formats:

   * libpcap, tcpdump and various other tools using tcpdump’s
 capture format
   * snoop and atmsnoop
   * Shomiti/Finisar Surveyor captures
   * Novell LANalyzer captures
   * Microsoft Network Monitor captures
   * AIX’s iptrace captures
   * Cinco Networks NetXRay captures
   * Network Associates Windows-based Sniffer captures
   * Network General/Network Associates DOS-based Sniffer
 (compressed or uncompressed) captures
   * AG Group/WildPackets
 EtherPeek/TokenPeek/AiroPeek/EtherHelp/PacketGrabber captures
   * RADCOM’s WAN/LAN analyzer captures
   * Network Instruments Observer version 9 captures
   * Lucent/Ascend router debug output
   * files from HP-UX’s nettl
   * Toshiba’s ISDN routers dump output
   * the output from i4btrace from the ISDN4BSD project
   * traces from the EyeSDN USB S0.
   * the output in IPLog format from the Cisco Secure Intrusion
 Detection System
   * pppd logs (pppdump format)
   * the output from VMS’s TCPIPtrace/TCPtrace/UCX$TRACE utilities
   * the text output from the DBS Etherwatch VMS utility
   * Visual Networks’ Visual UpTime traffic capture
   * the output from CoSine L2 debug
   * the output from Accellent’s 5Views LAN agents
   * Endace Measurement Systems’ ERF format captures
   * Linux Bluez Bluetooth stack hcidump -w traces
   * Catapult DCT2000 .out files



One more question, How do I look at binary file using perl? ( I am
assuming unpack will be able to handle it ).
I am trying to see if I can peak into pcap file w/ unpack... what will
require? ( I am trying to not use modules to learn )
Idea is to learn the pcap structure and use it to unpack somehow? I am
not asking for anything specific in order to solve the problem.
I guess just reaching out for general idea. if that's possible.


In Perl you need to know where the specific fields are in the record, 
what type of data those fields contain, and if they are numeric, whether 
they are little endian, big endian, floating point or some other type of 
numeric format (i.e. BCD).





John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/