SPUG: Net::Telnet

David Dyck dcd at tc.fluke.com
Fri Sep 7 14:54:30 CDT 2001


On Fri, 7 Sep 2001, Jason Lamport wrote:

> print( "\$t == $t (". ref( $t ) . ") at line __WHATEVER__\n");

Perl can insert the correct line number when you use __LINE__
 print( "\$t == $t (". ref( $t ) . ") at ".__FILE__." line ".__LINE__."\n");

see perldata.pod
    The special literals __FILE__, __LINE__, and __PACKAGE__
    represent the current filename, line number, and package name at that
    point in your program.  They may be used only as separate tokens; they
    will not be interpolated into strings.  If there is no current package
    (due to an empty C<package;> directive), __PACKAGE__ is the undefined
    value.

or if you don't mind your debug data to going to STDERR try
 warn( "\$t == $t (". ref( $t ) . ") );
and perl will add the file name and

You may also want to look at the Carp module.


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list