The canonical list of operator names is the array
PL_op_name, which is
initialized in opcode.h. On my Solaris system with Perl version 5.6.0
installed, the file, relative to the Perl executable, is
The Opcode module defines several tags and the user can define others using the define_optag function. Tags defined by Opcode are:
``Not included in :base_core because they can easily be used to implement a resource attack (e.g., consume all available memory).''
concat repeat join range anonlist anonhash
``Not included in :base_core because they can easily be used to implement a resource attack (e.g., consume all available CPU time).''
grepstart grepwhile mapstart mapwhile enteriter iter enterloop leaveloop unstack last next redo goto
``Enable filehandle (rather than filename) based input and output. These are safe on the assumption that only pre-existing filehandles are available for use. To create new filehandles other ops such as open would need to be enabled.''
readline rcatline getc read formline enterwrite leavewrite print sysread syswrite send recv eof tell seek sysseek readdir telldir seekdir rewinddir
``Still waiting to be considered''
gvsv gv gelem padsv padav padhv padany rv2gv refgen srefgen ref bless -- could be used to change ownership of objects (reblessing) pushre regcmaybe regcreset regcomp subst substcont sprintf prtf -- can core dump crypt tie untie dbmopen dbmclose sselect select pipe_op sockpair getppid getpgrp setpgrp getpriority setpriority localtime gmtime entertry leavetry -- can be used to 'hide' fatal errors
``A handy tag name for a reasonable default set of ops.''
:base_core :base_mem :base_loop :base_io :base_orig :base_thread
stat lstat readlink ftatime ftblk ftchr ftctime ftdir fteexec fteowned fteread ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftsgid ftsize ftsock ftsuid fttty ftzero ftrwrite ftsvtx fttext ftbinary fileno
ghbyname ghbyaddr ghostent shostent ehostent -- hosts gnbyname gnbyaddr gnetent snetent enetent -- networks gpbyname gpbynumber gprotoent sprotoent eprotoent -- protocols gsbyname gsbyport gservent sservent eservent -- services gpwnam gpwuid gpwent spwent epwent getlogin -- users ggrnam ggrgid ggrent sgrent egrent -- groups
``A handy tag name for a reasonable default set of ops beyond the :default optag.''
``The intent being that scripts can access more (possibly sensitive) information about your system but not be able to change it.''
:default :filesys_read :sys_db
:base_math :filesys_open :filesys_write :subprocess :ownprocess :others :still_to_be_decided :dangerous
Operator names or tags can be negated by prefixing a !. This means to remove the operators from the set.
As you may have noticed, some of the opcode names are a bit cryptic. Luckily, you can get a description of any opcode name using the Opcode module. Example:
> perl -mOpcode -e'print Opcode::opdesc(``enteriter''), ``\n'''
foreach loop entry
You may also want to get the name for a particular description. This is
only slightly more difficult. First, you need to get the description from
opcode.h or take a guess as to a pattern in the name or description. Then,
Opcode::opdump to output all matching name/descriptions. Examples:
> perl -mOpcode -e'Opcode::opdump (``for'')'
formline formline enteriter foreach loop entry iter foreach loop iterator fork fork
> perl -mOpcode -e'Opcode::opdump (``for[^mk]'')'
enteriter foreach loop entry iter foreach loop iterator
> perl -mOpcode -e'Opcode::opdump (``enteriter'')'
enteriter foreach loop entry
In case you don't have or don't believe the Opcode documentation and you
want to get a list of the opcode names for a tag, you can use a combination
Opcode::opset functions. Example:
> perl -mOpcode -e'print ``$_\n'' foreach (Opcode::opset_to_ops( Opcode::opset( qw(:base_thread) )) )'